Show / Hide Table of Contents

Mapping

The Mapping declaration specifies a section that matches a key to a corresponding set of named values. For example, to set values based on a region, create a mapping that uses the region name as a key and contains the values for each specific region. The !FindInMap intrinsic function is used to retrieve values in a map.

Syntax

Mapping: String
Description: String
Value:
  First Level Key-Value Mapping
    Second Level Key-Value Mapping

Properties

Description

The Description attribute specifies the mapping description.

Required: No

Type: String

Mapping

The Mapping attribute specifies the item name. The name must start with a letter and followed only by letters or digits. Punctuation marks are not allowed. All names are case-sensitive.

Required: Yes

Type: String

Value

The Value attribute specifies the mapping associations. Within the mapping, each map is a key followed by another mapping. The key identifies a map of name-value pairs and must be unique within the mapping. The name can contain only alphanumeric characters (A-Za-z0-9). The keys in mappings must be literal strings. The values can be String or List types.

Required: Yes

Type: Key-Value Pair Mapping

Examples

Basic mapping

- Mapping: Greetings
  Description: Time of day greeting
  Value:
    Morning:
      Text: Good morning
    Day:
      Text: Good day
    Evening:
      Text: Good evening
    Night:
      Text: Good night

- Parameter: SelectedTime
  Description: Parameter for selecting the time of day
  AllowedValues:
    - Morning
    - Day
    - Evening
    - Night

- Variable: SelectedGreeting
  Description: Selected greeting
  Value: !FindInMap [ Greetings, !Ref SelectedTime, Text ]
In This Article
Back to top Generated by DocFX