Cantrill - Practical Quiz

NoQARef
1ELB - User login randomlyELB Sticky Session + Store session in DynamoDB
2Config SQS Short/Long PollingQueue’s ReceiveMessageWaitTimeSeconds attribute
ReceiveMessage call’s WaitTimeSeconds param
3DynamoDB TTL1 process using TTL attribute and mark expired
another process delete these expired items
DynamoDB StreamsDynamoDB Stream is a 24h flow of item changes
4Lambda function reuse execution environment between invocationsCache static assets locally in the /tmp directoryLambda Best Practice
Initialize SDK clients and database connections outside of the function handler
5Best practice to apply permissions to an EC2 instanceEC2 Instance Profile
6Serve private content with CloudFront & S3- Require users access private content by using CloudFront signed URL, signed cookies:Serve Private Content
👈️ This is implicit enabled after a signer is added
- Require users access your content by using CloudFront URLs, not directly from origin:
👈️ This is done with OAC (for S3 origin), or custom header (for custom origin)
7Protect API Gateway & LambdaBoth run outside VPC, needs to use WAF
8S3 - Encryption in transitIt’s default
9Process orders in 48 hours (in the origin order) & Cost effective48 hours -> Not Lambda -> Step Function + Lambda
In order -> SQS FIFO
10Using CWAgent to write logs to CloudWatch Logs from an EC2 instance in private subnet- CloudWatch Logs is an public service, which can be access other AWS services, or on-premise servers.
- To send logs to CloudWatch Logs without sending them through the internet,
1. A private connection needs to be established between your VPC and CloudWatch LogsUsing CloudWatch Logs with interface VPC endpoints
2. The EC2 instance have enough permissions to send logs to CW Logs
2a. EC2 instance profile (role) have permissionsGrant permissions that the CloudWatch agent needs to write metrics to CloudWatch
2b. Endpoint allows access (by default, endpoint policy allow all access to it)Default endpoint policy
11API - Gateway - Use the same function for multiple stages?Use stage variable to change the endpoint for each stageAPI Gateway - Stage variable
12How to give custom permissions to millions of users?Use Cognito Federated Users + IAM policy variableIAM Policy for federated users
13RDS Replica endpointsEach RDS Replica has its own endpoint. Except Aurora, RDS doesn’t provide a reader endpoint with load balancing
14Add sign up, sign in featuresCognito User Pool
15DynamoDB RCU/WRU calculation1 RCU = 4KB/s, 1 WRU = 1KB/s
16Where to store CW Agent config?SSM Parameter Store
17Elastic Beanstalk deploy to brand new infrastructure- EB immutable deploymentElastic Beanstalk & Blue-Green deployment
- Manually deploy to a new environment, EB supports swap DNS to the new environment
18API Gateway - Legacy APIs required transformationUse integration HTTP
19Delete all items in a DynamoDB table everyday???? Use DynamoDB TTL
20Route traffic from ELB to Lambda functionsYou can register your Lambda functions as targets of ELB listener
21SQS message size limit256KB. To work with larger files, offload it to S3
22CloudFormation: Share stack vs share templateShare stacks with Stack Reference; Share template with Nested Stack
23Where is CORS applied?CORS is applied to the origin being accessed, not the origin accessing.
24Which services use CloudFormation under the hood?SAM, Elastic Beanstalk
25What is the size limit for data sent to AWS KMS?4KB. To encrypt larger file, use DEK and envelope encryption
26S3 encryption by S3 server, manage key by applicationSSE-C
27???
28Tracing between many AWS servicesX-ray
29Host website on S3- Turn on Static Website Hosting
- Allow public access with bucket policy
30Decouple apps & Serverless scalingUse SQS + Lambda (config function concurrency)
31Give access to CodeCommit repoCodeCommit control access via IAM users: Create HTTPs credential in IAM; or create SSH key & associate to IAM user
32Whenever a new comment added, send an email?DynamoDB Stream + Lambda trigger + SNS
33SQS: Messages process twice?VisibilityTimeout not long enough
34Import APIs to API GatewayImport OpenAPI definitions
35Upload file to S3 - Improve performance?Transfer Acceleration
36Kinesis: Improve performance?Increase number of shards (shard splitting)
37Lambda: Share libraryLambda Layer
38Collect real time dataKinesis Data Streams
39Reuse Lambda function for multi stagesUse stage variable
40Embed Lambda function in CloudFormation templateCode’s ZipFile
41Host static websiteS3 + CloudFront
42Config/Update EC2 instance with CloudFormationcfn-init + cfn-signal & cfn-hup
43Query only a part of data on S3S3 Select
44Attach an EBS volume to EC2 instanceCreate file system; Mount it
45DynamoDB: Primary keyStudent ID
46APIs to request temporary credentials with IAMAssumeRole, AssumeRoleWithSAML, AssumeRoleWithWebIdentity
47API Gateway: Ensure searchString parameter is in the requestMethod Request
48Increase CPU allocation of a Lambda functionIncrease memory allocation
49CloudWatch namespace & metrics
50Run AWS CLI in EC2, what will happened?It won’t run. AWS CLI use other credential first ???
51DynamoDB WCUWrite operation is not strongly/eventually consistent. Only read has consistent problem.
52Send a message to userSNS
53S3 ListAPImax-items, page-size
54DynamoDB: Improve read performanceDAX
55Migrate microservice to AWS, low operation overheadECS Fargate
56DynamoDB eventually readUse less RCU than strong consistent read, may receive outdated data
57Which S3 encryption option can be used with CloudHSM?CSE
58CloudFront stale objectInvalidate
59Failover to an maintenance page on S3Route 53 + Health-check
60S3: Block all access except from CloudFrontOAC, OAI (legacy)
61Improve performance of app (using DynamoDB) without modify codeIncrease RCU
62Application workflow take up to 45 min + Cost effectiveStep Function + Lambda
63ASG: Instances started & terminated rapidlyIncrease cooldown time
64SQS + 5 EC2 instancesIncrease polling time; Use ASG for scaling based on queue length
65Check if a Spot instance is terminatedUse instance metadata service