FindInMap
The find_in_map
method is the CloudFormation Fn::FindInMap equivalent.
Example Snippet
mapping("AmiMap",
"us-east-1": { Ami: "ami-0de53d8956e8dcf80" },
"us-west-2": { Ami: "ami-061392db613a6357b" }
)
resource("Instance", "AWS::EC2::Instance",
InstanceType: ref("InstanceType"),
ImageId: find_in_map("AmiMap", ref("AWS::Region"), "Ami"),
)
Example Output
Mappings:
AmiMap:
us-east-1:
Ami: ami-0de53d8956e8dcf80
us-west-2:
Ami: ami-061392db613a6357b
Resources:
Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType:
Ref: InstanceType
ImageId:
Fn::FindInMap:
- AmiMap
- Ref: AWS::Region
- Ami
mapping method
The find_in_map
method is used in conjuction with the mapping method.
Back to Intrinsic Functions List.
Pro tip: Use the <- and -> arrow keys to move back and forward.
Edit this page
See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!
- Suggest an edit to this page (here's the contributing guide).
- Open an issue about this page to report a problem.