hackoregon / devops-17

deployment tools for Hack Oregon projects
4 stars 3 forks source link

Assignment 9 - cannot access S3 bucket-hosted project_config.py #33

Closed MikeTheCanuck closed 7 years ago

MikeTheCanuck commented 7 years ago

In assignment 9 the /bin/getconfig.shscript is downloading the project_config.py file from S3:

    aws s3 cp \
          s3://$CONFIG_BUCKET/${DEPLOY_TARGET,,}/project_config.py \
          $PROJ_SETTINGS_DIR/project_config.py;

Unfortunately, Read requests to that bucket and another testing bucket both result in "403 Forbidden" or "Access Denied" errors:

aws s3 ls s3://assign9-config/integration/

An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied

$ aws s3 cp s3://assign9-config/integration/project_config.py project_config.py
fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden

I've seen the same error when calling the script using ENV VARs and when hard-coding the S3 URL:

    aws s3 cp \
          s3://cfn-templates-hacko-infra/integration/project_config.py \
          $PROJ_SETTINGS_DIR/project_config.py;

You can also see the "403 Forbidden" error at Line 307 of the following Travis build: https://travis-ci.org/MikeTheCanuck/assignment9/builds/207271947

@pdxdiver indicates that he's successfully accessing s3://assign9-config/integration. Need to confirm that e.g. these two commands are succeeding for him:

aws s3 cp s3://assign9-config/integration/project_config.py project_config.py
aws s3 ls s3://assign9-config/integration/
hassanshamim commented 7 years ago

You probably need to configure aws access credentials.

MikeTheCanuck commented 7 years ago

Good thinking @hassanshamim . It turns out the solution was to enable Read access on the S3 bucket, which I worked out with @pdxdiver, and then the existing credentials we had worked fine :)