AWS SDK and API Flashcards

1
Q

Should you provide your aws_secret_access_key and aws_access_key_id in your application code

A

No. SDK credentials should be stored outside of your code

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

There are 3 places where your aws_secret_access_key and aws_access_key_id can be stored for your application to access - what are they?

A
Programming Language parameter store
local files (~./aws)
environment variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When you make API calls to AWS services, for most services those requests are directed at a specific endpoint that corresponds to which of the following?

  • AWS Facility
  • AWS Region
  • AWS AZ
  • AWS edge location
A

AWS region - you choose a regional API endpoint either from your default configuration or by explicitly setting a location for you API client.

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

You make an API request to Polly to list the voices offered and you recieve the following error:

Unable to connect to endpoint URL:
httpsL//polly.us-east-1a.amazon.aws.com/voices

Why?

A

us-east-1a is an AZ, not a region, and API calls are made to the region, not the AZ.

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

The principals who have access to ASSUME an IAM role are defined in which document?

  • IAM Access Policy
  • IAM Trust Policy
  • MS Grant Token
  • AWS Credentials File
A

The IAM trust policy defines the principals who can request role credentials from AWS STS.

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

API’s within AWS are rate limited, i.e. S3 has a limit of 5500 GET requests per second. What should you do if you are getting:

  • Intermittent Errors
  • Consistent Errors

Due to rate limiting?

A

If you are getting intermittent errors, this is probably due to spikes in load so exponential back off will likely resolve. If the errors are consistent, you probably need to request that the rate limits are raised.

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

What sort of exception gets thrown if you have hit a rate limit?

A

ThrottlingException

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

What is exponential backoff?

A

Simply - -every time time you retry a request, you double the amount of time you wait before issuing the request again

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

For exponential back off - what do you need to do if you are developing through the SDK?

A

Nothing, Exponential back off is built into the SDK - but if your are interacting with the API as-is outside of the SDK then you will need to build it in yourself.

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

When using either the AWS SDK what member of the Credentials Provider Chain has precedent over all others?

A

Environment variables have precedent over all other items in the credential provider chain for the SDK.

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

What is the Credentials Provider Chain

A

The credentials provider chain is the order in which AWS will look for credentials, starting with Command line Arguments then Environment Variables and finishing with instance provider credentials (the lowest precedent). This means that credentials and their assigned permissions at a higher level will over-ride those at a lower level.

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

You are developing an application within AWS. Should you store your AWS credentials in code?

A

No. Never. When working in AWS credentials should ALWAYS be inherited from the credentials chain - as we are in AWS then we can leverage IAM (i.e. Instance roles for an EC2 instance, ECS roles for ECS taskes, lambda roles for lambda tasks)

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

We are building an application outside of AWS and we need to be able to pass credentials to access AWS services, what is the best practice for this?

A

Use of environment variables and or named profiles (i.e. CLI profiles)

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

what is sigv4 used for?

A

Sigv4 is used for signing requests made to the AWS http API.

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

SigV4 can be sent to AWS in two ways - what are they? (hint - think of the structure of an HTTP request)

A

SigV4 can be sent either within a requests header or as a query string (in the case of S3)

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

When using the AWS SDK or CLI, what do you need to do to sign requests made to AWS?

A

Nothing, SigV4 is built into the CLI and SDK for you. If you are using something other than these, you will need to implement SigV4 yourself.

17
Q

What are the two things used to sign a request for SigV4? (Hint: keys)

A

Access Key and Secret Access Key

18
Q

I’d like to deploy an application to an on premise server. The server needs to perform API calls to S3. What is the most secure way of achieving this?

A

Create an IAM user for the application and put the credentials into environment variables.

19
Q

Can an EC2 instance retrieve the IAM policy JSON document that’s attached to them using the CLI with no role attached?

A

No. You can retrieve the role NAME but not the JSON document

20
Q

When using the CLI, what is the FIRST provider in the credentials provider chain?

A

Command line options are the first, and highest precedent provider in the CLI

21
Q

When using the SDK, what is the FIRST provider in the credentials provider chain?

A

Environment variables are the first and highest precedent provider for the SDK

22
Q

For both the SDK and the CLI, what is the LOWEST precedent provider in the credentials provider chain?

A

Instance Profile Credentials