Mappings

The Mappings Section for Static Lookup Tables

A mapping is a fixed two-level lookup table read with Fn::FindInMap (FindInMap and If), the clean way to vary values by stage or by region (!Ref AWS 24 ::Region). BookNest keys its settings by stage:

infra/booknest-data.yaml: the Mappings sectionYAML
Mappings:
  StageSettings:
    dev: {BillingMode: PAY_PER_REQUEST, LogRetentionDays: 7}
    prod: {BillingMode: PROVISIONED, LogRetentionDays: 90}

Keys must be literal strings and values cannot contain parameters or functions, which is what makes a mapping safe to read at a glance. A lookup with a key that does not exist fails the whole operation; LocalStack 63,725 reported Template error: Unable to get mapping for StageSettings::test::BillingMode for Stage=test, so keep AllowedValues and the mapping's keys in step.