Home icon
Exploring Fn::ForEach and Fn::FindInMap enhancements in AWS CloudFormation

Blog



This article explores two new enhancements to AWS CloudFormation's language extensions: Fn::FindInMap enhancements and the new Fn::ForEach looping function.

  • Fn::FindInMap now supports optional default values for missing mapping keys
  • Fn::FindInMap parameters can use additional intrinsic functions like Fn::Split and Fn::Select
  • Fn::ForEach enables native looping to create multiple similar resources without repetition
  • Fn::ForEach syntax requires a logical ID, variable name, collection, and template section
  • Loops can be nested and used in Resources, Outputs, and other template sections
  • Requires AWS::LanguageExtensions transform declaration in CloudFormation templates
  • Simplifies template maintenance by reducing code duplication for repetitive configurations

These language extensions enable more concise, maintainable CloudFormation templates through dynamic value lookups and native looping capabilities.



Go to article

The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.

Related articles

The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.