Template reusability

Software is flexible, meaning that it can be adapted to changes and evolve. For this example, we will use a network-tier template and a compute-tier template by breaking these infrastructure responsibilities to be managed independently.

Analyze the following template ec2-instance.yaml:

This code is brittle, what will happen when using a different subnet or the EC2 key pair is wrong spelled? The code will break. In software engineering, we use the open/closed design principle which means that software entities should be open for extension, but closed for modification. Bringing this concept to this template will require it to be opened in the text editor and modified to update the EC2 key pair, the Subnet ID, and security group ID. Also, AMIs are regional resources meaning that this template is not portable but we can improve on this. CloudFormation works with sensible defaults, for example, we didn't specified an instance type so the stack provisioned an m1.small.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.50.252