Automating a Cloud Deployment with Version Control and GitHub Repo

Automating a Stack to Meet Version Control and GitHub Repo Requirements

Prev Question Next Question

Question

Your company needs to automate 3 logical layers of a large cloud deployment.

You want to track this deployment's evolution as it changes over time and carefully control any alterations.

The deployment scripts should be version-controlled and managed in a GitHub repo.

What is a good way to automate a stack to meet these requirements?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - B.

As your infrastructure grows, common patterns can emerge in which you declare the same components in each of your templates.

You can separate out these common components and create dedicated templates for them.

That way, you can mix and match different templates but use nested stacks to create a single, unified stack.

Nested stacks are stacks that create other stacks.

To create nested stacks, use the AWS::CloudFormation::Stackresource in your template to reference other templates.

For more information on nested stacks, please visit the below URL:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html#nested

Note:

The query is, how you can automate a stack over the period of time, when changes are required, without recreating the stack.

The function of Nested Stacks is to reuse Common Template Patterns.

For example, assume that you have a load balancer configuration that you use for most of your stacks.

Instead of copying and pasting the same configurations into your templates, you can create a dedicated template for the load balancer.

Then, you just use the resource to reference that template from within other templates.

Yet another example is if you have a launch configuration with a certain specific configuration and you need to change the instance size only in the production environment and to leave it as it is in the development environment.

AWS also recommends that updates to nested stacks are run from the parent stack.

When you apply template changes to update a top-level stack, AWS CloudFormation updates the top-level stack and initiates an update to its nested stacks.

AWS CloudFormation updates the resources of modified nested stacks, but does not update the resources of unmodified nested stacks.

The best way to automate a stack to meet the given requirements of tracking the deployment's evolution and carefully controlling any alterations while also version-controlling the deployment scripts in a GitHub repo is by using CloudFormation Nested Stack Templates.

CloudFormation is a service offered by AWS that provides a common language for you to describe and provision all the infrastructure resources in your cloud environment. Nested stacks are a feature of CloudFormation that allows you to create stacks that are composed of other stacks, which are called child stacks. Each child stack can represent a logical layer of your cloud deployment.

Using CloudFormation Nested Stack Templates, you can easily create, update, and delete all the resources in your cloud environment in an automated way. This ensures that any changes made to the deployment scripts are tracked, version-controlled, and carefully controlled. Additionally, CloudFormation templates are easily readable and editable, which makes managing the deployment easier.

On the other hand, using OpsWorks Stacks with three layers to model the layering in your stack might not be the best solution because it is more suited to managing applications rather than infrastructure resources. Elastic Beanstalk Linked Applications is also not the best solution because it is designed for deploying web applications and is not meant to manage infrastructure resources.

Using AWS Config to declare a configuration set that AWS should roll out to your cloud might not be the best solution because AWS Config is used for monitoring and recording your AWS resource configurations and compliance checks rather than for automating deployment scripts.

Therefore, the best solution for this scenario is to use CloudFormation Nested Stack Templates to represent the three logical layers of your cloud deployment, version-control the deployment scripts in a GitHub repo, and easily manage any changes made to the deployment scripts.