Developer Associate Flashcards

1
Q

What additional logging can be enabled in S3?

A

Object level logging to CloudTrail

Server access logging - log files delivered to another bucket

Storage, Request and Data Transfer metrics in CloudWatch. Storage is free.

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

What is an ACL in S3?

A

Access Control List.

Is per object.

Can grant access to object, including public and cross-account access

Different permission to put an object’s ACL - can’t just do it with s3:PutObject

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

What happens if you attempt to put a public object in an S3 bucket where public access settings do not allow public objects?

A

Forbidden error

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

When are headers required when uploading an object that requires encrypting to S3?

Describe the headers used when uploading an object to S3 that is to be encrypted

A

Use headers if you’re not using default encryption - if you are you don’t need the headers.

You can enforce encryption without using default encryption by using a bucket policy that rejects requests that don’t have the headers. The headers are like this:

x-amz-server-side-encryption: AES256
x-amz-server-side-encryption: ams:kms

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

What CORS configurations are available for S3?

A

AllowedOrigin

AllowedMethod (e.g. GET)

MaxAgeSeconds (how long browser should cache preflight request)

AllowedHeader (e.g. x-amz-*)

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

How can you optimise GETTING objects from S3 when you have a lot of requests?

A

Use CloudFront

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

How can you optimise PUTTING objects into S3 when you have a lot of requests?

A

Random prefixes to distribute across partitions

but - not really necessary now there’s higher limits

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

What are the S3 limits for GET and PUT?

A

GET - 5,500

PUT - 3,500

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

What are the two types of ARN for lambda functions?

A

Unqualified - without version

Fully qualified - with version, e.g. 1 or $LATEST

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

Are lambda functions immutable?

A

Yes - once published they cannot be changed. Publishing a new version results in a new version number

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

How can lambda traffic be split using aliases?

A

Using a percentage between a maximum of 2 aliases.

$LATEST cannot be used, it must be a specific version

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

Do step functions support branching and parallel steps?

A

Yes. Can also define retry behaviour

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

How is a state machine described in step functions?

A

Amazon State Language (JSON)

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

What are the components of X-Ray?

A

X-ray API - hosted by amazon

X-ray daemon - can run on a server, sends data to the API

X-ray SDK and CLI - sends data to daemon and/or API (other AWS tools might do this too)

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

What tools does the X-Ray SDK provide?

A

SDK provides ways to hook in X-ray:

Interceptors to trace incoming HTTP requests

Client handlers to track calls via AWS SDK

HTTP client

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

Which services are automatically integrated with X-ray?

A

Lambda

API gateway

EC2

ELB

Elastic beanstalk

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

Describe the default throttling limits for API Gateway

A

10,000 requests per second across all APIs in account

5,000 concurrent requests at once across all APIs in account

Exceeding these will result in “429 too many requests” responses

E.g. 10,000 requests in one millisecond - only 5,000 served. 10,000 spread evenly over 1 second - all served.

5,000 in 1 millisecond and 5,000 spread over the other 999 milliseconds - all requests served

Limits can be adjusted for a cost

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

What support does API Gateway offer for SOAP?

A

SOAP web service passthrough can be used with API for legacy stuff

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

What does SOAP stand for?

A

Simple Object Access Protocol

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

What is a KMS CMK?

A

Customer Master Key

Used for encrypting data up to 4KB

Typically used to encrypt data keys that are managed outside of KMS

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

Describe how key material can be created for KMS CMKs

A

KMS can generate it for you

Import your own by downloading a public key, encrypting and then uploading

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

Can you export KMS keys?

A

No - could need to use Cloud-HSM to do this

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

What do KMS key policies do?

A

Allow you to set permissions for who can use and edit the key. It’s possible to completely lock yourself out - would need to contact AWS Support to get back in

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

Are KMS keys regional?

A

Yes

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

Can you delete KMS keys?

A

Deletion can be scheduled, but you have to wait a minimum period of 7 days

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

Describe some common CLI calls for KMS

A

aws kms encrypt

aws kms decrypt

aws kms re-encrypt (allows you to decrypt existing ciphertext and target a new key to re-encrypt - all happens server-side so no secrets exposed - value passed in must be from previous encrypt or generatedatakey call)

