AWS 20, 21 Flashcards

1
Q

NoSQL databases scale vertically, true or false?

A

False

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

For a composite primary key in DynamoDB, partition keys can never be the same, true or false?

A

False. Partition keys can be the same as long as sort keys are different.

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

What are partition keys and sort keys also known by?

A

Hash attribute and range attribute

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

What does one write capacity unit represent?

A

One write per second for an item up to 1 KB in size.

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

We write 10 objects per seconds of 2 KB each. What is the Write Capacity Unit?

A

2 * 10 = 20 WCU

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

We write 6 objects per second of 4.5 KB each. What is the Write Capacity Unit?

A

6 * 5 = 30 WCU (4.5 gets rounded up)

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

We write 120 objects per minute of 2 KB each. What is the Write Capacity Unit?

A

120 / 60 * 2 = 4 WCU

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

10 strongly consistent reads per seconds of 4 KB each, what is our Read Capacity Unit?

A

10 * 4 KB / 4 KB = 10 RCU

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

We read 16 eventually consistent reads per second of 12 KB each, what is our Read Capacity Unit?

A

(16 / 2) * (12 KB / 4 KB) = 24 RCU

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

We read 10 strongly consistent reads per seconds of 6 KB each. What is our Read Capacity Unit?

A

10 * 8 KB / 4 = 20 RCU (we have to round up 6 KB to 8 KB)

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

How do we know which partition data is supposed to go to?

A

Partition keys go through a hashing algorithm to know to which partition they go to

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

You have 10 partitions and 100 RCU and 100 WCU? How are the CU spread?

A

10 WCU and RCU for each partition

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

If you exceed RCU or WCU per partition, what do we get?

A

ProvisionedThroughputExceededExceptions

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

What are the reasons for ProvisionedThroughputExceededExceptions?

A

Hot keys/Hot partitions;

Vary large items;

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

What are the DynamoDB APIs for Writing Data?

A

PutItem;
UpdateItem;
Conditional Writes;

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

If a Batch Write fails it will automatically retry, true or false?

A

False. It is up to the application to retry the operation.

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

What are the Reading Data APIs?

A

GetItem;
BatchGetItem (up to 100 items, up to 16 MB of data);
Query;
Scan

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

What is a ProjectionExpression paramater in the GetItem API call?

A

Can be specified to include only certain attributes

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

We only get 1 MB of data in a DynamoDB scan, what can we do to continue reading?

A

Pagination. When we scan, if there are more items, it will return a LastEvaluatedKey in the result. If that is present, provide the LastEvaluatedKey and use it in the ExclusiveStartKey parameter for the next Scan request.

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

Every GSI must have a partition key and sort key, true or false.

A

False. Must have a partition key but does not need a sort key.

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

If writes are throttled on the GSI, what happens to the main table?

A

It will be throttled as well.

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

What is an optimistic locking/concurrency database?

A

It makes sure that the item that the client thinks it is updating or deleting is the same as the item in the DB’
DB prevents this by having a versionID attached to the item and if it is changed between getting the item and deleting it.

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

What is DynamoDB DAX? What is the default TTL?

A

It provides caching for DynamoDB;

5 minutes;

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

When would we use DynamoDB DAX vs ElastiCache?

A

We can use DAX for Queries and Scans generally but can use ElastiCache for much more dynamic data storing.

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

What are the four information types that we can get from DynamoDB streams?

A

KEYS_ONLY, NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGE

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

True or False, records are retroactively populated in a stream after enabling it?

A

False.

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

TTL in DynamoDB uses WCU and RCU, true or false?

A

False.

28
Q

What are the four important DynamoDB CLI options for Pagination?

A
  • -max-items
  • -starting-token
  • -page-size
  • -no-pagination
29
Q

What is the different between Dynamo DB Session State Cache and ElastiCache?

A

ElastiCache is in-memory but DynamoDB is serverless

30
Q

We have partition keys for DynamoDB that are not very diversified. For example, say we are voting for two items, since we only have to ids to represent the id, we would run into partition issues. What is a solution?

A

Add a suffix or prefix. For example, instead of Primary Key just being Candidate_A, we can have Candidate_A-2. These can be random or calculated.

31
Q

What is a concurrent write?

A

When two people write to an item, and the second one overwrites the first one.

32
Q

What is a conditional write?

A

Only update an item if a condition is met. If two writes happen with the same condition, the first write succeeds and the second one fails.

33
Q

What is the max object size in DynamoDB?

A

400 KB

34
Q

What is the Large Objects Pattern for DynamoDB?

A

You write large objects to S3 and store the meta data for clients to retrieve. The clients then go to S3 using the metadata.

35
Q

What are three ways to Copy a DynamoDB Table?

A

Use AWS DataPipeline;
Create a backup and restore backup;
Scan + Write

36
Q

What can we use to help migrate DynamoDB?

A

Amazon DMS

37
Q

We are getting a ProvisionedThroughputExceededExceptions but after checking the metrics, we see we haven’t exceeded the total RCU/WCU we had provisioned. What happened?

A

We have a hot partition / hot key. Although the tables capacity units are still available, a partition is getting over-used

