Reference "Self" in aws cloudformation template?
Asked Answered
P

1

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!

Pandurate answered 16/10, 2018 at 19:37 Comment(0)
B
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.

Bursitis answered 17/10, 2018 at 17:56 Comment(2)
Thanks you! I will submit a feature request, we'll see what comes of it.Pandurate
@Pandurate Can you add the link to the feature request so we can follow it?Cabinet

© 2022 - 2024 — McMap. All rights reserved.