Search code examples
amazon-web-servicesaws-cloudformation

append a string in output section


This output works as expected. It shows the URL of the instance.

Outputs:
  thisInstance:
    Value: !GetAtt [MySpotInstance, PublicDnsName]
    Description: Jupyter Notebook on port 8888

But this does not work. I am trying to add ":8888" to the URL created as above.

Outputs:
  thisInstance:
    Value: !Sub ${!GetAtt [MySpotInstance, PublicDnsName]}:8888
    Description: Jupyter Notebook on port 8888

I just need to append ":8888" to the string and show it in the output.


Solution

  • You would need:

    Outputs:
      thisInstance:
        Value: !Sub 
           - '${dns}:8888'
           - dns: !GetAtt [MySpotInstance, PublicDnsName]
        Description: Jupyter Notebook on port 8888