Using parameters

Within the same template, you can use the Ref intrinsic function to specify the parameter value in other parts of the template. The following snippet uses the the previous defined parameter InstanceTypeParameter:

Ec2Instance:  Type: AWS::EC2::Instance  Properties:    InstanceType:      Ref: InstanceTypeParameter    ImageId: ami-3c47a355

There are some AWS-specific parameter types as well. For example, if you mention AWS::EC2::AvailabilityZone::Name, then the value of current AZ such as us-east-1 will be placed in the CloudFormation template. Similarly, there are many more AWS-specific parameters that exist.

Mapping (optional): The mapping section which is also optional, matches a key to a corresponding set of named values. Let's say ...

Get AWS Automation Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.