Parameters

Parameters are a way to provide dynamic variables that can vary from deployment to deployment, this way applications and end users can specify input data that will be replaced in the template at runtime.

The use of parameters will promote maintainability and reusability for your stacks. We make use of the Ref intrinsic function to reference the named declaration:

Let's do the same for the EC2 KeyName:

Note the usage of the inline intrinsic function Ref! function on KeyName.

What happens when multi-valued parameters need to be used? Lists are a way to reference 1:M values and managed through indexes. For our example, we want to reference multiple security groups:

This way, CloudFormation will populate a list of the available security groups by name with multiple selection for this case:

Lists in YAML format are declared using the hyphen sign (-). In the UI, end users will be presented with a multi selection list for the existing security groups in this region and account.

We left the AMI selection to the end of this example. AMIs are examples of multi-selection logic because AMIs are dependent of the AWS region, but AMIs also have other complex search attributes like the architecture (32 or 64 bits) and virtualization method, and they are assigned to specific instance types for different workloads.

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

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