Outputs

  • For CloudFormation to do a cross-stack collaboration.
  • Output of one stack can be input of another stack If you export them first
  • Exported Output name must be unique
  • Example
Outputs:
	StackSSHSecurityGroup:
		Description: SSH security group for our company
		Value: !Ref MyCompanySecurityGroup
		Export:
			Name: SSHSecurityGroup
  • To import, use !ImportValue
Resources:
	MyInstance:
		Type: AWS::EC2::Instance
		Properties:
			...
			SecurityGroups:
				- !ImportValue SSHSecurityGroup