38
Q

You are about to enter the Christmas sale and you know a few items in your website are very popular and will be read often. Last year you had a ProvisionedThroughputExceededException. What should you do this year?

A

Create a DAX cluster.

39
Q

You want to increase the performance of your scan operation. What should you do?

A

Use Parallel Scans

40
Q

You would like to paginate the results of a DynamoDB scan in order to minimize the amount of RCU that you will use for that CLI command. Which CLI options should you use?

A

–max-items & –starting-token

41
Q

What is Edge-Optimized for API Gateway?

A

Requests are routed through the CloudFront Edge locations; the API Gateway still lives in only one region

42
Q

We have made changes to our API Gateway endpoints, changing response headers and body. We go to test them out in our application and the changes don’t show up. What went wrong?

A

We need to remember to deploy them

43
Q

We are attaching stages in API Gateway to specific aliases in AWS Lambda. What is an important step to make sure they are properly configured together?

A

We need to make sure we can attach the proper bucket policy. This allows API Gateway to access the lambda with the proper configuration for which alias to hit. This is done through the CLI

44
Q

We create Api Gateway Mapping Templates when we want to use a PROXY method, true or false?

A

False, we must not use Proxy methods. This doesn’t allow us to change request or response information.

45
Q

What are mapping template used for in API Gateway?

A

They allow us to configure request and response data for APIs

46
Q

What do Mapping Templates use to help us dynamically program values?

A

Velocity Template Language (VTL)

47
Q

What is the default TTL for API Gateway cache?

A

300 seconds

48
Q

API Gateway caches are defined at the method level, true or false?

A

False. At the stage level. However, it is possibly to override cache settings per method.

49
Q

How can we do API Gateway Cache Invalidation?

A

We are able to flush the cache immediately;

Clients can invalidate the cache with header Cache-Control: max-age=0;

50
Q

What should we do to make sure our Cache is secure from unwanted invalidation?

A

Impose an InvalidateCache policy for the user execution role

51
Q

What is an API Gateway usage plan?

A

You can use a usage plan to make your APIs available as product offering to your customers. You can control who can access them and at what costs.
We can use API keys to identify API clients and meter access.

52
Q

What are the steps to configure a usage plan?

A

Create your API/s, configure the methods to require API keys, and deploy the APIs to stages;
Generate or import API keys to distribute to application developers;
Create the usage plan with the desired throttle and quota limits;
Associate API stages and API keys with the usage plan;

53
Q

How do clients supply the API key for a usage plan endpoint?

A

Supply the key in the x-api-key header in the request to the API

54
Q

With CloudWatch Metrics for API Gateway, what is the IntegrationLatency? How does this differ from Latency?

A

It is the time between when the API Gateway relays the request to the backend and when it receives a response from the backend.

This differs from Latency in that Latency is when the API gateway receives the request and returns a response to the client.

55
Q

The max amount of time for latency for API Gateway is…

A

29 seconds

56
Q

What is the API Gateway account limit? What error will you see?

A

API Gateway throttles requests at 10,000 rps across all API;

429 Too Many Requests

57
Q

You enable CORS for a resource and yet you still cannot access it through a client. What could be the issue?

A

If the resource has a proxy integration, it does not do CORS through API Gateway. Your backend is responsible for handling CORS.

58
Q

How do we provide our IAM credentials to API Gateway?

A

We leverage “Sig v4” capability where IAM credentials are in the headers

59
Q

How does the Sig v4 capability work with IAM and API Gateway?

A

A request is made with Sig v4 to API Gateway;
API Gateway is used to make a call to IAM;
If the policy check is a success, a call is made to the Backend;

60
Q

What is the main purpose of an API Gateway resource policy?

A

Allow for Cross Account Access

61
Q

How does Cognito and API Gateway work together for authentication and authorization?

A

The client will reach out to Cognito User Pools to authenticate and receive a token;
Then they will make a method call to the API Gateway passing the token
Api Gateway sends the token to Cognito to authorize and allow access the backend

62
Q

How does the Lambda authorizer work with API Gateway?

A

The client retrieves a token form a 3rd party authentication system;
Client calls API Gateway with bearer token;
API Gateway hits a Lambda Authorizer;
Lambda Authorizer checks authorization with third party and sends IAM Principal and IAM policy back to API Gateway;
If allowed, API Gateway hits Backend and policy is cached*

63
Q

Your API is getting hit with the same GET request over and over. Your lambda function is overloaded and your bill starts to substantially increase. The GET response returns the same payload and changes only daily. What should you do?

A

Enable stage cache

64
Q

How can you invalidate the cache client side?

A

Pass the header Cache-Control: max-age=0

65
Q

You would like to validate 3rd party tokens provided in the Bearer Header for authentication. You need

A

Lambda Authorizer

66
Q

You would like to provide a Facebook login before your users call your API hosted by API Gateway. You need seamlessly authentication integration, you will use

A

Cognito User Pools. This is a great option for Social sign ins.

67
Q

In BatchWriteItem, if item writings fails, the batch is returned, true or false?

A

False, the failed operations return as UnprocessedItems in the response.