Bitzu

SAA-C03 ยท Roles, federation and cross-account access

IAM roles and temporary credentials

Roles for AWS services (EC2 instance profiles, Lambda execution roles), AWS STS temporary credentials and why roles beat stored access keys.

Key points

  • IAM role: identity with permissions but no password or long-term keys.
  • Assumed by: EC2 instance (instance profile), Lambda function (execution role), a user or another account.
  • AWS STS returns temporary credentials: access key ID, secret access key, session token, expiration time.
  • They expire on their own, so nothing permanent is stored in code, AMIs or config files.

Source: https://docs.aws.amazon.com/cli/latest/reference/sts/assume-role.html

Practice questions

Single choice

Besides an access key ID and a secret access key, what does a successful sts:AssumeRole call return?

  1. A console password and an MFA seed
  2. A session token and an expiration time
  3. An X.509 signing certificate and a key pair
  4. A refresh token valid for 30 days
Show answer

Answer: B. A session token and an expiration time

Temporary credentials always come with a session token and an expiration time; requests signed without the token are rejected. STS does not issue passwords, MFA seeds or X.509 certificates for role sessions.

Select all that apply

Which statements about EC2 instance profiles are correct?

  1. An instance profile can contain only one IAM role
  2. Creating an EC2 role in the console also creates an instance profile with the same name
  3. Applications on the instance get temporary credentials that are refreshed automatically
  4. Credentials delivered through an instance profile never expire
  5. An instance profile can hold up to five roles after a quota increase
Show answer

Answer: A. An instance profile can contain only one IAM role, B. Creating an EC2 role in the console also creates an instance profile with the same name, C. Applications on the instance get temporary credentials that are refreshed automatically

An instance profile holds exactly one role (a hard limit), the console creates a same-named instance profile when you create a role for EC2, and the instance receives temporary credentials that are refreshed automatically. The credentials do expire, and the one-role limit cannot be raised.

True or false

To give an EC2 instance the permissions of two different roles, you can add both roles to its instance profile.

Show answer

Answer: False

False. An instance profile holds only one role and that limit cannot be increased. Combine the needed permissions in one role (or have the application assume a second role through STS).

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More SAA-C03 topics in this module