aws kms enable-key-rotation (results in a new key each year)

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

What is Web Identity Federation?

A

Allows access to AWS resources after authenticating with a web-based identity provider (e.g. Facebook or Google)

User trades authentication code from provider which is traded for short-term AWS credentials

This can be handled through Amazon Cognito (an identity broker) - e.g. a mobile app needs to access S3, the app can sign in user via Facebook and cognito, get AWS creds, and then access S3 directly.

No need to embed credentials

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

Describe Cognito identity and user pools

A

User pools - provides JWTs on successful authentication. Can use with web-based identity providers

Identity pools - provide short-lived AWS credentials to identities. It integrates with an identity provider, which can be cognito user pools

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

Describe Cognito push synchronisation

A

Push synchronisation - uses SNS to send a silent push notification to sync user data across all devices they are associated with

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

What is STS assume-role-with-web-identity?

A

Provides temp credentials for user authenticated with web identity provider (e.g. Facebook of Cognito user pools)

Cognito identity pools uses this under the covers
Response from this call will give you an arn and id for the “role” - but this isn’t an IAM role - just a way to programmatically refer to this temporary set of credentials

Response also contains actual credentials (key and secret) to use

The provider would have to be configured in IAM first to get credentials!

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

What does each Kinesis shard provide in terms of capacity?

A

READ: 5 transactions per second, up to 2mb per second

WRITE: 1,000 transactions per second, up to 1mb per second (including partition key)

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

How does Kinesis decide which partition data goes in?

A

Kinesis uses partition key to decide which shard data should go in. Apps must define a partition key when putting data into a stream

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

How does lambda/kinesis integration work?

A

In terms of lambda integration, lambda polls kinesis and processes per shard (so blocking is per shard if there’s an error). This is configured with event source mapping, along with SQS and DynamoDB. Lambda is invoked synchronously in these cases

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

What does the elastic beanstalk managed platform updates feature do?

A

Apply OS patches and runtime environment patches (e.g. Java)

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

Can a single elastic beanstalk app have multiple environments?

A

Yes

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

What are the 4 deployment policies available in elastic beanstalk?

A

All at once - new version deployed to all instances at same time - instances out of service while this is happening - rollback involves deploying previous code

Rolling - deploy to batch of instances at a time

Rolling with additional bath - extra batch to compensate for out of service batch that is being updated

Immutable - new instances started in new ASG, and once health checks passed the instances are moved to initial ASG

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

How can an elastic beanstalk environment be configured in source code?

A

Elastic beanstalk environment can be customized with a YAML file called whatever you like with a .config extension saved in a folder called .ebextensions. Can do stuff like create linux users/groups, run shell scripts, configure load balancer etc. (e.g. configure health check). This is included in top level directory of app source code

38
Q

How can RDS be used with elastic beanstalk?

A

Coupled deployment: Can deploy RDS from EBS, but not always a good idea as lifecycle of DB is then tied to app (i.e. if app is deleted, RDS DB will be too)

Decoupled deployment: spin up in RDS. Will need to open SG rules and provide connection string to EBS

39
Q

What is the maximum message size in SQS?

A

256KB

40
Q

What is the maximum long poll timeout in SQS?

A

20s

41
Q

Which API call is used to change message viability in SQS?

A

ChangeMessageVisibility API call is used to change the message visibility

42
Q

What are the 2 consistency models for dynamoDB?

A

Eventually consistent reads (closest data replication is returned first) - best read performance

Strongly consistent reads (all replies evaluated and newest returned) - all writes that received successful response are returned

43
Q

What is the structure of data in dynamoDB?

A

Table
Item
Attribute (key/value pairs)

44
Q

What are the two types of primary key in DynamoDB?

A

Partition key (unique attribute, e.g. user id) - put into internal hash function to determine partition where data will be physically stored. If using this as primary key, no two items can have same partition key

Composite key - partition + sort keys. Must be unique overall, so can use same partition key for multiple items but must have different sort keys

45
Q

Where are partition and sort keys stored for DynamoDB items?

A

The partition and sort keys are just attributes on items

46
Q

Should you have many or few partition keys in DynamoDB?

