Reference Parameter Value in UserData in AWS Cloudformation

后端 未结 2 1689
粉色の甜心
粉色の甜心 2021-01-22 13:16

I have this under parameter section ,

Parameters:
  PlatformSelect:
    Description: Cockpit platform Select.
    Type: String
    Default: qa-1
    AllowedValue         


        
2条回答
  •  伪装坚强ぢ
    2021-01-22 13:56

    Is there a reason why you are using Mapping in between?

    You could easily use !Sub instead

    Resources:
      EC2Instance:
        Type: AWS::EC2::Instance
        Properties:
          InstanceType: !Ref InstanceType
          KeyName: !Ref KeyName
          Tags:
            - Key: Name
              Value: Test
          UserData:
            Fn::Base64:
              !Sub |
                #!/bin/bash
                ${PlatformSelect}
    

提交回复
热议问题