CI/CD Flashcards

1
Q

What is continuous integration?

A
  • Developer pushes code to an online repository
  • A testing / build server checks the code as soon as its pushed
  • The developer gets feedback about tests / build (pass/fail)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the benefits of continuous integration?

A
  • Find and fix bugs early
  • Deliver faster Deploy often
  • Happier developers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is continuous delivery?

A
  • Ensures that the software can be released reliably whenever needed
  • Ensures deployments happen often and are quick
  • Usually means auto deployment (CodeDeploy / Jenkins)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

At a high level, what are the 5 steps for CICD on AWS?

A
  1. Write and Push Code (CodeCommit)
  2. Build Code (AWS Code build)
  3. Test Code (AWS Code Build)
  4. Deploy Code (AWS CodeDeploy)
  5. Provision
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is AWS CodeCommit?

A

Version control system (think Git)

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

What are the benefits of a version control system (AWS CodeCommit, Github)?

A
  • Easily collaborate with other developers
  • Provides code backup
  • code is viewable and auditable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the characteristics of AWS CodeCommit?

A
  • private Git repos
  • No size limits on repositories
  • Fully managed
  • Highly available
  • Code only in AWS Cloud = increased security and compliance
  • Secure
  • Can be integrated in with other CI tools like CodeBuild or Jenkins
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the 2 ways to authenticate using CodeCommit?

A
  • SSH Keys
  • HTTPS
  • MFA (Multi Factor Authentication) can be enables for extra safety
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How should authorization be handled with CodeCommit?

A

IAM Policies should be used to manage user / roles rights to repos

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

How is encryption implemented on AWS Code Commit?

A
  • Repos are automatically encrypted at rest using KMS
  • Encrypted in transit (can only use HTTPs or SSH - both secure)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How are CodeCommit and Github different?

A
  • Security: CodeCommit uses AWS IAM users and roles
  • Hosted: managed and hosted by AWS
  • UI: CodeCommit UI is minimal copared to Github where UI is fully featured
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What AWS services can be used to provide notifications for CodeCommit?

A
  • Lambda functions
  • AWS SNS
  • AWS CloudWatch Event Rules
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Describe use cases for using AWS SNS / AWS Lambda notifications for AWS CodeCommit.

A
  • Deletion of branches
  • Trigger for pushes that happens in the master branch
  • Notify external build system
  • Trigger AWS Lambda function to perform codebase analysis (i.e make sure creds did not get commited to code).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Descibe use case(s) to use CloudWatch Event Rules for CodeCommit notifications.

A
  • Trigger for pull request updates
  • Commit COMMENT events
  • CloudWatch Event Rules goes into a SNS topic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is AWS CodePipeline?

A
  • AWS CodePipeline is a fully managed continuous delivery service that helps you automate your release pipelines for fast and reliable application and infrastructure updates.
  • Automates the build, test, and deploy phases of your release process every time there is a code change, based on the release model you define.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are AWS CodePipeline Artifacts?

A

Each stage in the pipeline can create “artifacts” that are stored into and retieved from an S3 bucket

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

Where do CodePipeline state changes happen?

A
  • In AWS CloudWatch events.
  • These events can create SNS notifications (i.e if pipeline fails)
18
Q

What happens if codePipeline fails? Where can you see information about the job?

A

If CodePipeline fails, the pipeline will stop and you can get information in the console.

19
Q

If CodePipeline can not perform an action, what should you check?

A

Check to make sure that the IAM Service Role attached has the correct permissions (IAM Policy)

20
Q

What service can be used to audit AWS API calls?

A

AWS CloudTrail

21
Q

What is AWS CodeBuild?

A
  • AWS CodeBuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy.
  • AWS alternative to Jenkins
  • Provides continous scaling (no need to provision or manage servers)
22
Q

In AWS CodeBuild, in what file are build instructions defined and where should this file be located?

A

Build instructions are defined in the buildspec.yml file which should be located in the root of the project.

23
Q

What is the end product of the CodeBuild Process?

A

