Last active
August 14, 2024 20:47
-
-
Save dboyd13/cff5169f25b4f35e1816edd85943dec5 to your computer and use it in GitHub Desktop.
aws-developer-associate-study-notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
___ _____ ___ _ _ __ _ _ ___ _ _ _ _ | |
/_\ \ / / __| ___ / __|___ _ _| |_(_)/ _(_)___ __| | | \ _____ _____| |___ _ __ ___ _ _ /_\ ______ ___ __(_)__ _| |_ ___ | |
/ _ \ \/\/ /\__ \ |___| | (__/ -_) '_| _| | _| / -_) _` | | |) / -_) V / -_) / _ \ '_ \/ -_) '_| / _ \ (_-<_-</ _ \/ _| / _` | _/ -_) | |
/_/ \_\_/\_/ |___/ \___\___|_| \__|_|_| |_\___\__,_| |___/\___|\_/\___|_\___/ .__/\___|_| /_/ \_\/__/__/\___/\__|_\__,_|\__\___| | |
|_| | |
Notes taken in Jan-2018, from acloud.guru and AWS FAQs. | |
There is a lot of overlap in knowledge areas between Solution Architect Associate, and the Certified Developer Associate. | |
Hence this doc only covers the deltas for the CDA exam. | |
My exam notes for CAA can be found here: https://gist.github.com/dboyd13/2c9ce40e8f3885dffc913ccc3aabeb85 | |
__ __ _ ___ _ _ _ _ ___ _ _ _ | |
\ \ / /__| |__ |_ _|__| |___ _ _| |_(_) |_ _ _ | __|__ __| |___ _ _ __ _| |_(_)___ _ _ | |
\ \/\/ / -_) '_ \ | |/ _` / -_) ' \ _| | _| || | | _/ -_) _` / -_) '_/ _` | _| / _ \ ' \ | |
\_/\_/\___|_.__/ |___\__,_\___|_||_\__|_|\__|\_, | |_|\___\__,_\___|_| \__,_|\__|_\___/_||_| | |
|__/ | |
----------------------- | |
Web Identity Federation | |
----------------------- | |
- Auth with sources such as: Facebook, Linkedin, Amazon, LinkedIn | |
- For exam basically just know that this is possible | |
- Process is: A user authenticates with facebook first. They are then given an ID token by facebook. An API call, AssumeRoleWithWebIdentity, is then used in conjunction with the ID token. A user is then granted temporary security credentials. | |
___ _ _ _ ___ _ _ _ | |
| __| |__ _ __| |_(_)__| _ ) ___ __ _ _ _ __| |_ __ _| | |__ | |
| _|| / _` (_-< _| / _| _ \/ -_) _` | ' \(_-< _/ _` | | / / | |
|___|_\__,_/__/\__|_\__|___/\___\__,_|_||_/__/\__\__,_|_|_\_\ | |
---------------- | |
ElasticBeanstalk | |
---------------- | |
- Basically just upload your code (for ppl that are not very with AWS - or want low management overhead) | |
- You can deploy, monitor and scale an application quickly | |
- Provides developers/end users with the ability to provision application infrastructure in an almost transparent way | |
- It has a highly abstract focus towards infrastructure, focusing on compoents and performance - not configuration and specifications | |
- Attempts to remove, or significantly simplify infrastructure management, allowing applocations to be deployed into infrastructure environments easily. | |
- Exam tips | |
- You can have multiple versions of your applications | |
- Your apps can be split into tiers (Web / App / DB) | |
- You can update your application | |
- you can update your configuration | |
- You CAN SSH/RDP into your instaces | |
- Updates can be 1 instance at a time, a % of instances or an immutable update | |
- You pay for the resources that you use, EB is free | |
- If EB creates your RDS database, then if will delete it when you delete your app. If not then the RDS instance stays. | |
- Language support | |
- Apache Tomcat for Java | |
- Apache HTTP server for PHP | |
- Apache HTTP server for Python | |
- Ngnix / Apache HTTP for Node.js | |
- Passenger / Puma for Ruby | |
- Microsoft IIS 7.5/8.0 and 8.5 for .NET | |
- Java SE | |
- Docker | |
- Go | |
___ _ _ ___ _ _ | |
/ __| |___ _ _ __| | __|__ _ _ _ __ __ _| |_(_)___ _ _ | |
| (__| / _ \ || / _` | _/ _ \ '_| ' \/ _` | _| / _ \ ' \ | |
\___|_\___/\_,_\__,_|_|\___/_| |_|_|_\__,_|\__|_\___/_||_| | |
-------------- | |
CloudFormation | |
-------------- | |
Exam tips | |
- By default, the "automatic rollback on error" feature is ENABLED | |
- You are charged for errors | |
- Cloudformation is free, you only pay for the resources it provisioned | |
- Stacks can wait for applications to be provisioned using the "WaitCondition" | |
- Use Fn:GetAtt to output data (e..g to output the URL of a privisioned website) | |
- Route53 is supported. This includes creating new hosted zones or updating existing ones. Can create A Records / Aliases etc | |
- IAM Role Creation and Assignment is also supported | |
- Anatomy | |
- Parameters - Values to pass to your template at runtime | |
- Mappings - A mapping of keys and associated values you can use to specify parameter values | |
- Conditions - Control whether resources are created or whether certain properties are assigned a value (e.g. Prod/Dev) | |
- Resources (Required) - Resources (EC2, S3 etc) | |
- Outputs - values returned when you view your stack properties | |
___ _____ ___ _ ___ __ ___ | |
/_\ \ / / __| / __| | |_ _| / _|___ _ _ | \ _____ _____ | |
/ _ \ \/\/ /\__ \ | (__| |__ | | | _/ _ \ '_| | |) / -_) V (_-< | |
/_/ \_\_/\_/ |___/ \___|____|___| |_| \___/_| |___/\___|\_//__/ | |
---------------- | |
AWS CLI for Devs | |
---------------- | |
- List your instances: aws ec2 describe-instances | |
- List images: aws ec2 describe-images --owners amazon --filters "Name=platform,Values=windows" "Name=root-device-type,Values=ebs" | |
- Create EC2 instances: aws ec2 run-instances --image-id <AMI_ID> --count <#> --instance-type <instance-type> --key-name <sshkeypairname> --security-group-ids <ID> --subnet-id <ID> | |
- Terminate EC2 instances: aws ec2 terminate-instances --instance-ids <IDs> | |
- Start a STOPed instance: aws ec2 start-instances | |
___ ___ ___ | |
| \ _ _ _ _ __ _ _ __ ___| \| _ ) | |
| |) | || | ' \/ _` | ' \/ _ \ |) | _ \ | |
|___/ \_, |_||_\__,_|_|_|_\___/___/|___/ | |
|__/ | |
-------- | |
DynamoDB | |
-------- | |
----- | |
Intro | |
----- | |
- NoSQL database | |
- Fully managed | |
- Single digit millisecond latency | |
- Document and Key-Value data models | |
- Stored on SSD storage | |
- Spread across 3 geographically distinct data centres | |
- Eventual Consistent Reads (Default) | |
- Consistency is usaully reached within a second (Best Read Performance - app must wait up to 1 second) | |
- Strongly Consistent Reads (SLOWER read performance) | |
- Returns a result that reflects all writes that received a sucessful response response prior to the read. (app cannot wait up to 1 second) | |
- Basics: | |
- Tables | |
- Items (This a row of data in table) | |
- Attributes (Think of a column of data in a table) | |
- Pricing: | |
- Provisioned throughput capacity | |
- Write Throughput $0.0065 per hour for every 10 units | |
- Read Throughput $0.0065 per hours for every 50 units | |
- First 25 GB stored per month is FREE, then $0.25 per GB (per month) there after. | |
------------ | |
Primary Keys | |
------------ | |
- 2 Types of Primary Keys available | |
- Single Attribute (think unique ID) | |
- Partition Key (aka Hash key) composed of one attribute | |
- Composite (think unique ID and a date range) | |
- Partition Key & Sort Key (aka Range key) composed of two attributes | |
- Partition Key | |
- DynamoDB uses the partition keys value as input to an internal hash function. The output from the hash function determine the partition (this is simply the physical location in which the data is stored) | |
- No 2 items in a table can have the same partition key value! | |
- Partition Key and Sort Key | |
- DynamoDB uses the the partition keys value as input into an internal hash function. The output from the has function determines the partition (this is simply th ephysical location in which the data is stored) | |
- However!, 2 items can have the same partition key, but they MUST have a different sort key | |
- All items with the same partition key are stored together, in sorted order by sort key value | |
- Indexes | |
- Local Secondary Index | |
- Has the SAME partition key, DIFFERENT sort key | |
- Can ONLY created when creating a table. Cannot be removed or modified later. | |
- Max 5 LSI's per table - Limit - https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html | |
- Global Secondary Index | |
- Has DIFFERENT partition key and DIFFERENT sort key | |
- Can be crete at table creation OR added later | |
- Max 5 GSI's per table - Limit - https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html | |
- DynamoDB Streams (Store for a max of 24 hrs) | |
- used to capture any kind of modification of the DynamoDB tables | |
- If a new items is added (captures entire item and it's attributes) | |
- If an item is update (captures the before and after) | |
- If a new item is deleted (captures it prior to deletion) | |
- can trigger a lambda function (e.g. replicate table in another region) | |
------------- | |
Scan vs Query | |
------------- | |
- Query | |
- Find items in a table using only primary key attribute values. you must provide a partitiion attribute name and a distinct valye to search for | |
- Can optionally provide a sort key attrivute name and value, and use a comparison operator to refine the search results | |
- By default, a Query returns all the data attributes for items with the specified primary key(s); | |
- However, you can use the ProjectionExpression parameter so that the query only retuns some of the attributes, rather than all | |
- Results will always be sorted by the sort key (if you have one). if the data type of the sort key is a number, the results are returned in numeric order; | |
- otherwise, the results are returned in order of ASCCI char code values. | |
- By default, the sort order is ASCENDING, to reverse order set the ScanIndexForward paramater to false | |
- By default, queries are eventually consistent but chan be changed to be strongly consistent. | |
- Query is MORE efficient than Scan | |
- Scan | |
- Dumps every item in the table | |
- By default, a Scan returns all the data attributes | |
- However, you can use the ProjectionExpression parameter so that the query only retuns some of the attributes, rather than all | |
- For quicker response times, design your tables in a way that can use the: | |
- Query, Get or BatchGetItem APIs | |
- OR - design your application to use Scan in a way that minimizes the impact on your table's request rate. | |
- Exam tips | |
- Query find items in a table using only primary key attribute values. You must provide a partition key attribute name and a distinct valye to search for. | |
- Scan examines EVERY item in the table. By default, a Scan returns all of the data attributes for every item; however you can use the ProjectExpression parameter so that the Scan only returns some of the attributes, rather than all. | |
- Query results are always sorted by the sort key in ascending order. Set ScanIndexForward parameter to false to reverse it | |
- Try use Query operation rather than Scan, as query is more efficient | |
---------------------------------- | |
Provisioned Throughput Calculations | |
---------------------------------- | |
- Unit of Read provisioned throughput | |
- ALL reads are round up in increments of 4 KB | |
- Eventualy Consistent Reads (default) consist of 2 reads per second. | |
- Strongly Consistent Reads consist of 1 read per second | |
- Formula | |
- Size of Read round to nearest 4KB chunk / 4 KB) x # of items = read throughput | |
- Divide by 2 if eventually consistent | |
- Unit of Write provisioned throughput | |
- All writes are 1KB | |
- All writes conists of 1 write per second | |
- HTTP 400 Status Code - ProvisionedThroughputExceededException | |
- You exceeded your maximum allowed provisioned throughput for a table, | |
- OR for one or more global secondary indexes. | |
- Question 1: You have an application that requires to read 10 items of 1 KB per second using eventual consistency. What should you set the read throughput to? | |
- Determine the amount of read units per item we need | |
- 1 KB rounded up to the nearest 4 KB increment = 4 | |
- 4 KB / 4 KB = 1 read unit per item | |
- 1 x 10 read items = 10 | |
- Using eventual consistency we get 10 / 2 = 5 | |
- 5 units of read throughput required | |
- (4 / 4) x 10 = 10, 10 / 2 == 5 | |
- Question 2: You have an application that requires to read 10 items of 6 KB per second using eventual consistency. What should you set the read throughput too? | |
- Determine the amount of read units per item we need | |
- 6KB rounded up to the nearest 4KB increment = 8 KB | |
- 8 KB / 4 KB = 2 read units per item | |
- 2 x 10 read items = 20 | |
- Using eventual consistency we get 20 / 2 = 10 | |
- 10 units of read throughput required | |
- (8 / 4) * 20 = 2, 20 / 2 == 10 | |
- Question 3: You have an application that requires to read 5 items of 10 KB per second using eventual consistency. What whould you set the read throughput too? | |
- Determine the amount of read units per item we need | |
- 10 KB rounded up to the nearest 4KB increment = 12 KB | |
- 12 KB / 4 KB = 3 read units per item | |
- 3 x 5 read items = 15 | |
- Using eventual consistency we get 15 / 2 = 7.5 | |
- 8 units of read throughput required | |
- (12 / 4) * 5 = 15, 15 /2 = 7.5 (round up) | |
- Question 4: You have an application that requires to read 5 items of 10 KB per second using strong consistency. What should you set the read throughput too? | |
- Determine the amount of read units per item we need | |
- 10 KB rounded up to the nearest 4KB incement = 12 KB | |
- 12 KB / 4KB = 3 read units per item | |
- 3 x 5 read items = 15 | |
- Using strong consistency we get 15 / 1 = 15 | |
- 15 units of read throughput required | |
- (12 / 4) * 5 = 15, 15 / 1 = 15 | |
- Question 5: You have an application that requires to write 5 items, with ech item being 10 KB in size per second. What should you set the write throughput too? | |
- As write units are 1KB, we need 10 write units per item | |
- We have 5 items, therefore 10 x 5 items = 50 | |
- 50 units of write throughput required | |
- Question 6: You have an application that requires to write 12 items of 100 KB per item each second. What should you set the write throughput too? | |
- As write units are 1KB, we need 100 write units per item | |
- We have 12 items, therefore 100 x 12 = 1200 | |
- 1200 units of write throughput required | |
----------------------------- | |
Web Identity Auth to DynamoDB | |
----------------------------- | |
- Steps to authenticate: | |
1. User Authenticates with ID provider (OpenID Connect provider such as Facebook/Google) | |
2. They are passed a Token by their ID provider | |
3. Your code calls 'AssumeRoleWithWebIdentity' API, and provides the providers token and specifies the ARN for the IAM Role | |
4. App can now access DynamoDB from between 15 mins to 1 hr (Default is 1 hr) | |
-------------------- | |
Other important bits | |
-------------------- | |
- Conditional Writes | |
- put logic in place as part of the write operation to only update/write if that condition is met. | |
- Example 'If item = $10 then update to $12" | |
- Conditional writes are 'idempotent' - meaning you can send the same conditional write request multiple times, but it will have no further effect on the item after the first rime Dynamo DB erforms the specified update | |
- For example suppose you issue a request to update the price of a book item by 10%, with the expectation that the price is currently $20. | |
- However, before you get a response, a network error occurs and you don't know whether your request was successful or not.... | |
- Becuase a conditional update is an 'idempotent' operation, you can send the same request again, and DynamoDB will update the price only if the current price is still $20. | |
- Atomic Counters | |
- DynamoDB support atomic counters | |
- Where you use UpdateItem operation to increment / decrement the value on an existing attribute, | |
- without interfering with other write requests. All write operations are applied in the order in which they were received | |
- For example: a web app might want to maintain a counter per vistor to the site. In this case, the application would need increment this counter regardless of it's current value. | |
- Atomic counter updates are NOT 'idempotent' - meaning that the counter will increment each time you call UpdateItem | |
- If you suspect that a previous request was unsucessful, your application could retry the UpdateItem operation; | |
- However, this would risk updating the counter twice. | |
- This might be acceptable for a web site counter, because you can tolerate with slightly over or under-counting the vistors | |
- However, in a banking application it would be safer to use a conditional update rather than an atomic counter | |
- Batch Operations | |
- If you application needs to read multiple items, you can use the BatchGetItem API. | |
- A single BatchGetItem request can retrieve up to 1 MB of data, which can contain up to 100 items | |
- Also, a single BatchGetItem request can retrieve items from multiple tables | |
- READ the FAQ! | |
___ ___ _ __ | |
/ __| \| |/ / | |
\__ \ |) | ' < | |
|___/___/|_|\_\ | |
-------- | |
SDK Tips | |
-------- | |
- Available in: | |
- Android, iOS, Javascript | |
- Java | |
- .NET | |
- Node.JS | |
- PHP | |
- Python | |
- Ruby | |
- Go | |
- C++ | |
- Default region is always US-EAST-1, some have default reasons like Java - some do not like Node.JS | |
___ ___ ___ | |
/ __|/ _ \/ __| | |
\__ \ (_) \__ \ | |
|___/\__\_\___/ | |
----------------- | |
SQS Dev exam tips | |
----------------- | |
- SQS Messages can be delivered multiple times and in any order - For standard queue. FIFO queue is available. | |
- Default Visibility Time Out - 30 seconds | |
- Maximum Visibility Time Out - 12 Hrs | |
- Can programmatically give more time ChangeMessageVisiblity | |
- Maximum Long Poll Time Out = 20 seconds | |
- 256 KB max payload | |
- Autoscaling EC2 instances based on SQS queue metrics is available | |
- SQS Fanning Out (kinda like broadcasting a message) | |
- Create an SNS topic first using SNS. Then create and subscribe multiple SQS queues to the SNS topic | |
- Now whenever a message is sent to the SNS topic, the message will be fanned out to the SWS queues | |
- i.e SNS will deliver the message to all the SQS queues that are subscribed to the topic | |
___ _ _ ___ | |
/ __| \| / __| | |
\__ \ .` \__ \ | |
|___/_|\_|___/ | |
--- | |
SNS | |
--- | |
- Instant, push-based delivery (no polling) | |
- Protocols include: | |
- HTTP | |
- HTTPS | |
- Email-JSON | |
- SQS | |
- Application | |
- Messages can be customized for each protocol | |
_ _ _ _ _ _ _ _____ _ | |
/_\ __| |__| (_) |_(_)___ _ _ __ _| | |_ _(_)_ __ ___ | |
/ _ \/ _` / _` | | _| / _ \ ' \/ _` | | | | | | '_ (_-< | |
/_/ \_\__,_\__,_|_|\__|_\___/_||_\__,_|_| |_| |_| .__/__/ | |
|_| | |
--------------- | |
Additional Tips | |
--------------- | |
- S3 HTTP response codes - https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html | |
- S3 Common Request headers - https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonRequestHeaders.html | |
- SQS HTTP response codes - https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/CommonErrors.html | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment