In this video, you’ll see how to set AWS Elastic Disaster Recovery launch templates at scale.
With this solution, you can set launch templates automatically rather than manually,
perform AWS Elastic Disaster Recovery Service (DRS) API calls through code,
and observe a best practice of asset management.
We’ll begin in the AWS Elastic Disaster Recovery console,
where we currently have six source servers, each with a corresponding launch template.
Let’s drill down into one of the servers and review its launch settings.
Launch templates cannot be edited in a batch using the native DRS tooling,
so by default each launch template needs to be set manually.
Let’s return to our server list.
To automate the process of setting launch templates for source machines,
we can use Lambda functions to edit all launch templates that have been tagged
with a matching key in the Amazon Elastic Disaster Recovery console.
Let’s take a look at one of these servers’ tags.
This is a database server and it’s tagged as “DB.” So, using the Lambda functions,
we can create one launch template for all servers tagged as “DB.”
The Lambda functions are fully deployed as code in the AWS sample repository on GitHub.
This package contains full instructions for cloning the
repository and setting up all of its components.
Let’s view the solution architecture.
The solution consists of the AWS Elastic Disaster Recovery console,
an Amazon Simple Storage Service (Amazon S3) bucket for template storage,
and two Lambda functions.
We’ll look at these functions again later on.
Let’s return to the Amazon Elastic Disaster Recovery console.
Let’s view the tag for another source server.
This server is tagged as “App.”
For the purposes of this example, we have already created launch templates
for the App tag and the DB tags.
Let’s view the App launch template.
These are all the fields that can be included in a launch template.
Most of these fields are currently set to “null,” but we can modify them as needed.
Notice that the instance type is set to “t3.small.”
Next, let’s view the DB launch template.
The instance type in this template is set to “t3.large.”
Let’s upload both templates to the Amazon S3 bucket we’ve already set up for our solution.
Now that we’ve uploaded the templates, let’s return to the
architecture overview in GitHub and review how our solution responds to the upload.
When we add JSON launch templates to the bucket, the first Lambda function,
“set-drs-templates,” automatically updates the DRS servers that are
tagged with the prefix of the uploaded JSON template files.
Let’s go back to the Amazon Elastic Disaster Recovery console to confirm
that this occurred when we uploaded our templates.
This is our server tagged as “App.” Let’s review its launch settings.
Notice that the instance type is set to “t3.small” in accordance with the App template we uploaded.
Let’s check the DB server.
This server has inherited the “t3.large” instance type from the DB launch template.
Let’s go back to the server list and try adding a new server to one of these tag groups.
We’ll remove this server’s existing tags, and then tag it as an “App” server.
Now that we’ve added the tag, let’s take a look
at the Lambda function that will set the server’s launch template.
This Lambda function, “schedule-drs-templates,”
periodically looks for any new DRS servers that
are tagged and then pulls the corresponding launch template.
For our purposes, we’ll trigger the function manually by running a test.
Next, let’s verify that the server we tagged as “App” inherited our App launch template.
As expected, the server’s instance type is now “t3.small,” in accordance with our App template.
If we had large numbers of servers with a matching tag,
we could automatically set launch templates for all of them at once using this solution.
You’ve just seen how to set AWS Elastic Disaster Recovery launch templates at scale.
You can learn more about this topic in the description and links for this video.
Thanks for watching. Now it’s your turn to try.