EC2 (Elastic Cloud Compute)

How-to Copy an AMI from One AWS Region to Another

Copy AWS AMI from One Region to AnotherAWS is ideally suited for making the user’s applications tolerant to disaster. One of the options for making the user’s application suitable to DR is to keep a back up of the data / application setup in multiple regions. If the first region is not reachable due to some reason, the user can start the application from the other region. In Dec 2021 AWS introduced the functionality to copy snapshot across regions. In March 2022 AWS announced the functionality to migrate the AMI from one region to another. The present guide demonstrates how to copy an AMI from one region to other.

How to Create, View and Delete an AWS Auto Scaling Configuration

AWS Auto Scaling provides horizontal scaling by automatically adding or removing computer resources for the application hosted on AWS. The user can achieve Auto Scaling in different ways, such as maintaining the number of healthy instances or adding/ removing instances based on demand. The present guide demonstrates how to create, view or delete an Auto Scaling configuration.

How-to Install AWS Command Line (CLI) Tools for Auto Scaling

Scaling is one of the most important factors for Cloud Services. It allows the user to optimize the cost by providing resources only when required. Amazon Cloud Auto Scaling provides horizontal scaling by automatically adding or removing the computer resources for the application hosted on AWS. The changes are on demand based on the triggers configured by the user.

Consider the following scenario: when the user’s web application is hosted on AWS and there is a sudden increase of traffic to that website. If the user fails to scale up based on the need, the application may fail or give a slow response. If the user has configured parameters such that AWS adds more application resources (EC2 Instances) when the traffic increases the application will continue to respond with the same performance as before.

The present guide demonstrates how to install Auto Scaling CLI on a Windows machine.

How to Attach an EBS Volume with an AWS EC2 Windows Instance

The Amazon Elastic Block Store (Amazon EBS) offers persistent storage for the Amazon EC2 instances. Amazon EBS volumes provide a scalable storage service, which persists independently of the instance life. A user can attach an EBS volume to an EC2 instance. It is mandatory that both the volume as well as the instance be in the same availability zone. The user can assign a maximum of 16 EBS volumes to an instance. AWS allows the user to create the EBS volume.

The present guide demonstrates how attach an EBS volume to a Windows instance.

How to Format an AWS EBS Volume Attached to an EC2 Windows Instance

The Amazon Elastic Block Store (Amazon EBS) offers persistent storage for the Amazon EC2 instances. We saw that an EBS volume can be attached to AWS Windows instance for vertical scalability.

The present guide demonstrates how to format an EBS volume attached to a Windows instance.

How to Modify the Instance Initiated Shutdown Behavior

AWS has two types of AMIs: Instance Store backed and EBS backed. The EBS backed instance can be started or stopped using AWS APIs or the console. The user can configure the application by connecting to the instance. In certain cases, the user can shutdown the instance from the OS directly. The present guide demonstrates how to change the instance initiated shutdown behavior. This is applicable to only the EBS backed instance and when the instance is shut down internally.

How to Monitor the EBS Volume with Status Check and Enable Auto Enabled IO

AWS status checks help the user to identify problems that would stop the instance from running an application. The AWS EC2 status check allows the user to monitor the status of system reachability and instance status. The EBS volumes are used for persistent data storage. It is always recommended to store the data to the EBS volume rather than having a transient storage for the persistent storage option. In the rarest of cases, there could be a probability that something could happen to the EBS volume, which could create inconsistency in the volume data. The AWS EBS volume status check helps to detect the impaired volumes. The impaired volume may not be available immediately.

The present guide demonstrates how to check the status of the EBS volume and enable auto enabled IO.

How to Detect and Shutdown an Unused AWS EC2 Instance

Amazon CloudWatch is used to monitor several AWS products. Cloudwatch provides various metrics to monitor the user’s instance, the resources as well as the AWS billing. Cloudwatch can send a notification about a particular event. The user can create alerts to send the notifications. CloudWatch monitors the CPU usage and sends a notification if the usage exceeds the specified threshold. AWS CloudWatch also offers a unique feature to stop or terminate an instance when the CloudWatch alarm is triggered.

The present guide demonstrates how to stop an instance if the EC2 instance is not in use. The alarm will be configured to stop the instance when the CPU usage is less than 5% for more than 2 hours. The below mentioned steps are only for an EBS backed instance. For an instance store backed AMI instance, the user can configure the terminate action only.

How to Monitor Events for AWS EC2 Instances

Considering the current high demand of infrastructure, Amazon Web Services (AWS) upgrade the infrastructure and corresponding EC2 services regularly on a continual basis, with many patches and upgrades being applied to instances transparently. Some updates require a short instance reboot in order to apply the above mentioned updates. AWS EC2 has a functionality called monitor events, which provides visibility into the timing of the planned reboots. With the help of the above mentioned functionality, the user can use the scheduled events to manage reboots on their own before the scheduled update window.

The present guide demonstrates how to view the scheduled event. You can take actions, such as stop / reboot the instance against a planned action. You can also refer the maintenance guide.

How to Subscribe to an AWS EC2 Spot Instance Auto Feed

An AWS spot instance helps to reduce the running cost of the EC2 instance.  The user bids for a spot instance request specifying the maximum price that the user is willing to pay per hour per instance. Once the spot instance request is fulfilled, the instance will continue to run until it is manually terminated or the spot price increases above the maximum bid price. The user is not charged as per the max price; instead the user will be charged at the current spot price in that availability zone. To know the charges for spot instances, Amazon EC2 provides access to a data feed, which details the user’s spot instance usage and pricing every hour.

The present guide demonstrates how to subscribe or delete the spot instances price data feed.

Hitchhiker's Guide to The Cloud

Newvem's eBook for Cloud Operations