AWS-CLI behavior change

We just had our deploy scripts break and since I couldn’t find anywhere else mentioning it, I thought I’d share our fix.

We just noticed today that the aws sync command in our react app deploy script started breaking

Run aws s3 sync build/ s3://REDACTED

<botocore.awsrequest.AWSRequest object at 0x7f66c0868fa0>
Error: Process completed with exit code 255.

I found this issue which seems related: Using aws-cli in AKS fails during IMDS request · Issue #5234 · aws/aws-cli · GitHub

updating the build script to add AWS_DEFAULT_REGION to the env solved the issue and our deploys are working again!

  build:
    name: 'deploy:production:build'
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://registry.npmjs.org/
      - run: npm ci
        env:
          NODE_AUTH_TOKEN: '${{ secrets.NPM_AUTH_TOKEN }}'
      - run: 'npm run build'
        env:
          NODE_AUTH_TOKEN: '${{ secrets.NPM_AUTH_TOKEN }}'
      - name: 'Sync to AWS'
        env:
          AWS_ACCESS_KEY_ID: '${{ secrets.AWS_ACCESS_KEY_ID }}'
          AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}'
          AWS_DEFAULT_REGION: 'us-west-2'
        run: 'aws s3 sync build/ s3://REDACTED'
2 Likes

Thanks for sharing this!

I quickly checked the Actions in the GitHub Marketplace and all of the ones I looked at had AWS_DEFAULT_REGION listed in the description. So those who use a pre-made Action should not encounter this problem, fortunately.