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
IAM
user specifically for my CircleCi account that can currently access allAWS S3
buckets and perform all actions. -
I tested the credentials in the
AWS Policy Simulator
and also tested with theawscli
on my local machine. All tests passed and showed the IAM user as having access. -
I saved the AWS
Access Key ID
and AWSSecret Access Key
into theAWS Permissions
section of my project -
I wrote up a deploy script in my
deploy_staging.sh
file 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.yml
file 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?