Section 12: AWS CLI, SDK, IAM Roles & Policies Flashcards

1
Q

You want to know if you can create ec2 instances using the AWS CLI without actually creating an issue. How can you do that?

A

Pass the –dry-run flag as the first argument after the command.

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

After running an AWS CLI command it returned an encrypted failure message. Which command can you use to decrypt the message?

A

STS. (Security Token Service)

Run aws sts decode-authorization-message –encoded-message <encrypted-failure-message></encrypted-failure-message>

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

What is IMDS?

A

Instance Meta-Data Service.

You can request meta-data about an instance using a URL

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

What is the difference between IMDS v1 and IMDS v2?

A

IMDS v1 is using a simple HTTP get request:
http://169.254.169.254/latest/meta-data

IMDS v2 takes 2 requests:

Step 1: Get a token
TOKEN=curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"

Step 2: Request meta data using the token
curl -H “X-aws-ec2-metadata-token: $TOKEN” -v http://169.254.169.254/latest/meta-data/

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

What can we use the use MFA for the AWS CLI

A

aws sts get-session-token

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

What will happen if we use the AWS SDK without specifying a default region?

A

It will use us-east-1

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

What is exponential backoff?

A

Retry requests with exponential delays when receiving a 5xx response (ThrottlingException, due to rate limits) when calling the AWS API.

First retry after 1 second
Second retry after 2 seconds
Third retry after 4 seconds
Fourth retry after 8 seconds

Do not retry when receiving 4xx responses.

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

In which order will the AWS CLI look for credentials? (Credentials Provider Chain)

A
  1. Command line options
  2. Environment variables
  3. CLI credentials file (~/.aws/credentials)
  4. CLI configuration file (~/.aws/config)
  5. Container credentials (for ECS tasks)
  6. Instance profile credentials (EC2 Instance Profile)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In which order will the AWS SDK look for credentials? (Java)

A
  1. Java system properties
  2. Environment variables
  3. The default credential profiles file (~/.aws/credentials)
  4. Container credentials (for ECS tasks)
  5. Instance profile credentials (EC2 Instance Profile)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which 2 options do you have to send a SigV4 signed request?

A
  1. using HTTP Headers
  2. using Query parameters (ex: S3 pre-signed URLs)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly