I am trying to run a command to sync a local directory with an AWS S3 bucket. Here are the steps I am using:
-
I created an
IAMuser specifically for my CircleCi account that can currently access allAWS S3buckets and perform all actions. -
I tested the credentials in the
AWS Policy Simulatorand also tested with theawsclion my local machine. All tests passed and showed the IAM user as having access. -
I saved the AWS
Access Key IDand AWSSecret Access Keyinto theAWS Permissionssection of my project -
I wrote up a deploy script in my
deploy_staging.shfile with these instructions:
DEFAULT="default"
PROFILE=${AWS_PROFILE:-$DEFAULT}
BUCKET=bucket-name
DIR=./dist
aws s3 sync $DIR s3://$BUCKET/
- I set up a
circle.ymlfile to run the script for the necessary branches:
machine:
node:
version: 5.1.1
dependencies:
override:
- sudo pip install awscli
test:
override:
deployment:
staging:
branch: master
commands:
- ./deploy_staging.sh
production:
branch: production
commands:
- ./deploy_production.sh
However, when I deploy to Github with my master branch–and everything seems to try to execute as it should–I receive this error message when the sync command is run:
./deploy_staging.sh
./deploy_staging.sh returned exit code 126
bash: line 1: ./deploy_staging.sh: Permission denied Action failed: ./deploy_staging.sh
I haven’t found much, instruction-wise, for accessing the AWS credentials in the CircleCi environment other than this method, but this seems to work easily on my local Mac OSX environment (the instructions in deploy_staging.sh, that is).
What is the trick for getting the correct permissions to run the deploy_staging.sh instructions?