Developer Theory Flashcards
What does CI/CD stand for and what does the different parts mean? Which AWS service is connected to what part?
- Continuous Integration
- Integrating or merging the code changes frequently (at least once per day).
- Think CodeCommit - Continuous Delivery
- Automating the build, test and deployment functions
- Think CodeBuild and CodeDeploy - Continuous Deployment
- Fully automated release process. Code is deployed into Staging or Production as soon as it has successfully passed through the release pipeline.
- Think CodePipeline
Describe CodeCommit’s three main characteristics.
- Centralize Code Repository
- A place to store source code, binaries, libraries, images, HTML files, etc.
- Base on Git - Enables Collaboration
- Manages updates from multiple users - Version Control
- Tracks and manages code changes.
- Maintains version history
What are the two ways to perform a code deploy using CodeDeploy?
- In-Place/Rolling update
- The application is stopped on each instance and the new release is installed (one at the time)
- Capacity is reduced during the deployment
- Lambda is not supported
- Rolling back involves a re-deploy
- Great when deploying for the first time or for Test/Dev
- Blue/Green
- New instances are provisioned and the new release is installed on the new instances
- Blue refers to the old environment, green to the new
- No capacity reduction
- Green instances can be created ahead of time
- Easy to switch between old and new, if you change you mind you can simply set the Load Balancer to direct the traffic back to the old environment
- You pay for 2 environments until you terminate the old servers
What is the config file for CodeDeploy called?
- Appspec file (appspec.yml or appspec.json)
- Main configuration file for CodeDeploy.
- Defines the parameters to be used by CodeDeploy, e.g. OS, files, hooks
Where is CodeDeploy’s appspec.yml located?
The root folder of your revision
In CodeDeploy, what are “hooks”?
- Lifecycle events hooks that have a specific run order.
- Relates to different scripts you need to run during different stages of the deployment
In CodeDeploy’s appspec.yml, what are the three main parts and what do they do?
- OS
- What OS to run
- Files
- Source and destination for any files that should be copied across during the deployment
- Hooks
- Lifecycle events hooks that are run in a specific order known as Run Order
- Specifies all the scripts we want to run during the deployment, and in which stage of the deployment the should be run
What are the three main phases of a In-Place Deployment using CodeDeploy (EC2)?
- De-registering with the Load Balancer
- Installation
- Re-registering with a Load Balancer
In a In-Place Deployment using CodeDeployment, what three phases comes before installation (EC2)?
- BeforeBlockTraffic
- Tasks you want to run on the instance before they are de-registered from a Load Balancer
- BlockTraffic
- De-register instances from a Load Balancer
- AfterBlockTraffic
- Tasks you want to run on instances after they are de-registered from a Load Balancer
In a In-Place Deployment using CodeDeployment, what 7 phases comes during the installation step (EC2)?
- ApplicationStop
- Gracefully stop the application
- DownloadBundle
- CodeDeploy agent copies tha application reversion files to a temporary location
- BeforeInstall
- Pre-install scripts, e.g. backing up the current version, decrypting files
- Install
- Copy application reversion files to final location
- AfterInstall
- Post-install scripts, e.g. configuration, file permissions
- ApplicationStart
- Start any services that were stopped during ApplicationStop
- ValidatService
- Run tests to validate the service
In a In-Place Deployment using CodeDeployment, what three phases comes after installation (EC2)?
- BeforeAllowTraffic
- Tasks you want to run on the instances before they are registered with the Load Balancer
- AllowTraffic
- Register instances with a Load Balancer
- AfterAllowTraffic
- Tasks you want to run on the instances after they are registered with a Load Balancer
What three characteristics describes CodePipeline?
- Continuous Integration/Continuous Delivery service
- Orchestrates your end-to-end software release process based on a workflow you define - Automated
- Automatically triggers your pipeline as soon as a change is detected in your source code repository - Integrates with AWS and Third-Party tools
- CodeCommit, CodeBuild, CodeDepoly
- Lambda, CloudFormation, Elastic Beanstalk, Elastic Container Service
- Jenkins, GitHub
What is a container?
A virtual operating environment with everything the software needs to run.
- Includes libraries, system tools, code, and runtime.
- Allows applications to be built using independent stateless components or microservices running in multiple containers.
What is Elastic Container Service? Elastic Container Registry?
- Elastic Container Service:
- Container orchestration service.
- ECS will run your containers on clusters of virtual machines.
- Deploys containers from the images stored in ECR
- Elastic Container Registry:
- Registry for your container images
Name three Docker commands.
- docker build
- docker build -t myimagerepo
- builds the image - docker tag
- docker tag myimagerepo:latest .dkr.ecr.eu-west-1.amazonaws.com/myimagerepo:latest
- add a tag/alias to an image (above we added ‘latest’) - docker push
- docker push .dkr.ecr.eu-west-1.amazonaws.com/myimagerepo:latest
- pushes the image to the Elastic Container Service Repository where it can be accessed by Elastic Container Service
In CodeBuild, what is the file that defines build commands and settings used to run your build called?
buildspec.yml
In CodeBuild, how can you override the settings in buildspec.yml?
By adding your own commands in the console when launching the build. (by default CodeBuild is looking for a file called buildspec.yml)
If something goes wrong with a build, where can you find information about it?
Build logs appear in the CodeBuild console and you can also view the CodeBuild log in CloudWatch.
What is CloudFormation?
CloudFormation is used to manage, configure and provision AWS infrastructure as code.
What are the main sections of a CloudFormation templates file? What is it written in?
- Written in YAML or JSON
- Parameters
- Input custom values
- Conditions
- Provision resources based on conditions, for example based on the environment
- Resources
- The AWS resources to create
- Only mandatory section
- Mappings
- Custom mappings
- E.g. the AMI you want to use for a specific region
- Transforms
- Reference code located in S3, e.g. Lambda code, reusable snippets of code
- Specify the use of SAM
What is SAM?
- Serverless Application Model
- Used to define and provision serverless applications using CloudFormation
Name two SAM CLI command.
- sam package
- packages your application and uploads to S3
- sam deploy
- deploys your serverless application using CloudFormation
In CloudFormation, what is Nested Stacks?
- Allows you to re-use your CloudFormation code so we don’t need to do a copy/paste
- Used for frequently used configurations like for Load Balancers, web servers and application servers
- You create a CloudFormation template, store it in S3 and reference it in the Resources section as “stack”.
When using CodeCommit, how is the data/code protected in transit?
HTTPS or SSH