Posted On: Jan 4, 2023
Amazon CloudFormation now supports AllowedValues and AllowedPattern properties for CommaDelimitedList parameter type. You can use the CommaDelimitedList parameter type to specify multiple string values in a single parameter. For example, you can create three different subnets with their own VPC CIDR blocks, and use CommaDelimitedList to specify three different CIDR blocks. With these language enhancement, you can add validation checks to your CommaDelimitedList, and reduce input errors to your CommaDelimitedList while updating your stacks and/or stack sets.
You can use AllowedValues to pass an array containing the list of values allowed for the parameter, and AllowedPattern to pass regular expressions representing the patterns allowed for String types. You can use these features with CommaDelimitedList to define acceptable inputs, and minimize errors when creating or updating a stack or stack set. For example, you can use AllowedValues to allow alpha numeric values for CommaDelimitedList parameter of VPC CIDR blocks. This will act as guardrails that minimize human errors when updating the VPC CIDR blocks parameter. Additionally, you can use AllowedPattern for specifying valid email address patterns to a CommaDelimitedList parameter. You can use a pattern such as “/[^\s@]+@[^\s@]+\.[^\s@]+/” as valid developer email address that acts as an input to provision EC2 VPC resource type.
This feature is now available in the Amazon Web Services China (Beijing) Region, operated by Sinnet, and the Amazon Web Services China (Ningxia) Region, operated by NWCD.
To learn more about Parameters, refer to the CloudFormation documentation.