title: What is the purpose of creating "Mappings" in CloudFormation?
body: <p>See the code below:</p>
  <pre><code>Mappings:
      RegionMap:
          us-east-1:
              bucketname: s3bucketname-us-east-1
          us-east-2:
              bucketname: s3bucketname-us-east-2
          us-west-1:
              bucketname: s3bucketname-us-west-1
          us-west-2:
              bucketname: s3bucketname-us-west-2
          ap-south-1:
              bucketname: s3bucketname-ap-south-1
          ap-northeast-2:
              bucketname: s3bucketname-ap-northeast-2
          ap-southeast-1:
              bucketname: s3bucketname-ap-southeast-1
          ap-southeast-2:
              bucketname: s3bucketname-ap-southeast-2
          ap-northeast-1:
              bucketname: s3bucketname-ap-northeast-1
          ca-central-1:
              bucketname: s3bucketname-ca-central-1
          eu-central-1:
              bucketname: s3bucketname-eu-central-1
          eu-west-1:
              bucketname: s3bucketname-eu-west-1
          eu-west-2:
              bucketname: s3bucketname-eu-west-2
          eu-west-3:
              bucketname: s3bucketname-eu-west-3
          eu-north-1:
              bucketname: s3bucketname-eu-north-1
          sa-east-1:
              bucketname: s3bucketname-east-1
          af-south-1:
              bucketname: s3bucketname-south-1
          ap-east-1:
              bucketname: s3bucketname-east-1
          ap-northeast-3:
              bucketname: s3bucketname-ap-northeast-3
          eu-south-1:
              bucketname: s3bucketname-eu-south-1
          me-south-1:
              bucketname: s3bucketname-me-south-1
  
  Resources:
      StateS3Bucket:
          Type: AWS::S3::Bucket
          Properties:
              BucketName: !Sub &quot;cfntf-${AWS::Region}-${AWS::AccountId}&quot;
  </code></pre>
  <p>There is more to this code however I've only included the relevant snippets for the question.</p>
  <p>To summarize - why include mappings for bucketname when the bucketname  is set directly, using region and account ID in the 'Resources' section?</p>
  <p>There is use of the <code>Fn::FindInMap</code> function which is used here as part of the <code>ExecutorLambdaFunction</code>:</p>
  <pre><code>ExecutorLambdaFunction:
          Type: AWS::Lambda::Function
          Properties:
              FunctionName: myfunction
              Handler: index.handler
              Role: !GetAtt ExecutorLambdaServiceRole.Arn
              Environment:
                  Variables:
                      BUCKET: !Ref StateS3Bucket
              Code:
                  S3Bucket: !If
                    - S3Defined
                    - !Ref S3Bucket
                    - Fn::FindInMap:
                        - RegionMap
                        - !Ref AWS::Region
                        - bucketname
                  S3Key: !If
                    - S3Defined
                    - !Ref S3Key
                    - /app.zip
              Runtime: python3.8
            
  </code></pre>