title: Use a map in Cloudformation to define static dev and prod configs?
body: <p>I want to have a single template for all my deployments.</p>
  
  <p>I want my dev and prod configuration defined in the same template.</p>
  
  <p>When I call the template I pass a param for dev or prod and cloudformation uses the variables for the dev or prod map- is this possible?</p>
  
  <p>I can see its supports maps but Im unsure of how to achieve what i want with it: <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html</a></p>
  
  <p>Is there a way I could make all my params maps and then have one param for dev or prod and when I set that one param when deploying cloudformation uses the dev or prod property of the params?</p>
  
  <p>Example:</p>
  
  <pre><code>Parameters:
    env:
      Description: environment
      Type: String
      Default: dev
  
  Mappings: 
    RegionMap: 
      dev: 
        HVM64: "ami-0ff8a91507f77f867"
        HVMG2: "ami-0a584ac55a7631c0c"
      prod: 
        HVM64: "ami-0bdb828fd58c52235"
        HVMG2: "ami-066ee5fd4a9ef77f1"
    DynamoTableName:
      dev: 'devtable'
      prod: 'prodtable'
    SomeOtherVar: ...
  
  Resources: 
    myEC2Instance: 
      Type: "AWS::EC2::Instance"
      Properties: 
        ImageId: !FindInMap
          - RegionMap
          - !Ref env
          - HVM64
        InstanceType: m1.small
  </code></pre>