Section 14 - Devops Flashcards
1
Q
What is CI / CD?
A
- Software development best practice
- Continous integration, Continous delivery / Deployment
- Make Small Changes & Automate Everything
- Small, Incremental code changes, Automate as much as possible
- e.g. code integration, build, test , deployment
2
Q
AWS Developer Tools?
A
-
CodeCommit (Source & version Control)
- Source control service enabling teams to collaborate on code.
-
CodeBuild (Automated Build)
- Compiles source code, runs tests and produces packages that are ready to deploy.
-
CodeDeploy(Automated Deployment)
- Automates code deployments to any instance, including EC2, Lambda and on-premises.
-
CodePipeline(Manages The workflow)
- End-to-end solution, build,test, and deploy your application everytime there is code change.
3
Q
What is CodeDeploy?
A
- Automated Deployment
- EC2 Instances, on-premises & Lambda
- Quickly release new features
- Avoid downtime during deployments
- CodeDeploy Deployment Approaches
-
In-Place
- The application is stopped on each instance and the new release is installed. Also known as a Rolling Update
- Capacity is reduced during the deployment.
- Lambda is not supported.
- Rolling back invloves a re-deploy
- Greate when deploying the first time.
-
Blue / Green (Safest Option)
- New instances are provisioned and the new release is installed on the new instances.
- Blue represents the active deployment,
- Green is the new release.
- No capacity reduction.
- Green instances can de created ahead of time.
- Easy to switch between old and new.
- You pay for 2 environments until you terminate the old servers.
-
In-Place
4
Q
Example In-Place Deployment?
A
- The application is stopped on the first instance.
- The instance will be out of service during the deployment so capacity is reduced.
- You should configure your Elastic Load balancer to stop sending requests to the instance.
- CodeDeploy installs the new version, known as Revision.
- The instance comes back into service.
- How to Roll Back? You’ll need to re-deploy the previous version which can be time consuming.
5
Q
Example Blue/Green Deployment?
A
- Blue represents the current version of our application.
- CodeDeploy provisions new instances. (Step 1)
- The new Revision is deployed to the Green envrionment.(Step 2)
- The Green instances are registered with the Elastic Load balancer. (Step 3)
- Traffic is routed away from the old environment.(Step 4)
- The Blue environment is evntually terminated (Step 5)
- How do you rollback? Just set the Load balancer to direct the traffic back to the original environment.
6
Q
CodeDeploy using the AppSpec File?
A
-
Configuration File
- Defines the parameters to be used during a CodeDeploy deployment
-
EC2
- For EC2 and on-premises systems, YAML Only.
-
Lambda
- YAML and JSON supported. File structure depends on wheather you are deploying to Lambda or EC2.
7
Q
EC2 AppSpec File Structure?
A
NB: The appspec.yml must be placed in the root of the directory of your Revision, otherwise the deployment will fail.
-
Version
- Reserved for Future USE
- Currently the allowed value is 0.0
-
OS
- Operating system version
- The operating system version you are using e.g Linux, Windows
-
Files
- Configuration Files, packages
- The location of any application files that need to be copied and where they should be copied to.
-
Hooks
- Lifecycle event hooks
- Scripts which need to run at set points in the deployment lifecycle.
- Hooks have a very specific run order.
8
Q
CodeDeploy Lifecycle Event Hooks?
A
-
Run Order
- Lifecycle event hooks are run in a specific order known as the Run order.
-
In-Place Deployment
- Broadly 3 Phases: de-register, installaing, re-registering with a Load Balancer
-
Logical Flow
- For the exam you’ll need to understand the Logical Flow.
9
Q
What is CodePipeline?
A
A fully managed CI/CD service.
-
Orchestrates Build,Test and Deployment
- The pipeline is triggered every time there is change to your code.
- a workflow must be defined for codepipeline
-
Automated Release Process
- Fast, consistent, fewer mistakes. Enables quick release of new features and bug fixes
-
CodePipeline integrates with:
- CodeCommit, CodeBuild, CodeDeploy, Github, Jenkins, Elastic Beanstalk, CloudFormation, Lambda, Elastic Container Service.
10
Q
What is Elastic Container Service?
A
- A container orchestration service which supports Docker and Windows Containers.
- Quickly deploy and scale containerized workloads without having to install, configure, manage and scale your own orchestration platform.
- Similar to Kubernetes, but with deep integration with AWS service e.g IAM, VPC, Route53
- Running options for ECS:
-
Clusters of Virtual Machines
- ECS will run your containers on clusters of virtual machine
-
Fargate for serverless
- Use Fargate for serverless containers and you don’t need to worry about the underlying EC2 instances!
-
EC2 for More Control
- If you want to control the installation, configuration and management of your compute environment
-
Clusters of Virtual Machines
11
Q
What is Elastic Container Registry (ECR)?
A
- Amazon Elastic Container Registry (Amazon ECR) is a fully managed container registry that makes it easy to store, manage, share, and deploy your container images and artifacts anywhere.
- Amazon ECR eliminates the need to operate your own container repositories or worry about scaling the underlying infrastructure
12
Q
Docker & and CodeBuild Exam Tips?
A
- Docker
- docker build -t myexamplerepo .
- docker tag myexamplerepo:latest 475745664.dkr.ecr.ue-centa-1.amazonaws.com ….:latest
- docker push 475745664.dkr.ecr.ue-centa-1.amazonaws.com ….:latest
-
“buildspec.yml” File
- Use buildspec.yml to define the build commands and settings used by CodeBuild to tun your build.
- Override “buildspec.yml” settings
- You can override the settings in buildspec.yml by adding your own commands in the console when you launch the build.
13
Q
Elastic Beanstalk & Docker Containers?
A
- Elastic Beanstalk supports the deployment of Docker containers.
- Docker containers are self-contained and include all the configuration information and software your web application requires to run.
- Elastic Beanstalk handles the capacity provisioning, load balancing, scaling and application health monitoring.
- Deployment options:
-
Single Docker Container
- You can either run a single Docker container on an EC2 instance provisioned by Elastic Beanstalk
-
Multiple Docker Containers
- Use Elastic Beanstalk to build an ECS cluster and deploy multiple Docker containers on each instance
-
Deploy Your Code
- Upload a zip file containing your code and bundle Elastic Beanstalk will do the rest.
- Code can be uploaded directly from your local machine or a public S3 bucket.
- You can also store your code in CodeCommit - But must use the Elastic Beanstalk CLI.
-
Upgrade Your Code
- If you want to upgrade your application to a new version, it’s one easy step in the console to upload and deploy.
-
Single Docker Container
14
Q
What is CloudFormation?
A
-
Infrastructure As Code
- Cloud formation allows you to manage , configure , and provision AWS infrastructure as YAML or JSON code.
-
Parameters
- input custom values
-
Conditions
- e.g. Provision resources based on environment
-
Resources
- This section is manadory and describes the AWS resources that CloudFormation will create.
-
Mappings
- Allows you to create custom mappings like Region: AMI
-
Transform
- Allows you to reference code located in S3, e.g. Lambda code or resuable snippets of CloudFormation code.
15
Q
Serverless Application Model (SAM) ?
A
- Define and provision serverless applications using CloudFormation
- “sam package”
- Packages your application and uploads to S3
- “sam deploy”
- Deploys your serverless app using CloudFormation