resource("IpAddress", "AWS::EC2::EIP", InstanceId: ref("Instance") ) output("IpAddress")
Additionally, we’ll also change the
To deploy the changes, use lono cfn deploy.
lono cfn deploy demo
Note: Source Code for this tutorial is available at: tongueroo/lono-cloudformation-examples
The first thing you’ll notice about deploying new changes is that lono prompts you with a preview of the changes. Interestingly, Lono provides three types of previews:
- param diff preview
- code diff preview
- CloudFormation changeset preview
The lono preview diff compares previously used CloudFormation parameters to the ones about to be deployed. This is helpful to see if you changed things like InstanceType.
The lono code diff is what it sounds like: it’s a diff of the currently deployed template vs. the template about to be deployed. The code diff helps confirm that code changes are what you expect.
The last type of lono preview leverages the AWS CloudFormation changeset feature. It tells us how resources will change: created, modified, or deleted.
The previews helps to tell you why CloudFormation changeset has detected a change.
After confirming yes to the changes, lono rolls them out. You’ll see something like this.
Here’s the CloudFormation Console Resources for the deployed stack.
And the stack outputs. The EIP has been added.
For good measure, we’ll also check via the EC2 Console.
In this post, we added an EIP to an EC2 instance. In doing this task, we learn how to update a CloudFormation stack and how lono provides helpful previews of what will change. Lono combines the create and update commands to a unified lono cfn deploy command. Overall there’s a lot more power to lono. This was just a quick introduction to updating a stack. In the next post, we’ll cover how to customize the templates with lono configs.
Prebuilt CloudFormation Templates
You may be interested in BoltOps Pro blueprints. Blueprints are essentially CloudFormation templates packaged up in a convenient and reusable way. The BoltOps Pro subscription gives you access to all the blueprints in the BoltOps Pro GitHub organization. Just configure, deploy, and run.
Also, if there is a blueprint you would like to see in the future. Please feel free to send us your suggestions: Pro Blueprint Suggestion.