Fixing Permission Denied Errors with AWS CLI in CircleCI

Overview

When using the CircleCI AWS CLI orb (version 5.4.1 or similar), you may encounter a permission denied error during AWS CLI configuration:

 
[Errno 13] Permission denied: '/home/circleci/.aws/credentials'
Exited with code exit status 255

AWS CLI version 2.33.9 introduced a bug where running aws --version with elevated privileges creates the ~/.aws/cli/cache/ directory with root ownership. This prevents non-root users from writing to their own AWS configuration files.

The bug is documented in the AWS CLI GitHub repository (issue #10031) and occurs when AWS CLI is installed or verified using sudo, which is common in CI/CD environments.

Solution: 

Pin the AWS CLI version to 2.33.8, or update to 2.33.10 which do not have this bug. Update your CircleCI configuration to specify the version parameter like so:

- aws-cli/setup:
    version: "2.33.8"

 

Additional Resources

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.