6

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!

Eric
  • 1,953
  • 4
  • 24
  • 33

1 Answers1

5

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.

tyron
  • 3,715
  • 1
  • 22
  • 36