Skip to main content

Command Palette

Search for a command to run...

Must know things about ec2 Instances for AWS Solutions Architect Associate (SAA) exam

Published
4 min read
Must know things about ec2 Instances for AWS Solutions Architect Associate (SAA) exam

Billing

      • stopping state

        • on demand instances are billed

        • spot instances are not not billed

      • terminated and stopped states

        • ondemand instances + spot instances not billed
      • reserved instances

        • billed on every state
  • It is not possible to enable or disable hibernation for an instance after it has been launched.

Networking

  • Enhanced networking provides higher bandwidth, higher packet per second (PPS) performance, and consistently lower inter-instance latencies.

  • Cluster Placement Group provides low latency network and high network throughput

  • manage certificates

    • Create an AWS Key Management Service (AWS KMS) customer managed key. Allow the EC2 role to use the KMS key for encryption operations. Store the encrypted data on Amazon S3.

Disaster Recovery

    • Disaster Recovery with EBS (least amount of effort)

      • Use AWS Backup to set up a backup plan for the entire group of EC2 instances. Use the AWS Backup API or the AWS CLI to speed up the restore process for multiple EC2 instances.
      • Disaster Recovery without EBS

        • Create Amazon Machine Images (AMIs) to back up the EC2 instances. Copy the AMIs to a secondary AWS Region. Automate infrastructure deployment in the secondary Region by using AWS CloudFormation.
  • Use the memory optimized instance family for both the application and the database.

Monitoring

  • company’s operations team needs to be notified when RDP or SSH access to an environment has been established.

    • Publish VPC flow logs to Amazon CloudWatch Logs. Create required metric filters. Create an Amazon CloudWatch metric alarm with a notification action for when the alarm is in the ALARM state
  • perform a root cause analysis based on the logs, even if the Auto Scaling group immediately terminated the instance.

    • Add a lifecycle hook to your Auto Scaling group to move instances in the Terminating state to the Terminating:Wait state to delay the termination of unhealthy Amazon EC2 instances.

    • Configure a CloudWatch Events rule for the EC2 Instance-terminate Lifecycle Action Auto Scaling Event with an associated Lambda function. Trigger the CloudWatch agent to push the application logs and then resume the instance termination once all the logs are sent to CloudWatch Logs.

Cost Saving

  • automatically starts and stops the EC2 instances and DB instances outside of business hours.

    • Create an AWS Lambda function that will start and stop the EC2 instances and DB instances. Configure Amazon EventBridge to invoke the Lambda function on a schedule.
  • Use an IAM policy that allows users to create only encrypted Amazon Elastic Block Store (Amazon EBS) volumes. Use AWS. Config and AWS Systems Manager to automate the detection and remediation of unencrypted EBS volumes.

    • no need auto scaling on weekends

      • Use a target tracking scaling policy to scale the Auto Scaling group based on instance CPU utilization.

      • Use scheduled scaling to change the Auto Scaling group minimum, maximum, and desired capacity to zero for weekends. Revert to the default values at the start of the week,

  • auto scaling groups can not span multi region

Performance Optimization

  • application takes a long time to launch and load memory to become fully productive.

    • Launch the EC2 On-Demand Instances with hibernation turned on. Configure EC2 Auto Scaling warm pools during the next testing phase.

      • Hibernation saves the in-memory state of the EC2 instance to persistent storage and shuts the instance down. When the instance is started again, the in-memory state is restored, which launches much faster than launching a new instance. Warm pools pre-initialize EC2 instances and keep them ready to fulfill requests, reducing launch time. The hibernated instances can be added to a warm pool When auto scaling scales out during the next testing phase, it will be able to launch instances from the warm pool rapidly since they are already initialized
  • R5 EC2 ---> memory optimized

    • Modify the CloudFormation templates. Replace the EC2 instances with RS EC2 instances. Deploy the Amazon CloudWatch agent on the EC2 instances to generate custom application latency metrics for future capacity planning.