AWS CloudFormation
User Guide (API Version 2010-05-15)


The optional Outputs section declares output values that you can import into other stacks (to create cross-stack references), return in response (to describe stack calls), or view on the AWS CloudFormation console. For example, you can output the S3 bucket name for a stack to make the bucket easier to find.


The Outputs section consists of the key name Outputs, followed by a space and a single colon. You can declare a maximum of 60 outputs in an AWS CloudFormation template.

The following example template snippet demonstrates the structure of the Outputs section.


Use braces to enclose all output declarations. Delimit multiple outputs with commas.

"Outputs" : {
  "Logical ID" : {
    "Description" : "Information about the value",
    "Value" : "Value to return",
    "Export" : {
      "Name" : "Value to export"


  Logical ID:
    Description: Information about the value
    Value: Value to return
      Name: Value to export

Output Fields

The Outputs section can include the following fields.

Logical ID

An identifier for the current output. The logical ID must be alphanumeric (a-z, A-Z, 0-9) and unique within the template.

Description (optional)

A String type that describes the output value. The description can be a maximum of 4 K in length.

Value (required)

The value of the property returned by the aws cloudformation describe-stacks command. The value of an output can include literals, parameter references, pseudo-parameters, a mapping value, or intrinsic functions.

Export (optional)

The name of the resource output to be exported for a cross-stack reference.


The following restrictions apply to cross-stack references:

  • For each AWS account, Export names must be unique within a region.

  • You can't create cross-stack references across different regions. You can use the intrinsic function Fn::ImportValue only to import values that have been exported within the same region.

  • For outputs, the value of the Name property of an Export can't use functions (Ref or GetAtt) that depend on a resource.

    Similarly, the ImportValue function can't include functions (Ref or GetAtt) that depend on a resource.

  • You can't delete a stack if another stack references one of its outputs.

  • You can't modify or remove the output value as long as it's referenced by another stack.

To associate a condition with an output, define the condition in the Conditions section of the template.


The following examples illustrate how stack output works.

Stack Output

In the following example template snippet, the output named BackupLoadBalancerDNSName returns the DNS name for the resource with the logical ID BackupLoadBalancer only when the CreateProdResources condition is true. (The second output was added to show how to specify multiple outputs.)


"Outputs" : {
  "BackupLoadBalancerDNSName" : {
    "Description": "The DNSName of the backup load balancer",  
    "Value" : { "Fn::GetAtt" : [ "BackupLoadBalancer", "DNSName" ]},
    "Condition" : "CreateProdResources"
  "InstanceID" : {
    "Description": "The Instance ID",  
    "Value" : { "Ref" : "EC2Instance" }


    Description: The DNSName of the backup load balancer
    Value: !GetAtt BackupLoadBalancer.DNSName
    Condition: CreateProdResources
    Description: The Instance ID
    Value: !Ref EC2Instance

Cross-Stack Output

In the following example template snippet, the output named StackVPC returns the ID of a VPC and then exports the value for cross-stack referencing with the name AccountVPC.


"Outputs" : {
  "StackVPC" : {
    "Description" : "The ID of the VPC",
    "Value" : { "Ref" : "MyVPC" },
    "Export" : {
      "Name" : "AccountVPC"


    Description: The ID of the VPC
    Value: !Ref MyVPC
      Name: AccountVPC