I am creating a EC2 instnace through a script such like:
const instanceParams: EC2.Types.RunInstancesRequest = {
ImageId: AWSImageIDs.AmazonLinux_arm64,
InstanceType: 't4g.nano',
MinCount: 1,
MaxCount: 1,
UserData: userData,
SubnetId: SubnetIds.QA1,
IamInstanceProfile: {Arn: INSTANCE_PROFILE_ARN},
SecurityGroupIds: [SecurityGroupIds.QA_AllowTraffic],
};
const instance = await new EC2({apiVersion: '2016-11-15'})
.runInstances(instanceParams)
.promise()
It creates the instance just fine. When I got to EC2 through the AWS Console, I see the instance, and I see the role for the instance profile attached to the instance. The role has the S3FullAccessPolicy attached.
However when I run aws configure list
it returns:
profile <not set> None None
Expectedly aws s3
commands fail with unable to locate credentials
. I'm not sure why the instance doesn't believe the profile is attached, when the AWS Console does?