Developer Theory Flashcards

1
Q

What does CI/CD stand for and what does the different parts mean? Which AWS service is connected to what part?

A
  1. Continuous Integration
    - Integrating or merging the code changes frequently (at least once per day).
    - Think CodeCommit
  2. Continuous Delivery
    - Automating the build, test and deployment functions
    - Think CodeBuild and CodeDeploy
  3. 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe CodeCommit’s three main characteristics.

A
  1. Centralize Code Repository
    - A place to store source code, binaries, libraries, images, HTML files, etc.
    - Base on Git
  2. Enables Collaboration
    - Manages updates from multiple users
  3. Version Control
    - Tracks and manages code changes.
    - Maintains version history
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the two ways to perform a code deploy using CodeDeploy?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the config file for CodeDeploy called?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Where is CodeDeploy’s appspec.yml located?

A

The root folder of your revision

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In CodeDeploy, what are “hooks”?

A
  • Lifecycle events hooks that have a specific run order.

- Relates to different scripts you need to run during different stages of the deployment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In CodeDeploy’s appspec.yml, what are the three main parts and what do they do?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the three main phases of a In-Place Deployment using CodeDeploy (EC2)?

A
  • De-registering with the Load Balancer
  • Installation
  • Re-registering with a Load Balancer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In a In-Place Deployment using CodeDeployment, what three phases comes before installation (EC2)?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In a In-Place Deployment using CodeDeployment, what 7 phases comes during the installation step (EC2)?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In a In-Place Deployment using CodeDeployment, what three phases comes after installation (EC2)?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What three characteristics describes CodePipeline?

A
  1. Continuous Integration/Continuous Delivery service
    - Orchestrates your end-to-end software release process based on a workflow you define
  2. Automated
    - Automatically triggers your pipeline as soon as a change is detected in your source code repository
  3. Integrates with AWS and Third-Party tools
    - CodeCommit, CodeBuild, CodeDepoly
    - Lambda, CloudFormation, Elastic Beanstalk, Elastic Container Service
    - Jenkins, GitHub
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a container?

A

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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Elastic Container Service? Elastic Container Registry?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Name three Docker commands.

A
  1. docker build
    - docker build -t myimagerepo
    - builds the image
  2. 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’)
  3. 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

In CodeBuild, what is the file that defines build commands and settings used to run your build called?

A

buildspec.yml

17
Q

In CodeBuild, how can you override the settings in buildspec.yml?

A

By adding your own commands in the console when launching the build. (by default CodeBuild is looking for a file called buildspec.yml)

18
Q

If something goes wrong with a build, where can you find information about it?

A

Build logs appear in the CodeBuild console and you can also view the CodeBuild log in CloudWatch.

19
Q

What is CloudFormation?

A

CloudFormation is used to manage, configure and provision AWS infrastructure as code.

20
Q

What are the main sections of a CloudFormation templates file? What is it written in?

A
  • 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
21
Q

What is SAM?

A
  • Serverless Application Model

- Used to define and provision serverless applications using CloudFormation

22
Q

Name two SAM CLI command.

A
  • sam package
  • packages your application and uploads to S3
  • sam deploy
  • deploys your serverless application using CloudFormation
23
Q

In CloudFormation, what is Nested Stacks?

A
  • 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”.
24
Q

When using CodeCommit, how is the data/code protected in transit?

A

HTTPS or SSH

25
Q

In CodeCommit, how can I set up to be notified if there is a change in the code?

A

You can configure notifications using SNS and CloudWatch to send notifications to subscribers when certain events happens in your CodeCommit repository.

  • e.g. when somebody does a pull request, closes a pull request, or comments on a pull request
  • in CodeCommit you set up a CloudWatch event rule and an SNS topic for people to subscribe to
  • Note: I think the above is what they say in the video, but in AWS documentation it seems like CloudWatch has nothing to do with the Notifications, only SNS.
  • I think that it might be possible (if I understand the documentation correctly) that you can use EventBridge (CloudWatch Events-ish?) to to route data to SNS, and thereby using both EventBridge and SNS to get notifications when there are changes in CodeCommit. But, it does seem to be some extra work comparing to simply specifying an SNS topic under “Notifications” in CodeCommit (even though this easier option seems to be more limited).
26
Q

Does CodeDeploy work with EC2, Lambda and On-premises?

A

Yes.

27
Q

What is the Appspec for CodeDeploy written in?

A
  • YAML if it is for EC2 or on-premises systems
  • YAML or JSON is you are working with Lambda
  • The file structure depends on whether you are deploying to Lambda or EC2
28
Q

CodeDeploy: name three types of scripts that you might want to run during a deployment.

A
  1. Unzip files
    - Unzip files prior to deployment
  2. Run tests
    - Run functional tests on a newly deployed application
  3. Deal with Load Balancing
    - De-register and re-register instances with a Load Balancer
29
Q

How does CodeDeploy know what EC2 instance it should deploy the application to?

A

The EC2 instance must have a tag, and when you create a deployment group in CodeDeploy (that your application should be deployed to) you simply specify the tag of the EC2 instance you want to deploy to.

30
Q

What are the two options to run containers in Elastic Container Service?

A
  1. Clusters of Virtual Machines
    - ECS will run your containers on clusters of EC2 instances.
    - Use if you want to control the installation, configuration and management of your compute environment
  2. Fargate for Serverless
    - Use Fargate for Serverless containers and you don’t need to worry about the underlying EC2 instances.
31
Q

What is the CloudFormation template written in?

A

YAML or JSON

32
Q

What does it cost to use CloudFormation?

A

Nothing, you only pay for the resources you create.

33
Q

You upload the CloudFormation template to CloudFormation, but where is it stored?

A

S3

34
Q

What is a CloudFormation stack?

A

All the resources that will be (/has been?) deployed by CloudFormation (from the template)

35
Q

If something fails during the creation of a CloudFormation stack, is it rolled back by default?

A

Yes, the entire stack is per default rolled back. This can be changed. Disabling rollback can be useful for example is you want to debug a stack that is a constantly failing.

36
Q

Which element is the only mandatory in a CloudFormation Nested Stack?

A

TemplateURL. This has to point to a template in a S3 bucket

37
Q

In what part of of a CloudFormation template can you reference a Nested Stack?

A

In the Resource section, using the type “Stack” (“AWS::CloudFormation::Stack”).

38
Q

You are using CodePipeline to automatically deploy your code every time there is a commit to CodeCommit. If one of your automated tests fails, what happens?

A

The pipeline stops immediately because one stage has failed.