General Review Flashcards
What is Cloudtrail?
AWS Lambda is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in AWS Lambda. … If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for AWS Lambda.
Cloudwatch vs CloudTrail
CloudWatch Logs reports on application logs, while CloudTrail Logs provide you specific information on what occurred in your AWS account. CloudWatch Events is a near real time stream of system events describing changes to your AWS resources. CloudTrail focuses more on AWS API calls made in your AWS account.
Cloudwatch Metrics
Start at 1 minute. Use high-resolution to go higher.
1 minute for detailed monitoring.
5 minutes for standard monitoring.
Can be on-premisis.
For application-specific events you need a custom metric.
The minumum for custom is 1 minute.
What are serverless technologies?
Serverless applications don’t require provisioning, maintaining, and administering servers for backend components such as compute, databases, storage, stream processing, message queueing, and more. You also no longer need to worry about ensuring application fault tolerance and availability. Instead, AWS handles all of these capabilities for you. Lamda and @edge Fargate S3 EFS Dynamo Aurora - database will automatically start up, shut down, and scale RDS Proxy API Proxy SNS/SQS/STEP/Kinesis/Athena/Dev Tooling.
What is Step
AWS Step Functions makes it easy to coordinate the components of distributed applications and microservices using visual workflows. Building applications from individual components that each perform a discrete function lets you scale and change applications quickly. Step Functions is a reliable way to coordinate components and step through the functions of your application.
Secrets Manager vs Parameter Store
https://scalesec.com/blog/a-comparison-of-secrets-managers-for-aws/
SQS Delay Queues
0-900 seconds
Postpone delivery of new messages to a queue. For FIFO only, takes place immediately on messages in queue.
Best pracotsce for Large SQS Messages using S3
- Use S3
- Use Extended client library for Java
- SDK for Java
- Specifiy that messages are always stored on S3 or > 256.
- Send message referencing object on S3
- Delete message from S3
- Ge mesage object from S3
Paginations
–page-size
also
–max-items
Kinesis
Client library runs on consumer instances
They track the number of shards on stream
Discover new shards
WIth KCL, number of instances should not exceed shards
You don’t need more than one per shard. Only consider it if CPU utilization is high.
Lamda Limits
Lamda limit is a safetry feature: “Reserved Concurrency” 1,000 per second
429 HTTP Status if rejected - Call AWS Support
Upload package size 50mb max. 250 unzipped.
Lamda and VPC Resources
- Allow function to connection to private subnet
- It needs VPC Configuration
- Private subnet
- Security Group
- Use vpc-config param to add
x-ray
You need both the daemon and the SDK
Install on EC2 instance or on-premisis server or on EC32 within beanstalk
I fusing ECS, install alongside
Annotations add indexed key-value pairs
Dynomo, Lamda, API Gateway
Sampling: 1 request per seconds, 5% or subsequent.
You can use the AWS Elastic Beanstalk console or a configuration file to run the AWS X-Ray daemon on the instances in your environment. X-Ray is an AWS service that gathers data about the requests that your application serves, and uses it to construct a service map that you can use to identify issues with your application and opportunities for optimization.
Beanstalk and Docker
Single Container
Multiple - Use EBS beanstalk to build EBS cluster and deploy multiple containers to each instance
UPload a zip file and beanstalk will do the rest.
Code can be updated from local machine or public S3 bucket. You can also use CodeCommit, but must use the beanstalk CLI.
Cloudwatch vs CloudTrail vs Config
- Cloudwatch monitors performance
- Cloudtrail monitors API calls in the platform
- AWS Config records the state of your environment and can notify of changes.
Assume-Role-With-Web-Identity
- Authenticate with Web Identity Provider
- Application makes the Assume-Role-With-Web-Identity call
- If suuccessfull, STS will return tem creds
SQS
Long poll max timeout: 20 seconds
Max vis timeout: 12 hours
Default vis timout: 30 seconds
256 KB message size
1 minute -14 day retention. Def 4 days.
Beanstalk
.config files in .ebextensions folder
YAML or JSON
API
VPC Flow Log
Logs packets coming thought VPC subnets.
Aggregates packages according to capture window.
Analyze traffic to your VPC and auditing process.
EB vs CLoudFormation
They’re actually pretty different. Elastic Beanstalk is intended to make developers’ lives easier. CloudFormation is intended to make systems engineers’ lives easier.
Elastic Beanstalk is a PaaS-like layer ontop of AWS’s IaaS services which abstracts away the underlying EC2 instances, Elastic Load Balancers, auto scaling groups, etc. This makes it a lot easier for developers, who don’t want to be dealing with all the systems stuff, to get their application quickly deployed on AWS. It’s very similar to other PaaS products such as Heroku, EngineYard, Google App Engine, etc. With Elastic Beanstalk, you don’t need to understand how any of the underlying magic works.
CloudFormation, on the other hand, doesn’t automatically do anything. It’s simply a way to define all the resources needed for deployment in a huge JSON file. So a CloudFormation template might actually create two ElasticBeanstalk environments (production and staging), a couple of ElasticCache clusters, a DyanmoDB table, and then the proper DNS in Route53. I then upload this template to AWS, walk away, and 45 minutes later everything is ready and waiting. Since it’s just a plain-text JSON file, I can stick it in my source control which provides a great way to version my application deployments. It also ensures that I have a repeatable, “known good” configuration that I can quickly deploy in a different region.
Sync Asnc Lamda
Within AWS Lambda, functions invoked synchronously and asynchronously are handled in different ways when they fail, which can cause some unexpected side effects in your program logic. If you are synchronously invoking functions directly, the invoking application is responsible for all retries. If you are using integrations they may have additional retries built in. Functions that are invoked asynchronously don’t rely on the invoking application for retries. In this case, the retries are built in and run automatically. The invocation will be retried twice with delays in-between. If it fails on both retries, the event is discarded. With asynchronous invocations, you are able to set up a Dead Letter Queue which can be used to keep the failed event from being discarded. The Dead Letter Queue allows you to send unprocessed events to an Amazon SQSor SNS queue for you to build logic to deal with.
Dynamo Limits
Data Types
String
The length of a String is constrained by the maximum item size of 400 KB.
Strings are Unicode with UTF-8 binary encoding. Because UTF-8 is a variable width encoding, DynamoDB determines the length of a String using its UTF-8 bytes.
Number
A Number can have up to 38 digits of precision, and can be positive, negative, or zero.
Positive range: 1E-130 to 9.9999999999999999999999999999999999999E+125
Negative range: -9.9999999999999999999999999999999999999E+125 to -1E-130
DynamoDB uses JSON strings to represent Number data in requests and replies. For more information, see DynamoDB Low-Level API.
If number precision is important, you should pass numbers to DynamoDB using strings that you convert from a number type.
Binary
The length of a Binary is constrained by the maximum item size of 400 KB.
Applications that work with Binary attributes must encode the data in base64 format before sending it to DynamoDB. Upon receipt of the data, DynamoDB decodes it into an unsigned byte array and uses that as the length of the attribute.
Items
Item Size
The maximum item size in DynamoDB is 400 KB, which includes both attribute name binary length (UTF-8 length) and attribute value lengths (again binary length). The attribute name counts towards the size limit.