Download AWS CloudFormation User Guide
Transcript
AWS CloudFormation User Guide
Fn::FindInMap
"Fn::If" : [
"CreateNewSecurityGroup",
{"Ref" : "NewSecurityGroup"},
{"Ref" : "ExistingSecurityGroup"}
]
}
}
}
}
To determine whether to create the NewSecurityGroup resource, the resource is associated with the
CreateNewSecurityGroup condition. The resource is created only when the condition is true (when
the ExistingSecurityGroup parameter is equal to NONE).
In the SecurityGroups property, the template uses the Fn::If intrinsic function to determine which
security group to use. If the CreateNewSecurityGroup condition evaluates to true, the security group
property references the NewSecurityGroup resource. If the CreateNewSecurityGroup condition
evaluates to false, the security group property references the ExistingSecurityGroup parameter (the
default security group).
Lastly, the template conditionally outputs the security group ID. If the CreateNewSecurityGroup
condition evaluates to true, AWS CloudFormation outputs the security group ID of the NewSecurityGroup
resource. If the condition is false, AWS CloudFormation outputs the security group ID of the
ExistingSecurityGroup resource.
Fn::FindInMap
The intrinsic function Fn::FindInMap returns the value corresponding to keys in a two-level map that
is declared in the Mappings section.
Declaration
"Fn::FindInMap" : [ "MapName", "TopLevelKey", "SecondLevelKey"]
Parameters
MapName
The logical name of a mapping declared in the Mappings section that contains the keys and values.
TopLevelKey
The top-level key name. Its value is a list of key-value pairs.
SecondLevelKey
The second-level key name, which is set to one of the keys from the list assigned to TopLevelKey.
Return Value:
The value that is assigned to SecondLevelKey.
Example
The following example shows how to use Fn::FindInMap for a template with a Mappings section that
contains a single map, RegionMap, that associates AMIs with AWS regions.
• The map has 5 top-level keys that correspond to various AWS regions.
API Version 2010-05-15
660
Related documents
Erste Schritte mit AWS Webanwendungshosting für Microsoft Windows
Sharp FO-781 Specifications
Apache MP3-341 Specifications
Erste Schritte mit AWS
Installation and configuration guide Installation & Configuration guide
Deployment of Virtual Resources Using Template Management
D9.6 Automated deployment
COMPUTATION CLOUD TO ENABLE HIGH THROUGHPUT
EC2 User Guide for Linux - Documentation
AWS Toolkit for Visual Studio User Guide
Amazon Simple Storage Service Console User Guide