Tag Archives: architect

AWS Solutions Arch – Compute Services – Lifecycle Hooks

Lifecycle Hooks

Overview

You can add a lifecycle hook to your Auto Scaling group so that you can perform custom actions when instances launch or terminate. For example, while your newly launched instance is paused, you could install or configure software on it.

Each Auto Scaling group can have multiple lifecycle hooks. However, there is a limit on the number of hooks per Auto Scaling group.

How Lifecycle Hooks Work

When Auto Scaling responds to a scale-out event, it launches one or more instances. These instances start in the Pending state. If you added an autoscaling:EC2_INSTANCE_LAUNCHING lifecycle hook to your Auto Scaling group, the instances move from the Pending state to the Pending:Wait state. After you complete the lifecycle action, the instances enter the Pending:Proceed state. When the instances is fully configured, they are attached to the Auto Scaling group and they enter the InService state.

When Auto Scaling responds to a scale-in event, it terminates one or more instances. These instances are detached from the Auto Scaling group and enter the Terminating state. If you added an autoscaling:EC2_INSTANCE_TERMINATING lifecycle hook to your Auto Scaling group, the instances move from the Terminating state to the Terminating:Wait state. After you complete the lifecycle action, the instances enter the Terminating:Proceed state. When the instances are fully terminated, they enter the Terminatedstate.

You can perform a custom action using one or more of the following options:

  • Define a CloudWatch Events target to invoke a Lambda function when a lifecycle action occurs. The Lambda function is invoked when Auto Scaling submits an event for a lifecycle action to CloudWatch Events. The event contains information about the instance that is launching or terminating and a token that you can use to control the lifecycle action.
  • Define a notification target for the lifecycle hook. Auto Scaling sends a message to the notification target. The message contains information about the instance that is launching or terminating, and a token that you can use to control the lifecycle action.
  • Create a script that runs on the instance as the instance starts. The script can control the lifecycle action using the ID of the instance on which it runs.

By default, the instance remains in a wait state for one hour, and then Auto Scaling continues the launch or terminate process (Pending:Proceed or Terminating:Proceed). If you need more time, you can restart the timeout period by recording a heartbeat. If you finish before the timeout period ends, you can complete the lifecycle action, which continues the launch or termination process.

Configuration

You can create lifecycle hooks using the put-lifecycle-hook command. For more information on this command – click here.

For more information on Compute services in AWS – see my course at CBT Nuggets.

For a list of course services – see this post.

Storage Gateway in AWS – The Basics

Storage Gateway

Overview

The storage gateway of AWS provides a simple way to integrate your on-premises storage with your AWS S3. It does this through the installation of a VM appliance in your VMware or Hyper-V implementation. You could also install it on to an EC2 instance in your Virtual Private Cloud (VPC) infrastructure for a different modality.

Types of Storage Gateways

There are four total types of Storage Gateway (note that Volume Gateway consists of two variations):

  • File gateway – this uses NFS and is for your flat files (PDFs, JPGs, etc)
  • Volume gateway – this actually consists of stored volumes and cached volumes – this is for block storage using iSCSI
  • Tape gateway – to create virtual tape libraries

While the volume gateway options both provide block storage (using iSCSI) and would be great for things like virtual hard disks and databases, note that the stored volume approach duplicates your data to the cloud while the cached volume approach only keeps cached copies of frequently accessed files in your on-premises location.

Common Use Cases

Customers commonly use Storage Gateway services for use cases such as:

  • Hybrid cloud workloads – big data, cloud bursting or cloud data migration architectures may need local capacity and performance with a connection to a central storage repository in the cloud. Storage Gateway streamlines moving data between your organization and AWS to manage workloads in the cloud.
  • Backup, archive, and disaster recovery – Storage Gateway is a drop-in replacement for tape and tape automation, and integrates with industry backup software packages. Storage Gateway can take snapshots of your local volumes which can restored as Amazon EBS volumes in the event of a local site disaster.
  • Tiered Storage – some customers design storage architectures that preserve or extend high performance on-premises investments by adding a lower cost, on-demand cloud tier. This helps with archival or cost-reduction projects.

Want to learn more – this is from my latest CBT Nuggets course on AWS. This course is in development as I post this.
Pearson Education (InformIT)