Notes 2 Flashcards
CloudWatch logs metrics from EC2 etc for memory usage. True or false?
False. It does not log memory usage. It logs CPU utilisation, Network in/out, Disk read/write bytes etc. You will need to create a custom metric to get memory usage.
CloudWatch metrics
“GetMetricData” - retrieve data
“PutMetricData” - published metric data points.
“GetMetricStatistics” - get statistics for specific metric.
“PutMetricAlarm” - creates or updates an alarm and associates it with a specified metric
What are CloudWatch Events?
Amazon CloudWatch Events delivers a near real-time stream of system events that describe changes in Amazon Web Services (AWS) resources. Using simple rules that you can quickly set up, you can match events and route them to one or more target functions or streams. CloudWatch Events becomes aware of operational changes as they occur. CloudWatch Events responds to these operational changes and takes corrective action as necessary, by sending messages to respond to the environment, activating functions, making changes, and capturing state information.
CloudWatch log storage
CloudWatch logs are stored indefinitely, however alarm history is only for 14 days.
AWS X-ray “metadata” and “annotations”
X-ray metadata is user added, key/value pairs, not indexed and not used for searching/filtering
X-ray annotations are added by the system, which are both indexed and can be searched/filtered
CloudWatch Dimensions
A dimension in CloudWatch is a name/value pair that is part of the identity of a metric. You can assign up to 10 dimensions to a metric.
Every metric has specific characteristics that describe it, and you can think of dimensions as categories for those characteristics.
What does the “unified CloudWatch agent” do?
The “unified CloudWatch agent” enables you to do the following:
- Collect internal system-level metrics from Amazon EC2 instances across operating systems. The metrics can include in-guest metrics, in addition to the metrics for EC2 instances. The additional metrics that can be collected are listed in Metrics collected by the CloudWatch agent.
- Collect system-level metrics from on-premises servers. These can include servers in a hybrid environment as well as servers not managed by AWS.
- Retrieve custom metrics from your applications or services using the StatsD and collectd protocols. StatsD is supported on both Linux servers and servers running Windows Server. collectd is supported only on Linux servers.
- Collect logs from Amazon EC2 instances and on-premises servers, running either Linux or Windows Server.
Where do CloudTrail trail’s get stored?
CloudTrail trails get stored in S3 indefinitely.
Using AWS X-ray on Beanstalk/EKS/ECS/Fargate
To use AWS X-ray on Beanstalk you set in the console or use “.ebextensions/xray-daemon.config”
On EKS/ECS/Fargate create a Docker image that runs the daemon or use the official X-Ray docker image.
CloudWatch vs CloudTrail
CloudWatch is used to keep track of performance (CPU usage etc)
CloudTrail is used to keep track of API calls from systems for use of governance (see what/who make changes in a system)
How can you create and control the encryption keys used to encrypt your data using “envelope encryption”
Encrypt pain text data with the data key, and then encrypt the data key with with a top-level encrypted master key.
Symmetric vs asymmetric keys in AWS KMS
Symmetric encryption uses a single key that needs to be shared among the people who need to receive the message.
Asymmetric encryption uses a pair of public key and a private key to encrypt and decrypt messages when communicating.
Symmetric encryption is an old technique while asymmetric encryption is relatively new.
How can you allow/cater for traffic spikes in Lambda function calls?
As traffic increases, Lambda increases the number of concurrent executions of your functions. If your Lambda function is getting throttled (lots of calls), then you can increase the “concurrency execution limit” to enable more traffic to hit them Lambda functions.
What can X-Ray use to read the IP address from a request sent by another service (e.g. EC2)?
“X-Forwarded-For”
If a load balancer or other intermediary forwards a request to your application, X-Ray takes the client IP from the “X-Forwarded-For” header in the request instead of from the source IP in the IP packet. The client IP that is recorded for a forwarded request can be forged, so it should not be trusted.
An IAM role has been assigned to S3. Given that the developers mostly interact with S3 via APIs, which API should the developers call to use the IAM role?
AWS STS “AssumeRole”
“AssumeRole” - returns a set of temporary security credentials that you can use to access AWS resources that you might not normally have access to. These temporary credentials consist of an access key ID, a secret access key, and a security token. Typically, you use AssumeRole within your account or for cross-account access.
“AssumeRoleWithWebIdentity” - this returns a set of temporary security credentials for federated users who are authenticated through public identity providers such as Amazon, Facebook, Google, or OpenID
“AssumeRoleWithSAML” - returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response
“GetSessionToken” - this is primarily used to return a set of temporary credentials for an AWS account or IAM user only
What is the easiest way to deploy a Lambda function using CloudFormation?
Include your function source inline in the “ZipFile” parameter of the “AWS::Lambda::Function” resource in the CloudFormation template.
Note, you can upload the ZIP file to S3 and reference it, but this is not the easiest method.
What filename does Elastic Beanstalk use to configure the environment name, solution stack, and environment links?
env.yaml
What file is primarily used to define periodic tasks that add jobs to your worker environment’s queue automatically at a regular interval? E.g. in Elastic Beanstalk.
cron.yaml
What are VPC flow logs used for?
VPC (Virtual Private Cloud) logs capture information about the IP traffic going to and from network interfaces in your VPC.
What is the safest way for an application running on EC2 to upload data to S3?
Use an IAM role to grant the application the necessary permission to upload to S3.
What is the correct way to deploy the new version to Elastic Beanstalk via the CLI?
Package your application into a zip file and deploy using the “eb deploy” command.
How can you track the number of visitors to a website which has DynamoDB?
Use “atomic counters” to increment the counter item in the DynamoDB table for every new visitor.
What can the “Kinesis Adapter” be used for?
The Kinesis Adapter is the recommended way to consume streams from DynamoDB for real-time processing.