Summary: I'm trying to automate the deployment of a static site (gatsby) to an S3 bucket using a CircleCI orb, but I keep getting the following error:
#!/bin/bash -eo pipefail
aws configure set aws_access_key_id
$AWS_ACCESS_KEY_ID
--profile default
The config profile (*******) could not be found
Exited with code exit status 255
CircleCI received exit code 255
I already checked my environment variable for AWS_ACCESS_KEY_ID in an AWS context I setup in CircleCI. I searched for some answers on the circleci official forum, I tried the adviced offered here https://discuss.circleci.com/t/you-must-specify-a-region-you-can-also-configure-your-region-by-running-aws-configure-exited-with-code-255/14392, but still no progress fixing the issue. I'd appreciate if anyone could give me a hand.
Also, here's my CircleCI config.yml file
version: 2.1
executors:
node_executor:
docker:
- image: circleci/node:12.19.1
orbs:
aws-cli: circleci/[email protected]
aws-s3: circleci/[email protected]
jobs:
setup_gatsby:
executor: node_executor
working_directory: ~/application
steps:
- checkout
- run:
name: Update npm
command: "sudo npm install -g npm@latest"
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
name: Restoring package.json cache
- run:
name: Install npm
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
name: Saving package.json cache
paths:
- node_modules
- save_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/application
build_gatsby:
executor: node_executor
working_directory: ~/application
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Build
command: |
npm run clean
npm run build
- save_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/application
deploy_gatsby:
executor: aws-cli/default
working_directory: ~/application/public
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- aws-s3/sync:
from: .
to: AWS_S3_BUCKET_NAME
arguments: |
--acl public-read \
--cache-control "max-age=86400"
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
aws-region: AWS_DEFAULT_REGION
workflows:
version: 2.1
build:
jobs:
- setup_gatsby
- build_gatsby:
context: aws
requires:
- setup_gatsby
filters:
branches:
only:
- master
- deploy_gatsby:
context: aws
requires:
- build_gatsby
filters:
branches:
only:
- master