AWS CLI, SDK, IAM Roles & Policies Flashcards

1
Q

What is the purpose of EC2 Instance Metadata?

A

To allow an EC2 instance to learn about itself, such as instance ID, without needing IAM permissions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the URL for EC2 Instance Metadata?

A

http://169.254.169.254/latest/meta-data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can you retrieve IAM policy from EC2 metadata?

A

No, only IAM Role name is available, not the policy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the difference between metadata and user data on EC2?

A

Metadata is instance information; user data is a launch script run once at boot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between IMDSv1 and IMDSv2?

A

IMDSv1 allows direct metadata access; IMDSv2 requires a session token for improved security.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you use MFA with the AWS CLI?

A

Use the STS GetSessionToken API to generate temporary credentials.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the command to get temporary credentials using MFA in AWS CLI?

A

aws sts get-session-token –serial-number <mfa-arn> --token-code <code> --duration-seconds 3600</code></mfa-arn>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which programming languages are supported by AWS SDK?

A

Java, .NET, Node.js, PHP, Python (boto3), Go, Ruby, C++.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which SDK does AWS CLI use internally?

A

Python SDK - boto3.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What region is used by default if not configured in SDK?

A

us-east-1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Exponential Backoff used for in AWS?

A

To handle intermittent throttling errors with retries after increasing delays.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What should you do for consistent API throttling?

A

Request a service limit increase.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are example API rate limits in AWS?

A

EC2 DescribeInstances: 100 calls/sec; S3 GET: 5500 per second per prefix.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the AWS CLI credentials provider chain order?

A
  1. CLI options 2. Env vars 3. CLI credentials file 4. CLI config file 5. ECS container creds 6. EC2 instance profile.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the AWS SDK default credentials provider chain?

A
  1. Java properties 2. Env vars 3. Credentials file 4. ECS container creds 5. EC2 instance profile.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

In a scenario where environment variables are used on an EC2 instance, why might it override instance profile permissions?

A

Because environment variables have higher priority in the credentials provider chain.

17
Q

What is the top AWS credential management best practice?

A

Never store AWS credentials in your code.

18
Q

How should credentials be managed inside AWS?

A

Use IAM roles: EC2 roles, Lambda roles, ECS roles.

19
Q

How should credentials be managed outside AWS?

A

Use environment variables or named profiles.

20
Q

What is SigV4 in AWS?

A

It’s the signing process used to authenticate AWS HTTP requests.

21
Q

When do you need to manually use SigV4?

A

When making direct HTTP API calls without the SDK or CLI.

22
Q

Do AWS CLI and SDK sign requests automatically with SigV4?

A

Yes, they handle the signing process automatically.

23
Q

What is a subnet?

A

A partition of a VPC’s network; tied to an Availability Zone.