AWSTemplateFormatVersion

2010-09-09

Description

cfn_main.yml

CloudFormation features demonstration template (Main). Demonstrates multi-line description and standard sections.

Transform

#
Value
AWS::LanguageExtensionsLanguage Extensions
AWS::LanguageExtensions
Enables CloudFormation language extensions like Fn::ForEach for loops and Fn::Length for array manipulation.
Enables CloudFormation language extensions like Fn::ForEach for loops and Fn::Length for array manipulation.
AWS::Serverless-2016-10-31SAM Transform
AWS::Serverless-2016-10-31
AWS SAM (Serverless Application Model) transform. Converts simplified SAM syntax into standard CloudFormation resources.
AWS SAM (Serverless Application Model) transform. Converts simplified SAM syntax into standard CloudFormation resources.

Metadata

Console UI Configuration

Property
Value
ParameterGroups
# 0
Property
Value
Label
Property
Value
default
Network Configuration
Parameters
Value
VPC
Subnets
# 1
Property
Value
Label
Property
Value
default
Server Configuration
Parameters
Value
InstanceType
KeyPair
ParameterLabels
Property
Value
VPC
Property
Value
default
Which VPC should this be deployed to?

Parameters

Environment Type String

Property
Value
DefaultDefault Value
dev
Default value used when no value is provided during stack creation.
Default value used when no value is provided during stack creation.
Description
Environment type for the deployment
Human-readable description of this parameter shown in the CloudFormation console.
Human-readable description of this parameter shown in the CloudFormation console.
AllowedValuesAllowed Values
Value
dev
prod
Constraint that limits input to only these values. Referenced by Rules validation for additional checks.
Constraint that limits input to only these values. Referenced by Rules validation for additional checks.
ConstraintDescription
Must be either dev or prod
Error message shown when validation fails. Helps users understand what values are acceptable.
Error message shown when validation fails. Helps users understand what values are acceptable.

SSH Key Pair AWS::EC2::KeyPair::KeyName

Property
Value
Description
EC2 Key Pair for SSH access
Describes the purpose of this key pair parameter for SSH access.
Describes the purpose of this key pair parameter for SSH access.

Mappings

Region-Specific AMIs

Property
Value
us-east-1US East (N. Virginia)
Property
Value
AMIAMI ID
ami-12345
Region-specific AMI ID for us-east-1
Region-specific AMI ID for us-east-1
ap-northeast-1Asia Pacific (Tokyo)
Property
Value
AMIAMI ID
ami-67890
Region-specific AMI ID for ap-northeast-1 Referenced by EC2Instance MapVal using !FindInMap
Region-specific AMI ID for ap-northeast-1 Referenced by EC2Instance MapVal using !FindInMap

Conditions

Is Production?

!Equals [
!Ref EnvType
,prod]

Not Development?

!Not [
!Equals [
!Ref EnvType
,dev]
]

Complex Condition

!And [
!Condition IsProd
,
!Or [
!Equals [
!Ref AWS::Region
,us-east-1]
,
!Condition IsNotDev
]
]

Resources

Environment Parameter AWS::SSM::Parameter

Attributes

Attribute
Value
ConditionCreation Condition
IsProd
DependsOnDependencies
DependentResource
DeletionPolicyDeletion Policy
Retain
UpdateReplacePolicyUpdate Policy
Retain
MetadataResource Metadata
Property
Value
LocalMeta
Local Metadata Value

Properties

Property
Value
NameParameter Name
!Sub ${AWS::StackName}-Param
Parameter name using !Sub to interpolate stack name Results in format: {StackName}-Param
Parameter name using !Sub to interpolate stack name Results in format: {StackName}-Param
TypeValue Type
String
String type for plain text values. Other options: StringList, SecureString for encrypted values.
String type for plain text values. Other options: StringList, SecureString for encrypted values.
ValueParameter Value
!Ref EnvType
References the EnvType parameter value using !Ref intrinsic function.
References the EnvType parameter value using !Ref intrinsic function.
DescriptionDescription
!If [IsProd,Production Value,Development Value]
Conditional value using !If based on IsProd condition Returns different descriptions for production vs development environments
Conditional value using !If based on IsProd condition Returns different descriptions for production vs development environments
TierParameter Tier
Standard
Parameter Store tier: Standard = Free, up to 4KB value size Advanced = Paid, up to 8KB, supports parameter policies
Parameter Store tier: Standard = Free, up to 4KB value size Advanced = Paid, up to 8KB, supports parameter policies
DataTypeData Type
text
Data type validation. text for plain strings, aws:ec2:image for AMI IDs.
Data type validation. text for plain strings, aws:ec2:image for AMI IDs.
AllowedPatternValidation Pattern
^[a-zA-Z0-9_.-]+$
Regex pattern for validation. This pattern allows alphanumeric characters, underscores, dots, and hyphens.
Regex pattern for validation. This pattern allows alphanumeric characters, underscores, dots, and hyphens.
TagsResource Tags
Property
Value
EnvironmentEnvironment Tag
!Ref EnvType
Tag value dynamically set from EnvType parameter. Enables cost allocation and resource filtering.
Tag value dynamically set from EnvType parameter. Enables cost allocation and resource filtering.

DependentResource Custom::Test

Property
Value
Target
!GetAtt MainResource.Type
Uses !GetAtt to reference attributes of other resources See also EC2Instance for more intrinsic function examples
Uses !GetAtt to reference attributes of other resources See also EC2Instance for more intrinsic function examples

Outputs

MainOutput

Property
Value
Value
!Ref MainResource
Output the parameter name using !Ref. Can be imported by other stacks using !ImportValue.
Output the parameter name using !Ref. Can be imported by other stacks using !ImportValue.
Export
Property
Value
Name
!Sub ${AWS::StackName}-MainOutput
Export name for cross-stack references See EC2Instance ImportVal for usage example
Export name for cross-stack references See EC2Instance ImportVal for usage example