AWS Certified DevOps Engineer Notes
service-provider::service-name::data-type-name
. Example: AWS::EC2::Instance
!Ref
functionString
Number
CommaDelimitedList
List<Type>
Description
ConstraintDescription
(String)MinLength
/MaxLength
MinValue
/MaxValue
Default
AllowedValues
(array)AllowedPattern
(regex)NoEcho
(boolean; do not display his value anywhere, useful for passwords) Parameters:
InstanceType:
Description: Chose an EC2 instance type
Type: String
AllowedValues:
- t2.micro
- t2.small
- t2.medium
Password:
Description: Admin password
Type: String
NoEcho: True
Resources:
MyEC2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType: !Ref InstanceType
ImageId: ami-1233
!Ref
AWS::AccountId
AWS::Region
AWS::StackId
AWS::StackName
AWS::NoValue
Fn::FinInMap
function:
!FindInMap [MapName, TopLevelKey, SecondLevelKey]
Export
block: has to be specified in order the the output to be able to be imported in another template!ImportValue
or Fn::ImportValue
: imports an output into a stack Condition:
CreateProdResources: !Equals [ !Ref EnvType, prod ]
Fn::And
Fn::Equals
Fn::If
Fn::Not
Fn::Or
Resources:
MountPoint:
TYpe: AWS::EC2::VolumeAttachment
Condition: CreateProdResources
Fn::Ref
(!Ref
):
Fn::GetAtt
(!GetAtt
):
Fn::FindInMap
:
Fn::ImportValue
:
Fn::Join
:
!Join[ delimiter, [ comma- delimited list of values ] ]
Fn::Sub
::
${VariableName}
which will be substitutedFn::Base64
Fn:Cidr
Fn:GetAZs
OnFailure=ROLLBACK
)OnFailure=DO_NOTHING
)OnFailure=DELETE
ContinueUpdateRollback
API from Consoleiam:PassRole
permissionCAPABILITY_IAM
, CAPABILITY_NAMED_IAM
: some stack templates might include resources that can affect permissions in your AWS account, for example, by creating new AWS Identity and Access Management (IAM). For those stacks, you must explicitly acknowledge this by specifying one of these capabilitiesCAPABILITY_AUTO_EXPAND
: necessary when the template includes Macros or Nested Stacks to perform dynamic transformationsInsufficientCapabilitiesException
: this exception is returned if the capabilities where not allowedDeletionPolicy
DeletionPolicy=Delete
:
DeletionPolicy=Retain
:
DeletionPolicy=Snapshot
:
ALLOW
for the resources we want to be updatableServiceToken
property which has to be an ARN to a Lambda function or SNS topicssm
for plaintext stored in SSM Parameter Storessm-secure
for secure string stored in SSM Parameter Storesecretsmanager
for secret values stored in Secrets ManagerManageMasterUserPassword
field set to true, CloudFormation will automatically create a secret password in Secrets Manager/var/log/cloud-init-output.log
yum
or dnf
on non-Amazon Linux AMIscfn-init
, cfn-signal
, cfn-get-metadata
, cfn-hup
AWS::CloudFormation::Init
:
Metadata
block/var/log/cfn-init.log
filecfn-init
script finishedcfn-signal
script right after the cfn-init
script finished. This will tell CloudFormation if the init script succeeded or notcfn-signal
cfn-signal
CreationPolicy
: how many signal we want to see and for how much we want to waitcfn-init
and cfn-signal
commands were successfully run on the instance. We can view the logs such as /var/log/cloud-init.log
or /var/log/cnf-init.log
interval
) minutes and apply the Metadata configurationUpdateStack
API actioncfn-hup
configurations stored in /etc/cnf/cnf-hup.conf
and /etc/cfn/hooks.d/cnf-auto-reloader.conf
DependsOn
Code ZipFile
key which should specify that its content is a multi line content (use the pipe operator for this |
)Code S3Bucket
tagS3ObjectVersion
CREATE_COMPLETE
: Successful creation of one or more stacksCREATE_IN_PROGRESS
: Ongoing creation of one or more stacksCREATE_FAILED
: Unsuccessful creation of one or more stacks. Possible reasons for a failed creation include insufficient permissions to work with all resources in the stack, parameter values rejected by an AWS service, or a timeout during resource creationDELETE_COMPLETE
DELETE_FAILED
DELETE_IN_PROGRESS
REVIEW_IN_PROGRESS
: Ongoing creation of one or more stacks with an expected StackId
but without any templates or resourcesROLLBACK_COMPLETE
: Successful removal of one or more stacks after a failed stack creation or after an explicitly canceled stack creation. Any resources that were created during the create stack operation are deletedUPDATE_COMPLETE
: Successful update of one or more stacksUPDATE_COMPLETE_CLEANUP_IN_PROGRESS
: Ongoing removal of old resources for one or more stacks after a successful stack updateUPDATE_ROLLBACK_FAILED
: Unsuccessful return of one or more stacks to a previous working state after a failed stack update. When in this state, we can delete the stack or continue rollback. We might need to fix errors before our stack can return to a working state. Or, we can contact AWS Support to restore the stack to a usable state
IMPORT_IN_PROGRESS
: The import operation is currently in progressIMPORT_COMPLETE
IMPORT_ROLLBACK_IN_PROGRESS
DELETE_FAILED
:
DeletionPolicy=Retain
will skip the deletion of the resource that is failing to be removedUPDATE_ROLLBACK_FAILED
:
ContinueUpdateRollback
OUTDATED
: