AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Specifying Return Values with Outputs

You can use the template Outputs section to specify custom values that are included in the values returned by aws cloudformation describe-stacks command. You specify each custom value according to template property rules (Resources), so you can base their value on literals, parameter references, pseudo parameters, mapping value, and intrinsic functions.

For a simple example, a sample template declares two outputs, IPAddress and InstanceId:

"Outputs" : {
    "IPAddress" : {
        "Value" : { "Ref" : "MyIp" }
    },

    "InstanceId" : {
        "Value" : { "Ref" : "MyInstance" }
    }
}

Both values are based on logical names declared within the template. IPAddress refers to the AWS::EC2::EIP type with the logical name MyIp, and InstanceId refers to the AWS::EC2::Instance type with the logical name MyInstance.

After the stack is created, and aws cloudformation describe-stacks reports its status as being CREATE_COMPLETE, it also reports the following:

PROMPT> aws cloudformation describe-stacks --stack-name StackName
...
    "Outputs": [
        {
            "OutputKey": "IPAddress",
            "OutputValue": "184.72.229.56"
        },
        {
            "OutputKey": "InstanceId",
            "OutputValue": "i-47ab0a2b"
        }
    ],
...

The custom output values IPAddress and InstanceId are present at the end of the report.