A

It’s good practice to use high-cardinality attributes for partition keys (e.g. OrderID)

47
Q

How can IAM be used for item-level security in dynamoDB?

A

IAM conditions can be used to lock down access to specific records

Condition would be ForAllValues and look at dynamodb:LeadingKeys - which is the partition key

Can also use dynamodb:Attributes to lock down access to specific attributes

48
Q

What are the supported document formats of DynamoDB?

A

JSON, HTML and XML

49
Q

What are the two types of index in DynamoDB?

A

Maintains an additional sort key for a given partition key

(If querying using the partition key, the main table can be used as partition key determines physical storage location)

If querying using the sort key, a local secondary index can be used to speed things up

Each local secondary index must specify a partition key - it can only work on one partition. You can create multiple indexes, though

This index must be created when table is created - can’t be created, removed or altered afterwards

=====================================================

Uses any specified partition and sort key (as in - the index has its own partition/sort keys that can be defined from any property)

Sort key is optional

Can be added/removed/altered any time

50
Q

What is an attribute projection in DynamoDB indexes?

A

Where attributes from items are copied into the index. Can have anywhere between 0 and all attributes copied over.

51
Q

How is throughput specified for DynamoDB indexes?

A

Local secondary index - shares throughput with table

Global secondary index - has its own

52
Q

How does having a local secondary index affect write performance?

A

There are two writes for every write operation - one for the table, one for the index

53
Q

Which consistency models does each type of index support in DynamoDB?

A

Local - both

Global - eventual only

54
Q

How are global secondary indexes kept in sync with the table in DynamoDB?

A

Asynchronously

55
Q

What is the maximum total size of items in a single partition that a local secondary index can support?

A

10GB

56
Q

Describe the properties of a Query in DynamoDB

A

Query - uses a primary key and a list of attributes you wish to read (specified with the ProjectionExpression parameter)

Can use an optional sort key name and value to refine the results

Results always ordered by sort key (numeric ascending)

Can reverse order by setting ScanIndexForward parameter to false

ASCII character code values

Eventually consistent by default - need to explicitly set query to be strongly consistent

Can use global secondary indexes - name of index must be specified in Query call

Can also Query local secondary indexes - again have to specify name of index in call

57
Q

Describe the properties of a Scan in DynamoDB

A

Scan - examines every item in the table. Can define a list of attributes you wish to read (specified with the ProjectionExpression parameter)

Careful - a single scan could use up all provisioned capacity for a table, causing other requests to be throttled

By default, returns 1MB of data at a time

Can only scan one partition at a time

Scans can use local secondary indexes and global secondary indexes - need to specify index name in Scan call

58
Q

What are the preferred alternatives to Scan in DynamoDB?

A

GetItem - gets an item based on a set primary key

BatchGetItems - gets items from one or more tables based on primary keys

Query - queries based on partition key, not primary key, so can return multiple items from a single table

59
Q

How can you optimize reads in DynamoDB?

A

Can use a smaller page size (resulting in fewer read operations per request) - will allow other requests to succeed without throttling

Avoid scans if possible - use Query, GetItem or BatchGetItem APIs

Use parallel scans - divides table or index into logical segments and scans them in parallel (you provide Segment and TotalSegments parameters to Scan call - Segment is a number starting at 0 - dynamoDB will figure out the splitting of segments, but you are responsible for running the scans in parallel)

60
Q

Describe DynamoDB capacity units

A

1x write capacity is 1kb write per second

1x read capacity is 1 strongly consistent read of 4kb or 2 eventually consistent reads of 4kb

When calculating capacity units, round up as you’re billed to the nearest kb used (rounding up)

61
Q

What is the “on-demand” pricing model for DynamoDB?

A

In addition to provisioned capacity, you can also select on-demand, where dynamodb automatically scales up and down depending on activity. Great for unpredictable workloads or spikey workloads

62
Q

How many times can you switch between provisioned capacity and on-demand pricing models per day in DynamoDB?

A

Once per day

63
Q

Is pricing model per table in DynamoDB?

A

LOOK THIS UP

64
Q

What is DAX for DynamoDB?

A

Write-through caching service (data written to cache at same time as store)

