AWS Certified DevOps Engineer Notes
service-provider::service-name::data-type-name. Example: AWS::EC2::Instance!Ref functionStringNumberCommaDelimitedListList<Type>DescriptionConstraintDescription (String)MinLength/MaxLengthMinValue/MaxValueDefaultAllowedValues (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
!RefAWS::AccountIdAWS::RegionAWS::StackIdAWS::StackNameAWS::NoValueFn::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::AndFn::EqualsFn::IfFn::NotFn::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::Base64Fn:CidrFn:GetAZsOnFailure=ROLLBACK)OnFailure=DO_NOTHING)OnFailure=DELETEContinueUpdateRollback 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 allowedDeletionPolicyDeletionPolicy=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.logyum or dnf on non-Amazon Linux AMIscfn-init, cfn-signal, cfn-get-metadata, cfn-hupAWS::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-signalCreationPolicy: 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.loginterval) 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.confDependsOnCode ZipFile key which should specify that its content is a multi line content (use the pipe operator for this |)Code S3Bucket tagS3ObjectVersionCREATE_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_COMPLETEDELETE_FAILEDDELETE_IN_PROGRESSREVIEW_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_COMPLETEIMPORT_ROLLBACK_IN_PROGRESSDELETE_FAILED:
DeletionPolicy=Retain will skip the deletion of the resource that is failing to be removedUPDATE_ROLLBACK_FAILED:
ContinueUpdateRollbackOUTDATED: