简体   繁体   中英

Reference “Self” in aws cloudformation template?

I've got an EC2 resource defined in Cloudformation like so:

Resources:
  FooInstance:
    Type: 'AWS::EC2::Instance'
    Properties:
      blah: blah
      blah: blah
      UserData:
        Fn::Base64: !Sub |
            #!/bin/bash
            /opt/aws/bin/cfn-init --stack ${AWS::StackId} --resource FooInstance --region ${AWS::Region}

Is there a special variable/replacement string to reference "self" in that UserData cfn-init block instead of explicitly declaring FooInstance ? It would help make definitions much more copypastable for my team.

Thanks!

Unfortunately, no. This would be a very nice add-on for both UserData and AWS::CloudFormation::Init parts, but AWS still doesn't support it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM