Showing posts with label EC2. Show all posts
Showing posts with label EC2. Show all posts

AWS EC2 Auto Recovery Using CloudWatch

Today I heard about a feature baked into CloudWatch that enables auto recovery of an EC2 instance if it ever fails status its status check. The really cool thing here is that it relaunches an instance with the exact same configuration; preserving any auto-assigned public IP's and using the current instance volumes.

There are two different types of status checks, System and Instance, that each instance is monitored for and that report as metrics to CloudWatch.

  • System status checks identify AWS infrastructure issues.
  • Instance status checks identify things like startup, networking, memory, file system and kernel issues.

What this option really does is enable automation of instance migration to a new host when and if it ever fails its system status check. This feature only works with/applicable to the "StatusCheckFailed_System" CloudWatch metric.

It looks like this feature requires VPC EBS Backed instances in shared tenancy with a limited set of instance types, that seems to cover the main current gen options. It also looks like it is available in most regions. See: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-recover.html

NOTICE: All thoughts/statements in this article are mine alone and do not represent those of Amazon or Amazon Web services. All referenced AWS services and service names are the property of AWS. Although I have made every effort to ensure that the information in this article was correct at writing, I do not assume and hereby disclaim any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from negligence, accident, or any other cause.

HOW TO: Revert a Snapshot of an Instance In Amazon Web Services (AWS)

I write about this topic because it's one that may not be immediately obvious to those new to AWS and with previous visualization experience.

In AWS there is a much looser tie between various components that make up a server. An EC2 instance is nothing more than a reservation for some allocation of processor power and memory. Persistent block storage (EBS) or ephemeral instance storage is associated with an instance reservation and assigned a device mapping that tells the hypervisor how the volume is related to the instance. A single device either an EBS volume or ephemeral instance storage can be attached as the root (boot) device. The number of other attachable devices depends on your instance type. See the reference link below to AWS documentation for further explanation of these device mappings and these concepts.

A snapshot is related to a volume and only to an instance through the attachment of a volume. Hence a snapshot is not per say a point in time for an instance, rather it is a point in time for a volume. If you want to take a snapshot of an instance, you would in fact need to assess each attached volume and take snapshots of each as needed. If you want to snapshot the instance what you probably want to do is take a snapshot of the root drive.

Snapshots capture each block in a volume that has changed since the last snapshot was taken. Each block in a snapshot of a volume is stored as an S3 object. The more changes and time between snapshots the longer your snapshots will take as more blocks will likely need to be copied and stored as S3 objects. There is no way to revert a volume to a previous state from these snapshots. Instead, a snapshot allows you to create a new volume using the snapshotted blocks giving you a copy of a volume at a specific point in time. You'll need to then replace the attached volume on your instance with this new volume created from the snapshot.