AWS Cloud Formation Parameters.
Parameters section within CloudFormation template is way to gather inputs from user, which can be used within other sections of entire cloudformation script.
Parameter TypeParameter Type plays a very important, it enable CloudFormation to validate inputs earlier in the stack creation process, thus it is a way cloudformation can validate your input based upon type before even instantiating stack creation.
Here are the valid Parameter types supported by AWS CloudFormation
Type Details String Can be used to validate normal string. Number FAn integer or float List<Number> RAn array of integers or floats CommaDelimitedList HAn array of literal strings that are separated by commas List<AWS::EC2::SecurityGroup::Id> Array of security group IDs AWS::EC2::KeyPair::KeyName An Amazon EC2 key pair name AWS::EC2::SecurityGroup::Id A security group ID AWS::EC2::Subnet::Id subnet ID AWS::EC2::VPC::Id VPC ID List<AWS::EC2::VPC::Id An array of VPC IDs List<AWS::EC2::Subnet::Id> An array of subnet IDs
Type | Details |
---|---|
String | Can be used to validate normal string. |
Number | FAn integer or float |
List<Number> | RAn array of integers or floats |
CommaDelimitedList | HAn array of literal strings that are separated by commas |
List<AWS::EC2::SecurityGroup::Id> | Array of security group IDs |
AWS::EC2::KeyPair::KeyName | An Amazon EC2 key pair name |
AWS::EC2::SecurityGroup::Id | A security group ID |
AWS::EC2::Subnet::Id | subnet ID |
AWS::EC2::VPC::Id | VPC ID |
List<AWS::EC2::VPC::Id | An array of VPC IDs |
List<AWS::EC2::Subnet::Id> | An array of subnet IDs |
Parameter section Example.
Parameters: EnvironmentName: Description: Select the environment. Type: String Default: dev AllowedValues: - dev - prd EC2InstanceType: Type: String Default: t2.micro AllowedValues: - t2.micro - t2.small EC2KeyName: Description: Select your Key name from List. Type: AWS::EC2::KeyPair::KeyName
Parameters:
EnvironmentName:
Description: Select the environment.
Type: String
Default: dev
AllowedValues:
- dev
- prd
EC2InstanceType:
Type: String
Default: t2.micro
AllowedValues:
- t2.micro
- t2.small
EC2KeyName:
Description: Select your Key name from List.
Type: AWS::EC2::KeyPair::KeyName
No comments:
Post a Comment