'AWS IAM instance policy applying credentials to instance in one region, but not another
I have a setup where I launch AWS EC2 instances from templates and their AMI contains the AWS CLI, so it can copy over the contents of a private S3 bucket on launch. This template automatically applies an IAM role with the "AmazonS3ReadOnlyAccess" policy. This has been working as intended so far in the eu-west-2 region, but now I wanted to run these instances in us-east-2 region. I copied the AMI and made a new template using identical settings to the ones in eu-west-2, but when the script to sync the S3 buckets launches (it's just a bat file that runs "aws s3 sync ... ...") the contents of the synced folder are empty.
After a bit of looking around I noticed that it throws a "fatal error: Unable to locate credentials" error. I checked the credentials using "aws configure list" and get that access_key, secret_key and region are not set. If I run the same instance back in eu-west-2 these fields are populated.
I've tried recopying the base AMI, recreating the launch templates, creating region specific buckets, creating new IAM policies and all this as both a IAM user and the root user, the credentials still get set in eu-west-2, but not us-east-2. The only configurations that differ are the VPC, subnet and routing table settings - for obvious reasons, as they need to be in a new region. Does anybody know why this might be happening? As I've run out of ideas.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|



