AWS Cloud Operations Blog
Migrate your AWS OpsWorks Stacks to AWS Systems Manager
AWS OpsWorks Stacks is a managed configuration management service which helps customers deploy and manage Chef based applications on Amazon Elastic Compute Cloud (Amazon EC2). The service, which was launched in 2013, predates several popular AWS offerings, such as AWS Systems Manager. Some customers desire a deeper level of control and flexibility than possible using OpsWorks Stacks. For example, customers often want to use newer AWS offerings, such as Amazon EC2 Auto Scaling Groups, or take advantage of new operating systems, EC2 instance types, Amazon Elastic Block Store (Amazon EBS) volume types that are not supported by the service.
Migrating from OpsWorks Stacks to Systems Manager makes this possible by utilizing AWS CloudFormation to configure AWS supported services in a way that achieves similar capabilities provided by OpsWorks Stacks. Furthermore, customers can take advantage of CloudFormation to enable greater levels of customization.
Today, AWS is releasing migration tooling that helps customers migrate applications from OpsWorks Stacks to Systems Manager using CloudFormation. This post walks you through an example migration.
Migrating OpsWorks Stacks to Systems Manager
This post includes a migration script link which helps you migrate from OpsWorks Stacks to Systems Manager. The script takes in a source application stack or layer as input and generates an opinionated CloudFormation template. You can then provision or customize it to create a functional replacement. The script works by reading existing OpsWorks entity information and generating a CloudFormation template that achieves similar functions using native AWS capabilities such as Systems Manager, Auto Scaling Groups and more. The migration script will not affect the operation of your existing OpsWorks stack and layer since it creates a parallel application in Application Manager.
Using the migration involves the following steps:
- Download the script files and unzip the package.
- Migrate your OpsWorks Stack to Systems Manager.
- Validate the migration.
Prerequisites
For this walkthrough, you should have the following prerequisites setup in your local machine:
- Python
- Git
- AWS CLI
- PowerShell (for Microsoft Windows)
Download the script files and unzip the package
In this step, you will download the zip file that contains the migration script and all the relevant files.
Detailed steps for multiple operating systems can be found in the documentation.
- Download the zip file using the below command.
- If your local machine is Linux, then install the unzip utility. Skip this step for Windows machine.
- Unzip the file using the appropriate command for your operating system.
For Linux:
For Windows, run the below command in PowerShell:
Migrate OpsWorks Layer to Systems Manager
This step runs the migration script and creates an application in Applications Manager.
- Start the pipenv shell using the below commands from Linux terminal or Windows PowerShell.
- Migrate a layer from your OpsWorks stack using the below command. For parameters support, please refer to the README.md file which is part of the package downloaded above.
Validate the migration
Take the following steps to validate the migration:
- The CloudFormation stack that the script deploys includes an Auto Scaling group. The auto scaling group will initially have zero running instances. Before increasing the number of running instances, you can review the resources created by the stack.
- Next, you can change the Auto Scaling group configuration and set the Desired, Minimum and Maximum values. This will spin up an EC2 instance using the Launch Template generated by the migration script.
- You can use this instance to validate whether the migration was successful. We recommend confirming health checks and connectivity via the Application Load Balancer as well as reviewing the Chef Logs in Amazon S3.
- You can monitor and run operations in your instances using a new Instances tab on the Application Manager page. For more information about working with the Instances tab, see Working with your application instances.
- To customize the migration, you can find information on the parameters accepted by the script here.
This release adds a new Instances tab in the Application Manager console that you can view to see a summary of your running instances.
Select the Instances tab in the Application Manager console for a summary of your running instances.
Choose a specific instance to open the details panel for that instance. From the details panel you can select the Execution History of the associated AWS Systems Manager Run Command commands performed for that instance and debug a failed execution by choosing the Execution ID.
Cleaning up
To avoid incurring future charges, delete the resources as described in README.md file, which is part of the package downloaded above.
AWS OpsWorks features mapped to AWS services post-migration
When you use Systems Manager to manage your applications, the underlying resources are no longer proprietary to OpsWorks. The table below shows how OpsWorks features have been mapped to AWS services.
Feature | AWS OpsWorks | AWS Systems Manager |
Chef Runs | Managed by AWS OpsWorks | AWS Systems Manager Run Command: AWS-ApplyChefRecipes Command Document |
Chef Parameters | Managed by AWS OpsWorks | SSM Parameter Store |
Amazon EC2 Instance and EBS configurations | Managed by AWS OpsWorks | EC2 Launch Template |
Auto Scaling | Managed by AWS OpsWorks | Auto Scaling Groups |
EC2 Instance Life Cycle | Managed by AWS OpsWorks | Auto Scaling Groups Life Cycle Events |
EC2 Instance Termination Protection | Managed by AWS OpsWorks | Auto Scaling Groups Custom Termination Protection |
Load Balancing | Classic Load Balancers | Classic Load Balancers or Application Load Balancers |
Infrastructure Definition and Provisioning | Managed by AWS OpsWorks | AWS CloudFormation |
Chef Client Logs | Managed by AWS OpsWorks | Amazon S3, AWS CloudWatch Logs |
Conclusion
In this blog, we have outlined a method for migrating your existing OpsWorks stack to Systems Manager by using the provided migration script. By migrating, you will provision your OpsWorks resources using AWS services such as Auto Scaling Groups, CloudFormation stacks, and then manage your resources using the Application Manager console and API’s. After migration, you can benefit from Application Manager’s capabilities such as tracking and remediating compliance issues, optimizing EC2 costs, viewing alarms and defining notification actions. For more information see the following resources:
- Migrating to Systems Manager: Access documentation and resources related to the migration script referenced in this blog post.
- AWS Systems Manager Application Manager Instances page: Review the documentation around the new Instances tab in Application Manager.
- Migration Script Limitations: Look at the limitations for the provided migration script.
About the authors: