AWS Developer Notes
AWS Developer Notes
EBS
EBS Multi Attach – ability to attach the same EBS volume to multiple EC2 instances in the same
AZ
Each instance has full read & write permissions to the high-performance volume
Use case:
When you are trying to achieve higher application availability in clustered Linux applications (ex:
Teradata)
When applications must manage concurrent write operations
Up to 16 EC2 Instances at a time
Must use a file system that’s cluster-aware (not XFS, EXT4, etc…)
Support by protocol
Application Load Balancer - HTTP and HTTPS
Network Load Balancer - TCP, UDP, TLS, when you need millions of requests handled - high
performance.
Gateway Load Balancer - analyzing network traffic-for security,
Network Load Balancer (NLB)
NLB - one static IP per AZ. When exam asks you if your application should only be accessed from
1,2 or 3 IPs, then NLB is solution (question from exam)
if we see GENEVE protocol on port 6081 on exam - it's gateway load balancer,
Combines functions of Transparent Network Gateway - single entry/exit for all traffic and Load
Balancer - distributes traffic to virtual appliances.
Example: Firewalls, Intrusion Detection and Prevention Systems, Deep Packet Inspection
Systems, payload manipulation.
Application load Balancer - Cross-Zone is enabled by default and there is no addtl charges.
Network Load Balancer and Gateway Load Balancer are disabled by default.
Server Name Indication - multiple SSL certificates onto one web server to serve multiple
websites
Aster scaling activity happens, cooldown period proceeds.Default cooldown period - 300
seconds.
RDS
RDS is a managed service:
• Automated provisioning, OS patching
• Continuous backups and restore to specific timestamp (Point in Time Restore)!
• Monitoring dashboards
• Read replicas for improved read performance
• Multi AZ setup for DR (Disaster Recovery)
• Maintenance windows for upgrades
• Scaling capability (vertical and horizontal)
• Storage backed by EBS (gp2 or io1)
• BUT you can’t SSH into your instances
RDS Multi AZ
Sync Replication
One DNS Name – no need to update connection strings.
Increase availability
Failover in case of loss of AZ, loss of network.
Good for DR
Aurora
Features
Automatic fail-over
• Backup and Recovery
• Isolation and security
• Industry compliance
• Push-button scaling
• Automated Patching with Zero Downtime
• Advanced Monitoring
• Routine Maintenance
• Backtrack: restore data at any point of time without using backups
RDS Proxy
Use RDS Proxy to improve database efficiency by reducing the stress on database resources and
minimize open connections (important for exam)
RDS proxy handles failover.
Allows apps to pool and share DB connections established with the database.
Supports both RDS and Aurora.
No code changes needed.
Never publicly accessible
Enforce IAM Authentication for DB, and securely store credentials in AWS Secrets Manager
ElastiCache
REDIS
Multi AZ with Auto-Failover
Read Replicas to scale reads and have high availability
Backup and restore features
Supports Sets and Sorted Sets – keywords for the exam
Memcached
Multi node for partitioning of data (sharding)
No high availability
Non peristant
No back up and restore
Multi threaded architecture
REDIS – high availability , MEMCACHED – pure cache.
CONS:
In case of cache miss, read penalty is that 3 calls have to be made
It's possible to have stale data
CONS
Data missing until data is written.
Cache churn – a lot of data will never be read.
So combine with lazy loading – try first write through, if data is not found, do lazy loading.
Cache evictions and time to live
3 ways to evict cache:
Delete item explicitly in the cache
Item is evicted because the memory is full and it’s not recently use
Set TTL
Route 53
Routing policies
Simple
Route traffic to a single resource.
It’s possible to specify multiple values for the same record. For example, you can add multiple A
records for the same domain. In that case, when queried, random one will be chosen by the
client.
When Alias is enabled, you can only have one aws resource
Can’t be associated with health checks.
Weighted
Control the percentage of the requests that go to each specific resource
Can be associated with health checks.
Use case: Load balancing between multiple regions, testing new application versions.
If you want to stop sending traffic to resource, assign it weight of 0. If all resources have weight
of 0, traffic will be returned equally.
Latency Based
Redirect to the resource that has the least latency close to us.
Super helpful when latency is priority.
Latency is based on traffic between users and regions.
Can be associated with Health Checks
Failover
Failover can be primary or secondary. Primary is the one where traffic goes to when healthy.
Secondary is for the traffic failover when primary becomes unhealthy.
Geolocation
Routing based on user location.
You should have default location in case there is no match on location
Use cases: website localization, restrict content distribution, load balancing, …
Can be associated with Health Checks
Geoproximity
Bias is used to manipulate geoproximity.
Multivalue
Not substitution for ELB.
ELB is client side routing.
Geoproximity is really helpful when you need to shift traffic from one region to another, by
increasing the bias - IMPORTANT FOR THE EXAM
IP-based Routing
Routing is based on clients’ IP addresses
You provide a list of CIDRs for your clients and the corresponding endpoints/locations (user-IP-
to-endpoint mappings)
Use cases: Optimize performance, reduce network costs…
Example: route end users from a particular ISP to a specific endpoint
Health Checks
Monitor an endpoint: 15 global healthcheckers, automated, supported protocols HTTP, HTTPS,
TCP, if > 18% health checkers report healthy, Route 53 considers it healthy. Health Check only
passes when response is with 2xx and 3xx status codes.
Health checks that monitor other health checks (calculated health checks): combines results of
multiple health checks into a single one.
Health checks that monitor CW Alarms (full control): You can create a CloudWatch Metric and
associate a CloudWatch Alarm, then create a Health Check that checks the alarm itself
To visually represent traffic flow and maintain complex decision trees – use traffic flow diagram.
VPC
Internet gateway connects VPC to internet. Public subnets have route to the internet gateway.
NAT Gateways and instances allow instances in your private subnets to access the internet while
remaining private.
Security Groups
Firewall that controls traffic to and from an ENI/EC2 instance
Can have Only ALLOW Rules
VPC Flow Logs data can go to S3, CloudWatch Logs and Kinsesis Data Firehose.
VPC Endpoints
Any time time exam is asking you to privately connect to an AWS Service, VPC Endpoint is the
way.
S3
Security
User-Based
IAM Policies – which API calls should be allowed for a specific user from IAM
Resource-Based
Bucket Policies – bucket wide rules from the S3 console - allows cross account
Object Access Control List (ACL) – finer grain (can be disabled)
Bucket Access Control List (ACL) – less common (can be disabled)
Encryption: encrypt objects in Amazon S3 using encryption keys
If on s3 webstie hosting you get 403 Forbidden error, make sure the bucket policy allows public
read.
Versioning
Enabled on bucket level.
Replication
Cross-Region Replication and Same-Region Replication
Must enable Versioning for it to work
Copying is asynchronous
Use cases:
• CRR – compliance, lower latency access, replication across
accounts
• SRR – log aggregation, live replication between production and test
Accounts
S3 Batch Replication – replicates existing objects and objects that failed replication.
If I permanently delete object in the source bucket it will not be deleted in the destination
(replicated) bucket
S3 Storage Classes
Amazon S3 Standard - General Purpose
Used for frequently accessed data. Low latency and high throughput.
Use Cases: Big data analytics, mobile and gaming applications, content distribution…
Transitioning
You can transition between storage classes. For infrequently accessed object, move them to
Standard IA. For archive, move to Glacier, or Glacier Deep Archive.
Transition Action – configure object to transition from one storage class to another
Expiration action – configure object to expire (be deleted) after certain time. Can be used to
delete old version of file or to delete incomplete multi-part uploads.
S3 notifications can be sent to SQS, SNS and Lambda and Event Bridge Notification for more
services.
S3 Performance
Multi-Part upload
Recommended for files greater than 100 MB, must be used for files greater than 5 GB. Can help
parallelize uploads
S3 Transfer Acceleration
Increase transfer speed by transferring file to aws edge location which will forward data to s3
bucket. Compatible with multi-part.
S3 Byte-Range Fetches
Parallelizing gets to speed up downloads by requesting specific byte ranges.
Important for the exam is to know these performance options for speeding up download and
upload of the files
S3 Object Encryption
IMPORTANT LIMITATION
Client-Side Encryption
Client must encrypt data themselves before sending to s3. Also decrypt when receiving file from
s3.
AWS EC2 instance can learn about themselves without using IAM Role for that purpose.
IMDSv1 vs IMDSv2
V1 is accessing link directly
V2 needs to get the session token of limited validity and use it to make a call
AWS SDK
EXAM QUESTION
Any time you get ThrottlingException because we did too many API calls - use exponential
backoff.
Which kind of errors you should retry on an Exponential Backoff?
When you receive server error that has 5xx server errors.
You SHOULD NOT IMPLEMENT RETRY ON 4XX CLIENT ERRORS.
Exam question!
Look for order of credentials chain priority at the beginning of video.
1. Command line options – --region, --output, and --profile
2. Environment variables – AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, and
AWS_SESSION_TOKEN
3. CLI credentials file –aws configure
~/.aws/credentials on Linux / Mac & C:\Users\user\.aws\credentials on Windows
4. CLI configuration file – aws configure
~/.aws/config on Linux / macOS & C:\Users\USERNAME\.aws\config on Windows
5. Container credentials – for ECS tasks
6. Instance profile credentials – for EC2 Instance Profiles
When you have API request, you need to sign it. and you sign it with SigV4.