AWS::CloudFormation::Interface

AWS::CloudFormation::Interface

This helps how to modify the ordering and presentation of parameters in the AWS CloudFormation console.

By default, parameters display in an alphabetical order by their logical IDs

Image for post
Image for post

The AWS::CloudFormation::Interface metadata key uses two child keys,

  1. ParameterGroups (you could group all EC2-related parameters in one group and all DB-related parameters in another group)
  • Each entry in ParameterGroups is defined as an object with a Label key and Parameters key
Image for post
Image for post

2. ParameterLabels (A label is a friendly name or description that the console displays instead of a parameter’s logical ID.)

The ParameterLabels key takes a list of parameter logical IDs, each of which has a friendly description as a subkey.

This is how define in your template

  • Create two Parameter groups one for database configuration and one for EC2 configuration
  • For Key Pair we are using label that will shown in the console
  • Clone this repo and create a stack
Metadata: 
AWS::CloudFormation::Interface:
ParameterGroups:
-
Label:
default: "DB Configuration"
Parameters:
- DBPort
- DBPwd
-
Label:
default: "Amazon EC2 Configuration"
Parameters:
- InstanceTypeParameter1
- myKeyPair
ParameterLabels:
myKeyPair:
default: "Use the Key Pair"
Parameters:
InstanceTypeParameter1:
Type: String
Default: t2.micro
AllowedValues:
- t2.micro
- m1.small
- m1.large
Description: Enter t2.micro, m1.small, or m1.large. Default is t2.micro.
DBPort:
Default: 3306
Description: TCP/IP port for the database
Type: Number
MinValue: 1150
MaxValue: 65535
DBPwd:
NoEcho: true
Description: The database admin account password
Type: String
MinLength: 1
MaxLength: 41
myKeyPair:
Description: Amazon EC2 Key Pair
Type: "AWS::EC2::KeyPair::KeyName"
Resources:
Ec2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType:
Ref: InstanceTypeParameter1
ImageId: ami-01aab85a5e4a5a0fe
Image for post
Image for post

Devops Automation Enginneer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store