DevOps Flashcards
What’s the Ref function used for with CloudFormation?
An intrinsic function of CloudFormation that receives a logical ID as input and returns:
- for parameters: value of parameter
- for resources: physical ID (mostly, can also be something different, like for Elastic IPs, it’s the IP address)
What’s the GetAtt function used for with CloudFormation?
Returns the value of an attribute for a given resource (input is the logical ID of the resource).
What does this CloudFormation statement do?
!Select [ 0, !GetAZs ‘’ ]
Returns all AZs for the current region (‘’) and picks the first one in the list.
Note: returns only Availability Zones that have a default subnet unless none of the Availability Zones has a default subnet; in that case, all Availability Zones are returned
What’s the problem with this CloudFormation definition?
MyElasticIP:
Type: AWS::EC::EIP
Properties:
[…]
It doesn’t have a DependsOn attribute. As Elastic IPs however depend on the existence of an Internet Gateway, this CloudFormation definition could lead to a failure. A better definition would look like that:
MyElasticIP: Type: AWS::EC::EIP DependsOn: InternetGatewayAttachment Properties: [...]
What’s the resource limit for a single CloudFormation stack?
500
What’s the key difference between Nested Stacks and Cross-Stack References with CloudFront?
Nested Stacks allow re-usage of templates, for instance to create a specific VPC structure. Cross-Stack References instead re-use the actual resources created by a stack, rather than the template.
Use Nested Stacks when all resources belong together and therefore shall be spin up and down together. Use Cross-Stack References instead when there is an existing resource (like a VPC) that is used by the template, but should not be spin up and down when the template is being applied.
What are the two ways that you can apply permission for CloudFormation StackSets?
1: self-managed permissions (via IAM roles)
2: service-managed permissions (via AWS Organizations)
What’s “Concurrent Accounts” in the context of CloudFormation StackSets?
The number of accounts that stack instances can be created in parallel by StackSets.
For example, if a StackSet shall be applied to 10 accounts, and “Concurrent Accounts” is set to 2, stack instances can only be created in 2 accounts at the same time, therefore needing more time to finish the resource creation.
What’s “Failure Tolerance” in the context of CloudFormation StackSets?
Amount of individual deployments that can fail before the stack set itself is considered as failed
What’s “Retain Stacks” in the context of CloudFormation StackSets?
When removing a stack instance from a stack set, this flag defines whether the stack instance will be deleted or not.
What are valid actions for a CloudFormation DeletionPolicy?
Delete (default)
Retain
Snapshot (if supported)
What services/resources support taking a Snapshot as part of a CloudFormation DeletionPolicy?
EBS Volumes, RDS, Neptune, Redshift, ElastiCache
If an identity (user, script, etc.) wants to create resources with CloudFormation, but doesn’t have the permissions for these resources, what’s the recommended way to handling this?
Create an IAM role that serves as “Stack Role”, which has the permissions required to create the resources. The identity can then pass that role to CloudFormation when the stack is created, so that CloudFormation can assume the role and successfully create the resources.
What’s the buildspec.yml used for by AWS CodeBuild and where is it defined?
It’s collection of build commands and related settings that CodeBuild uses to run a build. You can include a buildspec as part of the source code or you can define a buildspec when you create a build project.
What’s the appspec.[yml or json] used for by AWS CodeDeploy?
It’s used by CodeDeploy to manage a deployment. When deploying to Lambda for example, it specifies which version to deploy.
What are valid deployment targets for AWS CodeDeploy?
- EC2 / On-Premise (via an agent)
- ECS
- Lambda
Where’s the buildspec.yml that is used by AWS CodeBuild located?
In the root of the source
What are the four phases in a buildspec.yml used by AWS CodeBuild and what do they do?
- install: install build dependencies (like test frameworks)
- pre_build: sign-in to things, install app dependencies (like npm packages)
- build: commands to run during the build
- post_build: packaging, pushing images, notifications
What are the three configuration sections in an Appspec.[yml/json] and with which deployment targets are they used?
- Files (EC2/On-prem)
- Resources (ECS/Lambda)
- Permissions (EC2/On-prem)
What’s the “Resources” configuration section in an Appspec.[yml/json] used for?
It configures ECS or Lambda properties for the deployment. For example:
Lambda: name, alias, versions, ..
ECS: task definition, container & port details, etc.
What are the seven lifecycle event hooks in a Appspec.[yml/json] used by AWS CodeDeploy?
- ApplicationStop
- DownloadBundle
- BeforeInstall
- Install
- AfterInstall
- ApplicationStart
- ValidateService
What are the three different platform types that AWS Elastic Beanstalk supports?
- Built-in languages (.NET, Java, Pyhton, etc.)
- Docker (Single + Multi)
- Custom Platforms (requires AMI created by Packer)
From which two type of environment tiers can you choose when launching an environment in AWS Elastic Beanstalk?
Web and Worker tiers