Developer Theory (ACG) Flashcards
What is CI/CD?
Continuous Integration, Continuous Delivery/Deployment
A software development best practice by making small changes and automate as much as possible.
Describe Continuous Integration
Integrating or merging the code changes frequently - at least once per day.
Think CodeCommit.
Describe Continuous Delivery
Automating the build, test and deployment functions.
Think CodeBuild and CodeDeploy
Describe Continuous Deployment
Fully automated release process, code is deployed into Stage/Prod as soon as it has successfully passed through the release pipeline.
Think CodePipeline.
What is an In-Place deployment?
The app is stopped on each instance and the new release is installed (also known as a rolling update).
Capacity is reduced as each instance is updated. You have to re-deploy to rollback and Lambda is not supported.
What is a Blue/Green deployment?
New instances are provisioned where the new release is installed. Blue represents the active deployment, green is the new release.
Switch back and forth with your Load Balancer. You pay for 2 environments until you terminate the old servers.
What is the AppSpec File?
Configuration file that defines parameters for CodeDeploys such as target OS, files, hooks, etc. Should be saved in the root directory. Hooks are lifecycle events that have a very specific run order.
What is Run Order?
Lifecycle event hooks are run in a specific order known as the Run Order.
In-Place Deployment can be broken down into 3 broad phases, what are they?
De-registering, installation, re-registering with a Load Balancer.
What is the logical flow of an In-Place deployment? (7 steps)
ApplicationStop DownloadBundle BeforeInstall Install AfterInstall ApplicationStart ValidateService
What is CodeArtifact?
Central repo that can be used by all devs to obtain the correct version of software packages/libraries required for their projects. Think nuGet packages.
How do you pull packages from an external public repository such as npm?
Create an upstream repository with an external connection to the public repository i.e. npm.
What is SAM?
Serverless Application Model (SAM)
Extension for CloudFormation to define and provision serverless apps. Has its own AWS SAM CLI and its own commands to package and deploy:
sam package
sam deploy
Packages app and uploads to S3
Deploys serverless app using CloudFormation
What are CloudFormation Nested Stacks?
Allows you to re-use CloudFormation code for frequently used configs, e.g., load balancers, web/app servers.
Reference it in the Resources section of any CloudFormation template using the Stack resource type.
What AWS service provides source control, enabling teams to collaborate on code, html pages, scripts, images, and binaries?
CodeCommit
What AWS service compiles source code, runs tests and produces packages that are ready to deploy?
CodeBuild
What AWS service automates code deployments to EC2 instances, Lambda and on-prem systems?
CodeDeploy
What AWS service is an end-to-end solution, allowing you to build, test, and deploy your app every time there is a code change?
CodePipeline
A virtual operating environment with everything software needs to run are called what?
Containers
Includes libraries, system tools, code and runtime.
Apps can be built using independent stateless components, or microservices running in multiple containers.
What is ECS?
Elastic Container Service
ECS can run your containers on clusters of VMs. Docker and Windows containers are supported.
What is Fargate?
You can run containers without EC2 instances. Serverless!
What is ECR?
Elastic Container Registry
Where you store your container images.
When using Elastic Beanstalk, you can deploy your Docker container to a single EC2 instance. True or False?
TRUE
You can also deploy multiple docker instances to an ECS cluster.
How do you deploy a docker container to Elastic Beanstalk?
Just upload your code bundle to Elastic Beanstalk.
What section is mandatory in your CloudFormation template?
Resources
Where do you input custom values, like the name of an EC2 SSH key pair in your CloudFormation template?
Parameters
Where do you provision resources according to the environment in your CloudFormation template?
Conditions
Which section allows you to create custom mappings like ‘Region : AMI’ in your CloudFormation template?
Mappings
Which section references code located in S3 to specify the use of the Serverless Application Model (SAM)?
Transform
Where do you define nested stacks in your CloudFormation template?
Resources
Reference nested stacks in the Resources section using the Stack resource type.
Which section allows you to export values from one stack to another in CloudFormation?
Outputs
Use the import value function to import values.
When deploying application code to a EC2/On-Premises compute platform, the AppSpec file can be written in which language?
YAML
AppSpec files on an EC2/on-premises compute platform must be a YAML-formatted file named appspec.yml and it must be placed in the root of the directory structure of an application’s source code. Otherwise, deployments fail.
You are using CloudFormation to create a new S3 bucket, which of the following sections would you use to define the properties of your bucket?
Resources
The Resources section specifies the stack resources and their properties, such as an Amazon Elastic Compute Cloud instance or an Amazon Simple Storage Service bucket.
Which AWS service can be used to centrally store and version control your application source code, binaries and libraries?
CodeCommit
AWS CodeCommit is a fully-managed source control service that hosts secure Git-based repositories. It makes it easy for teams to collaborate on code in a secure and highly scalable ecosystem.
Which of the following should you do if you want to allow developers to pull packages from an external public repository and make them available in a CodeArtifact repository?
Create an upstream CodeArtifact repository with an external connection to the external repository. Associate the upstream repository with the repository used by the developers.
What is the purpose of creating an external connection when configuring CodeArtifact?
An external connection is a connection between a CodeArtifact repository and an external, public repository so that packages can be fetched from the external repository.
Which of the following practices allows multiple developers working on the same application to merge code changes frequently, without impacting each other and enables the identification of bugs early on in the release process?
Continuous Integration
Continuous Integration (CI) is the practice of merging all developers’ working copies to a shared repository frequently, preferably several times a day. One of the key benefits of integrating regularly is that you can detect errors quickly and locate them more easily. As each change introduced is typically small, pinpointing the specific change that introduced a defect can be done quickly.
Which AWS CloudFormation section specifies one or more macros that AWS CloudFormation uses to process your templates, and is required for AWS SAM template files?
Transform
The Transform section specifies one or more macros that AWS CloudFormation uses to process your template. The Transform section builds on the simple, declarative language of AWS CloudFormation with a powerful macro system. The declaration Transform: AWS::Serverless-2016-10-31 is required for AWS SAM template files.
You want to use the output of your CloudFormation stack as input for another CloudFormation stack. Which section of your CloudFormation template would you use to help you do this?
Outputs
Which of the following is an artifact repository that makes it easy for developers to find approved software packages they need to build their applications?
CodeArtifact
When deploying application code to Lambda, the AppSpec file can be written in which languages?
YAML and JSON
The application specification file (AppSpec file) is a YAML-formatted or JSON-formatted file used by CodeDeploy to manage a deployment.
Your company has moved to AWS so it can use “Infrastructure as Code”. You would like to apply version control to your infrastructure, so that you can roll back infrastructure to a previous stable version if needed. You would also like to quickly deploy testing and staging environments in multiple regions. What services should you use to achieve this?
CloudFormation and CodeCommit.
CloudFormation allows for the rolling back to prior stacks and is AWS’s go to Infrastructure as code solution. CodeCommit is a fully-managed source control service for secure Git-based repositories.
Part of your CloudFormation deployment fails due to a misconfiguration, by default what will happen?
CloudFormation will rollback the entire stack
By default, the “automatic rollback on error” feature is enabled. This will direct CloudFormation to only create or update all resources in your stack if all individual operations succeed. If they do not, CloudFormation reverts the stack to the last known stable configuration.
In the CodeDeploy AppSpec file, what are hooks used for?
To specify code, scripts or functions that you want to run at set points in the deployment lifecycle.
The hooks section specifies the location (as relative paths starting from the root of the revision bundle) of the scripts to run during each phase of the deployment. Each phase of a deployment is called a deployment lifecycle event.
Which AWS service can be used to automatically install your application code onto EC2, on-premises systems and Lambda?
CodeDeploy
CodeDeploy is a deployment service that automates application deployments to Amazon EC2 instances, on-premises instances, serverless Lambda functions, or Amazon ECS services.
Which AWS service can be used to fully automate your entire release process?
CodePipeline
You want users to receive an email notification whenever they push code to their AWS CodeCommit repositories. How can you configure this?
Configure Notifications in the AWS CodeCommit console, this will create a CloudWatch Events rule to send a notification to an Amazon SNS topic which will trigger an email to be sent to the user
You can set up notification rules for a repository so that repository users receive emails about the repository event types you specify. Notifications are sent when events match the notification rule settings. You can create an Amazon SNS topic to use for notifications or use an existing one in your AWS account. You can use the CodeCommit console and the AWS CLI to configure notification rules.
Which of the following approaches allows you to re-use pieces of CloudFormation code in multiple templates, for common use cases like provisioning a load balancer or web server?
Use a CloudFormation nested stack
Which 4 things are suitable to store in CodeArtifact?
Libraries
Documentation relating to your application
Deployable packages
Compiled applications
CodeArtifact is a fully managed artifact repository service that makes it easy for organizations of any size to securely store, publish, and share software packages used in their software development process. This includes everything needed to build your application, including libraries, deployable packages, compiled applications, and documentation relating to your application.
How can you prevent AWS CloudFormation from deleting successfully provisioned resources during a stack create operation, while allowing resources in a failed state to be updated or deleted upon the next stack operation?
Two things:
- In the CloudFormation console, for Stack failure options, select “Preserve successfully provisioned resources”
- Use the “–disable-rollback” flag with the AWS CLI
Which two things can you define using the Transforms section of the CloudFormation template?
- To re-use code located in S3
2. To specify the use of the Serverless Application Model for Lambda deployments
You are running your application using Docker provisioned with Elastic Beanstalk. You would like to upgrade the application to a new version. How should you approach this?
Bundle your Dockerfile and the application code into a zip file, then upload and deploy it using the Elastic Beanstalk console.
You are deploying an application to a number of EC2 instances using CodeDeploy. What is the name of the file used on the EC2/on-premises compute platform?
appspec.yml
AppSpec files on an EC2/on-premises compute platform must be a YAML-formatted file named appspec.yml and it must be placed in the root of the directory structure of an application’s source code. Otherwise, deployments fail.
Which AWS service can be used to compile source code, run tests and also package code?
CodeBuild