Your app will send DynamoDB API calls to DAX cluster instead of DynamoDB

Might result in being able to reduce provisioned read capacity

65
Q

What consistency model does DAX support?

A

Only supports eventually consistent reads (NOT strongly consistent)

66
Q

What sort of data and calls will DAX cache?

A

DAX will cache negative (null) results

It will cache Query, Scan, GetItem and BatchGetItem results

67
Q

What is ACID?

A

ACID - Atomic, Consistent, Isolated, Durable

68
Q

Are DynamoDB transactions supported across multiple tables?

A

Yes

69
Q

How might you use a DynamoDB transaction?

A

Can use it do check for a prerequisite before writing (e.g. check a bank account has sufficient funds before moving money)

70
Q

What is DynamoDB global tables?

A

Allows for multi-region, multi-master database

71
Q

How do you create a global table in DynamoDB?

A

Create tables in each region and then use global tables to replicate data between them

72
Q

How does global tables keep data in sync?

A

Keeps track of state by creating attributes on each item:

aws: rep:deleting
aws: rep:updatetime
aws: rep:updateregion

73
Q

What’s the consistency model for global tables?

A

Last writer wins

74
Q

What write consistency models does global tables support in DynamoDB?

A

Doesn’t support strong consistency - if an app requires this it must do all reads/writes from a table in a single region

75
Q

How does DAX interact with global tables?

A

Any DAX clusters in a region won’t be aware of global replication

76
Q

How do transactions interact with global tables?

A

Transactions are supported but disabled by default - must contact AWS Support to enable them

77
Q

What are the default provisioned capacity values of global secondary indexes in DynamoDB?

A

Global secondary indexes inherit the base table’s provisioned capacity units by default

78
Q

Describe TTL in DynamoDB

A

Can set TTL for an item. Item will be deleted when TTL expires

TTL is expressed in epoch time format

You must define the item attribute that contains the TTL
If streams is enabled, you effectively have a 24h backup for TTL deleted items

79
Q

What is DynamoDB streams?

A

Time-ordered sequence of item-level modifications
Encrypted and stored for 24h

Accessed using a dedicated endpoint

By default the primary key is recorded

Before and after images can be captured

Can be used to trigger lambda functions (lambda polls this - event sourcing)

80
Q

Are DynamoDB streams encrypted?

A

Yes

81
Q

What does a ProvisionedThroughputExceededException mean?

A

When request rate too high for provisioned read/write
SDK automatically retries requests until successful

If not using SDK, can reduce request frequency
SDK also supports exponential back-off

Remember - size of request could also exceed provisioned throughput

82
Q

What are the max capacity limits for DynamoDB?

A

Both on-demand and provisioned have default limits of 40,000 read and 40,000 write capacity units per table

80,000 read and 80,000 write units per account

83
Q

What is the max item size in DynamoDB?

A

Max item size: 400kb (this includes all attributes and local secondary index data if applicable)

No limit on number of attributes - but they must fit within maximum item size

84
Q

What is the maximum nested attribute depth in DynamoDB?

A

Max nested attribute depth: 32

85
Q

Describe memcached in elasticache

A

Object caching

Multi-threaded

Not multi-AZ

86
Q

Describe redis in elasticache

A

Key-value store

Supports complex structures: sorted sets and lists

Multi-AZ (master/slave)

87
Q

What is the lazy loading pattern of accessing a cache?

A

App will request from cache first, and if null is returned it will go to DB, get the result, and then save to cache

Advantage: only requested data is cached

Disadvantage: cache miss penalty

88
Q

What is the write-through pattern of accessing a cache?

A

App will save to cache on every write

Advantage: reduced cache misses

Disadvantage: write penalty, and wasted resources if some data in cache is never requested

89
Q

Can the lazy loading and write-through patterns for caching be used together?

A

Could use both in conjunction with each other (e.g. if node fails and is re-created, you’ll need lazy loading to repopulate cache)

90
Q

Is data encrypted at rest in CodeCommit?

A

Yes

91
Q

What protocols can be used to access CodeCommit?

A

HTTPS

SSH

92
Q

What deployment targets does CodeDeploy support?

A

EC2
On-premises
ECS
Lambda