aws-lambda-r
aws-lambda-r copied to clipboard
Running setup_user.sh PRJ_NAME: command not found
Great project!
I am trying to configure the setup_user.sh script file by following the example file.
I added:
#!/bin/bash
# user settings and secrets
# customize and rename to `setup_user.sh`
# overwrites `secrets_default.sh`, `settings_default.sh`, `setup_auto.sh`
PRJ_NAME ="myproj"
PRJ_BRANCH="myproj"
Then I run scripts/01_main.sh
Got error:
\e[32mINFO :\e[39m Checking project directories \e[32mINFO :\e[39m Loading default settings and secrets /Users/macos/Documents/r-ec2/myproj/settings/setup_user.sh: line 6: PRJ_NAME: command not found \e[31mERROR:\e[39m PRJ_NAME is \e[95mMISSING\e[39m. Exiting.
Is there a simple way to configure the setup_user script?
Got a bit further:
scripts/01_main.sh \e[32mINFO :\e[39m Checking project directories \e[32mINFO :\e[39m Loading default settings and secrets
------------------------- GIT REPO $(FY $PRJ_NAME) ----------------- On branch master nothing to commit, working tree clean /Users/macos/Documents/r-ec2/ipromx/scripts/03_check_settings.sh: line 23: mapfile: command not found \e[31mERROR:\e[39m Not on branch \e[36m(master)\e[39m. Exiting.
Running: GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin17.5.0)
GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin17.5.0)
mapfile: command not found
This is very strange, mapfile
should be part of Bash 4.0+ ... I do not know why you are getting this particular error (it may depend on your configuration ?). I am not also sure why you are seeing the escape characters \e[32m
- these should be colors in the terminal (when configured properly).
I would recommend to try this project first on a Linux machine (e.g. in EC2 or a local VM) to see how it works. Then identify any macos
related issues.
Currently I cannot test the scripts on OSX; thus any insights / issues / solutions will be appreciated.
Added: #!/usr/local/bin/bash at the top of all sh files to solve the mapfile error.
Now I am stuck again:
scripts/01_main.sh INFO : Checking project directories INFO : Loading default settings and secrets
------------------------- GIT REPO $(FY $PRJ_NAME) ----------------- On branch master nothing to commit, working tree clean INFO : On branch (master) INFO : Branch (master) is clean. WARN : Not all commits on branch (master) pushed to remote or not tracking changes.
------------------------- AWS CREDENTIALS -------------------------- ERROR: Your AWS access key is: MISSING. Exiting.
Using AWS_PRFL="--profile myprofile" in settings_default.sh
But that does not seem to be enough.
Tried to add the keys to setup_user.sh
AWS_ACCESS_KEY_ID=XXXX.. AWS_SECRET_ACCESS_KEY=XXXXX...
No luck..
Look in secrets_default.sh
too. The keys to provide are IAM_ACCESS_KEY_ID
and IAM_SECRET_ACCESS_KEY
(to avoid the same name as the local AWS env variables). They are needed to perform AWS operations while on EC2.
Thanks! Yes I am switching to Ubunu Linux now.
I'm still seem to getting forward on OSX:
cripts/01_main.shINFO : Checking project directories INFO : Loading default settings and secrets
------------------------- GIT REPO $(FY $PRJ_NAME) ----------------- On branch master nothing to commit, working tree clean INFO : On branch (master) INFO : Branch (master) is clean. WARN : Not all commits on branch (master) pushed to remote or not tracking changes.
------------------------- AWS CREDENTIALS -------------------------- Your AWS access key is: ********NKNQ Your AWS secret access key is: ********J2vN AWS Account ID: ********1270 AWS Region: us-west-1
------------------------- EC2 INSTANCE ----------------------------- No Custom AMI present, using Default AMI: ami-4fffc834 Instance Type: t2.micro ERROR: Subnet ID: subnet-MISSING. Exiting.
ERROR: Subnet ID: subnet-MISSING. Exiting.
You need to provide values otherwise the variables will default to a value of $MISSING
.
Some familiarity with AWS is needed. The comments in the .sh
files (in the settings/
directory) and the documentation in the doc/
folder help somehow. Finally, there is the "auto setup" created by following step 6 of the main README.