Artifacts - get uploaded to S3 and are encryted with KMS.

24
Q

What are the four phases (specific commands to run) for AWS CodeBuild?

A
  1. Install: Install the dependencies needed for the build
  2. Pre-Build: Final commands to execute before the build
  3. Build: actual build commands
  4. Post-Build: finishing touches (i.e. zip folder to deploy)
25
Q

If using the AWS codePipeline, where would you secure secrets?

A

Secrets can be secured and referenced in the buildspec.yml file which is used in the CodeBuild stage.

26
Q

What is caching in AWS CodeBuild?

A
  • Helps save time for project builds
  • Stores reusable pieces of your build environment and uses them across multiple builds.
  • Your build project can use one of two types of caching:
    • Amazon S3 or local.
  • If you use a local cache, you must choose one or more of three cache modes:
    • source cache,
    • Docker layer cache, and
    • custom cache.
27
Q

Why would you choose to run CodeBuild on a local machine, and what does it require to do that?

A
  • Running CodeBuild locally provides opportunity for deeper troubleshooting.
  • Must have docker installed
  • Leverages the CodeBuild Agent.
28
Q

Can CodeBuild access resources that are inside a VPC?

A
  • Not by default.
  • By default CodeBuild containers are launched outside of your VPC, but you can specify a VPC configuration that would allow your build to access resources inside the VPC
29
Q

Why would you want CodeBuild to access resources that are inside a VPC?

A
  • integration tests
  • data query
  • internal load balancers
30
Q

What AWS Service is required to be running on host machines (i.e EC2 instances) in order for CodeBuild to work?

A
  • CodeDeploy Agent
  • This agent is continuosly polling AWS CodeDeploy for work to do
  • CodeDeploy sends an appspec.yml file with instructions on how to deploy code
31
Q

Will CodeDeploy provision resources needed for deployment?

A

No. Assumes that the EC2 instances already exist

32
Q

What are the AWS CodeDeploy primary components (9)?

A
  • Application
  • Compute Platform
  • Deployment Configuration
  • Deployment Group
  • Deployment Type
  • IAM Instance Profile
  • Application Revision
  • Service Role
  • Target Revision
33
Q

What are the 2 main sections of an appspec.yml file?

A

File section: how to source and copy from S3 / Github to filesystem

Hooks: set of instruction to deploy the new version

34
Q

What is the order of hooks in the appspec.yml file?

A
  1. ApplicationStop
  2. DownloadBundle
  3. BeforeInstall
  4. AfterInstall
  5. ApplicationStart
  6. ValidateService - how do we make sure the app is working - similar to a health check
  7. BeforeAllowTraffic
  8. AllowTraffic
  9. AfterAllowTraffic
35
Q

For CodeBuild, what are the deployment targets?

A
  • Set of EC2 instances with tags or
  • Directly to an Auto Scaling Group (ASG)
36
Q

What are rollbacks in CodeDeploy?

A
  • When you want/need to revert back to a previous version after a newer version has been deployed. This is usually because the new deployment version failed.
  • Can be automated
  • If a rollback happens, CodeDeploy redeploys the last known good revision as a new deployment.
37
Q

What is CodeStar?

A
  • Helps quickly create a CICD rast project for EC2, Lambda, Beanstalk
  • Like a one-stopshop for all CodePipleine abilities/stages plus the pipeline itself
  • One dashboard to view all components
  • Free service - pay for underlying services
38
Q

What is the appspec.yml file?

A

The application specification file (AppSpec file) is a YAML-formatted or JSON-formatted file used by CodeDeploy to manage a deployment.

39
Q

Are there size limits to CodeCommit repositories?

A

No

40
Q

In CodeBuild, what are the 3 modes of local cache, and how many do you need if caching localy?

A

You need one or more of the following:

  1. Source cache
  2. Docker layer cache
  3. Custom cache
41
Q

What is the difference between buildspec.yml and appspec.yml?

A
  • buildspect.yml controls the build process
  • appspec.yml controls/directs the deployment