2
votes

Do EC2 instances which use the same instance profile also use the same metadata credentials?

Put another way, are EC2 metadata credentials unique to the EC2 instance or to the EC2 instance profile?

For example, say I have an IAM role called my-role and an Elastic Beanstalk application called my-app which has an environment called my-app-1. The instance profile for my-app-1 is set to my-role.

If my-app-1 is currently running two EC2 instances, will they both have the same credentials?

1

1 Answers

4
votes

No, EC2 instances with the same instance profile use different metadata credentials.

EC2 metadata credentials are generated for and unique to the EC2 instance, not to the instance profile or to the IAM role.

Note: I tested EC2 instances directly in order to confirm this.