CodePipeline, CodeBuild, CodeDeploy, CodeStar Flashcards

1
Q

CodeDeploy

A

we want to deploy our application automatically to many EC2 instances and we’re talking about hundreds of EC2 instances. So we have our V1 EC2 instances and we upgrade them to V2.

these instances are not managed by Elastic Beanstalk!!!! So everything we see with Elastic Beanstalk before there was one way to manage EC2 instances.

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

CodeDeploy instances

A

can be EC2 or or it can be an on premise machine runnning CodeDeploy agent. The agent is going to continuously poll for the AWS CodeDeploy service and ask it - do I have to deploy new stuff?

CodeDeploy will send the appspec.yml file and point to the application we pull from GitHub and S3 and EC2 will run the deployment instructions and CodeDeploy agent at the end of it will report whether or not
there was a success or a failure of the deployment on the instance.

appspec.yml has to be at the root of your source code

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

CodeDeploy EC2 instances are grouped by

A

by something called deployment group.

You can have dev, test, prod or just different segments.

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

You can integrate CodeDeploy with CodePipeline

A

and use the artifacts straight out of CodePipeline

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

CodeDeploy - for IAM profile you basically need to say

A

my EC2 instances must have the IAM role

necessary to pull the files from S3 and GitHub.

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

CodeDeploy appspec.yml (exam)

A
  1. File section: how to source and copy from S3 or GitHub to file system
  2. Hooks: instructions how to deploy new version
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

CodeDeploy appspec.yml (exam) Hooks order

A
  1. ApplicationStop (stop current version running)
  2. DownloadBundle (how do I download my new app)
  3. BeforeInstall (preparation before installation)
  4. AfterInstall (CleanUp?)
  5. ApplicationStart (how to start the app)
  6. ValidateService (perform helath check once started)
  7. BeforeAllowTraffic
  8. AllowTraffic
  9. AfterAllowTraffic

the order is important but not all of them are necessary

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

CodeDeploy Deployment Config

A
  1. How to deploy:
    - one at a time and if one fails deployment stops or
    - half at a time
    - all at once, but then no healthy host, downtime, so good for dev
    - your own configuration (for ex., with percentage)
  2. Failures
    - in case of deployment failures instances stay in failed state and when you re-deploy new deployment will first be deployed to failed instances
    - you can enable automated rollback for failures
  3. Deployment Targets

can be a set of EC2 instances with tags or an ASG or a mix of both

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

In Place Deployment

A

half at a time

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

Blue-Green Deployment

A

you have a load balancer. It’s attached to one auto scaling group of instances and then you’re going to create a new auto scaling group of instances and the load balancer is going to redirect to both these things
and then if everything succeed and they have instances, pass the health checks, then the first auto scaling group is deleted and the load balancer just talks to your V2.

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

there are 2 kinds of deployments in CodeDeploy (exam)

A
  1. in-place

2. blue-green

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

CodeDeploy Deployment to ASG (exam)

A
  1. in-place - the same as with EC2 instances, but in case your auto-scaling group does create instances during your deployment or afterwards, the auto-scaling group instances will automatically
    get the deployment.
  2. blue-green deployment: you will be having a new auto-scaling group created, and the settings will be copied over. And we can choose how long to keep the old instances. For the blue-green deployment to work,
    we must be using an elastic load balancer on top of our auto-scaling group.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

there is a way to specify automated rollback options in CodeDeploy. (exam)

A

you may wanna roll back when a deployment fails,

or you may want to roll back when a CloudWatch alarm is met and therefore something is wrong.

Or you can also disable rollbacks altogether and do not perform any rollbacks for any kind of deployments.

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

If somehow a rollback happens in CodeDeploy, (exam)

A

then CodeDeploy actually redeploys the last known
good revision as a new deployment.

So when a rollback happens, it’s actually a new deployment with the previous good known version.

And therefore, this new deployment will get a new version ID

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

CodeStar

A

an integrated solution that regroups all the bunch of CICD services we’ve seen. GitHub, CodeCommit for storing code, CodeBuild for billing the code, CodeDeploy, CloudFormation for deploying the code,
CodePipeline for handling the pipeline orchestration,
and CloudWatch.

a wrapper around everything and gives you a nice one stop dashboard for this. So it helps to create very quickly CICD-ready projects and that you can deploy them on EC2, on AWS Lambda, or on Elastic Beanstalk.
It supports many language.

there is an issue tracking integration that you can do with Jira if you use Jira in your enterprise, or GitHub Issues if you use GitHub as a source code repository.

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

CodeStar costs

A

It’s a free service.

You’re only going to pay for the underlying usage

of the other services,

17
Q

CodeStar customization

A

And there is limited customization, so you cannot edit every single setting of every single underlying service.
It’s meant to be simple and get you started very quickly.

18
Q

Which AWS Service helps you run automated test in your CICD?

A

CodeBuild

19
Q

You are looking to automatically trigger a code analysis at each commit in CodeCommit to ensure your developers haven’t committed secret credentials. How can you achieve this?

A

set up AWS SNS / Lambda integration in CodeCommit

20
Q

You want to send email alerts anytime pull requests are open or comments are added to commits in CodeCommit. You should use

A

CloudWatch Events

21
Q

CodeCommit supports the following authentication

A
  1. IAM credentials helper with AWS CLI and git
  2. SSH keys in user profiles
  3. HTTPS credentials in user profiles

does not support HTTP public access

22
Q

You want to give a colleague that has an IAM User in another AWS Account access to your CodeCommit repository. How should you achieve that?

A

set up an IAM role in your account and tell him to use STS cross-account access to assume this role

23
Q

Your CodePipeline hasn’t deployed code to Elastic Beanstalk even though you’ve pushed code to your CodeCommit repository. It used to work 10 minutes ago. What reason is the most likely to explain that situation?

A

CodeBuild stage failed some tests

24
Q

Your manager wants to receive emails when your CodePipeline fails in order to take action. How do you do it?

A

set up a cloudWatch Event rule

25
Q

Which AWS Services allow you to track and audit API calls made to and from CodePipeline?

A

AWS CloudTrail

26
Q

Your CodeBuild has failed. What is a solution to troubleshoot what happened?

A
  1. logs in CloudWatch
  2. Logs in S3
  3. run CodeBuild locally to reproduce the build

you can not! ssh into the CodeBuild container to debug from there because CodeBuild containers are deleted at the end of their execution (success or failed). You can’t SSH into them, even while they’re running

27
Q

You would like to improve the performance of your CodeBuild build. You realize that 15 minutes at each build is spent on pulling dependencies from remote repositories and that takes a while. What should you do to drastically speed up the build time?

A

change buildspec.yml to enable dependencies caching in S3

28
Q

You would like to deploy static web files to Amazon S3 automatically, after generating the static websites from markdown files. Which services should you use for this?

A

CodePipeline + CodeBuild

CodeBuild can run any commands, so you can use it to run commands including generating a static website and copy your static web files to Amazon S3.

29
Q

Which hook step should be used in appspec.yml file to ensure the application is properly running after being deployed?

A

ValidateService

30
Q

You’ve created a fleet of EC2 & on-premise instances and you’re trying to run your first CodeDeploy. It doesn’t work, why?

A

you’ve probably forgotten to install and start CodeDeploy agent

31
Q

You would like to have a one-stop dashboard for all the CICD needs of one of your projects. You don’t need heavy control of the individual configuration of each components in your CICD, but need to be able to get a holistic view of your projects. Which service do you recommend?

A

CodeStar