AWS OpsWorks Stacks

AWS OpsWorks Stacks provides a simple and flexible way to create and manage stacks and applications.

Here’s how a basic application server stack might look with AWS OpsWorks Stacks. It consists of a group of application servers running behind an Elastic Load Balancing load balancer, with a backend Amazon RDS database server.

Although relatively simple, this stack shows all the key AWS OpsWorks Stacks features.

Stacks

The stack is the core AWS OpsWorks Stacks component. It is basically a container for AWS resources—Amazon EC2 instances, Amazon RDS database instances, and so on—that have a common purpose and should be logically managed together. The stack helps you manage these resources as a group and also defines some default configuration settings, such as the instances’ operating system and AWS region. If you want to isolate some stack components from direct user interaction, you can run the stack in a VPC.

Layers

You define the stack’s constituents by adding one or more layers. A layer represents a set of Amazon EC2 instances that serve a particular purpose, such as serving applications or hosting a database server.

You can customize or extend layers by modifying packages’ default configurations, adding Chef recipes to perform tasks such as installing additional packages, and more.

For all stacks, AWS OpsWorks Stacks includes service layers, which represent the following AWS services.

  • Amazon Relational Database Service
  • Elastic Load Balancing
  • Amazon Elastic Container Service

Layers give you complete control over which packages are installed, how they are configured, how applications are deployed, and more.

Instances

An instance represents a single computing resource, such as an Amazon EC2 instance. It defines the resource’s basic configuration, such as operating system and size. Other configuration settings, such as Elastic IP addresses or Amazon EBS volumes, are defined by the instance’s layers. The layer’s recipes complete the configuration by performing tasks such as installing and configuring packages and deploying apps.

AWS OpsWorks Stacks supports the following instance types, which are characterized by how they are started and stopped.

  • 24/7 instances are started manually and run until you stop them.
  • Time-based instances are run by AWS OpsWorks Stacks on a specified daily and weekly schedule.They allow your stack to automatically adjust the number of instances to accommodate predictable usage patterns.
  • Load-based instances are automatically started and stopped by AWS OpsWorks Stacks, based on specified load metrics, such as CPU utilization.They allow your stack to automatically adjust the number of instances to accommodate variations in incoming traffic. Load-based instances are available only for Linux-based stacks.

Apps

You store applications and related files in a repository, such as an Amazon S3 bucket. Each application is represented by an app, which specifies the application type and contains the information that is needed to deploy the application from the repository to your instances, such as the repository URL and password. When you deploy an app, AWS OpsWorks Stacks triggers a Deploy event, which runs the Deploy recipes on the stack’s instances.

You can deploy apps in the following ways:

  • Automatically—When you start instances, AWS OpsWorks Stacks automatically runs the instance’s Deploy recipes.
  • Manually—If you have a new app or want to update an existing one, you can manually run the online instances’ Deploy recipes.

Security and Permissions

AWS OpsWorks Stacks integrates with AWS Identity and Access Management (IAM) to provide robust ways of controlling how users access AWS OpsWorks Stacks, including the following:

  • How individual users can interact with each stack, such as whether they can create stack resources such as layers and instances, or whether they can use SSH or RDP to connect to a stack’s Amazon EC2 instances.
  • How AWS OpsWorks Stacks can act on your behalf to interact with AWS resources such as Amazon EC2 instances.
  • How apps that run on AWS OpsWorks Stacks instances can access AWS resources such as Amazon S3 buckets.
  • How to manage users’ public SSH keys and RDP passwords and connect to an instance.

Monitoring and Logging

AWS OpsWorks Stacks provides several features to help you monitor your stack and troubleshoot issues with your stack and any recipes. For all stacks:

  • AWS OpsWorks Stacks provides a set of custom CloudWatch metrics for Linux stacks, which are summarized for your convenience on the Monitoring page.AWS OpsWorks Stacks supports the standard CloudWatch metrics for Windows stacks. You can monitor them with the CloudWatch console.
  • CloudTrail logs, which record API calls made by or on behalf of AWS OpsWorks Stacks in your AWS account.
  • An event log, which lists all events in your stack.
  • Chef logs that detail what transpired for each lifecycle event on each instance, such as which recipes were run and which errors occurred.

Linux-based stacks can also include a Ganglia master layer, which you can use to collect and display detailed monitoring data for the instances in your stack.