Dev Tools Flashcards

1
Q

What are the 6 sections of CloudFormation

A

AWSTEmplateFormationVersion - “2010-09-09” -> Internal AWS use.

Description - Comments about the Template itself.

Resources (MANDATORY) - AWS Resources to create

Parameters - Dyanminc Inputs

Mappings - Static Variables for Template

Outputs - What has been created

Conditions - Conditions to perform resource creation.

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

WHen to use CDK

A

CDK - Cloud Dev Kit sits on top of Cloud Formation and lets you build your own infrastructure using common programming languages such as java/python/.NET

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

Which type of credenytials CANNOT be used by CodeCommit ?

A

IAM username and password - IAM username and password credentials cannot be used to access CodeCommit.

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

How to stop long running CodeBuild jobs?

A

Enable CodeBuild timeouts

When possible, builds run concurrently. The maximum number of concurrently running builds can vary.

Builds are queued if the number of concurrently running builds reaches its limit. The maximum number of builds in a queue is five times the concurrent build limit.

A build in a queue that does not start after the number of minutes specified in its time out value is removed from the queue. The default timeout value is eight hours. You can override the build queue timeout with a value between five minutes and eight hours when you run your build.

By setting the timeout configuration, the build process will automatically terminate post the expiry of the configured timeout.

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

What does Transform in CloudFormation imply?

A

Presence of Transform section indicates it is a Serverless Application Model (SAM) template

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

What are the CodeDeploy hooks?

A

Start
ApplicastionStop
DOwnbloadBundle
BeforeINstall
Install
AfterInstall
ApplicatioSTart
ValidateService
End

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

apsec.yml v buildspec.yml

A

????

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

deployment to Elastic Beanstalk is taking a very long time due to resolving dependencies on all of your 100 target EC2 instances. what can you do to improve time.

A

Bundle the dependencies in the source code during the build stage of CodeBuild

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

What is CodeDeploy Agent

A

“CodeDeploy Agent”

The CodeDeploy agent is a software package that, when installed and configured on an instance, makes it possible for that instance to be used in CodeDeploy deployments. The CodeDeploy agent archives revisions and log files on instances. The CodeDeploy agent cleans up these artifacts to conserve disk space. You can use the :max_revisions: option in the agent configuration file to specify the number of application revisions to the archive by entering any positive integer. CodeDeploy also archives the log files for those revisions. All others are deleted, except for the log file of the last successful deployment.

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

Immutable deploy v blue green

A

The main difference is that in the immutable update, the new instances serve traffic alongside the old ones, while in the blue/green this doesn’t happen (you have an instant complete switch from old to new)

Blue/Green = new environment. New load balancer. DNS switch.

Immutable = new ASG alongside old one. Then terminates old one.

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

How does CodeBuild scale?

A

AWS CodeBuild is a fully managed build service in the cloud. CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy. CodeBuild eliminates the need to provision, manage, and scale your own build servers. It provides prepackaged build environments for popular programming languages and build tools such as Apache Maven, Gradle, and more. You can also customize build environments in CodeBuild to use your own build tools. CodeBuild scales automatically to meet peak build requests.

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

If CloudFormation doesnt support a resource, how do you get around it ?

A

Use Custom Resource

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

You want to create a CloudFormation stack in multiple AWS accounts in multiple AWS Regions. What is the easiest way to achieve this?

A

CF StackSets

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

What are Cloud FOrmation PSUEDO PARAMETERS

A

These are fixed parameters available by default. Examples:

AWS::AccountId
AWS::Region
AWS::

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

How to use CF Mappings?

A

Mappings are like dictionaries

Parameters:
MyType:
Type: String
AllowedValues:
- t2.micro
- t3.micro
Default: t2.micro

InstanceType: !Ref MyType

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

How to use CF Outputs as inputs to other resources ?

A

Export and ImportValue

Outputs:
BlahBlah:
Description: This is some output
Value: !Ref MyCompanySG
Export:
Name: SSHSG

This can then be referenced from other resource using the !ImportValue function

SecurityGroups:
!ImportValule SSHSG

18
Q

CF Intrisic Functions

A

Build in functions such as

!GetAtt -> Return specific attributes of a resource. !GetAtt MYE2Instance.AvaialibiltyZone

!FindInMap [map, TopKey, SecondKey]

!ImportValue - Import values

!Bas64 - COnver string to Base64. Eg to pass encoded data to EC2 instance.

Conditions And/Equals/If/Not/Or

19
Q

CF Deletion Policy

A

Control what happens when the CF template is deleted. Default DeletionPolicy is Delete.

Note: S3 buckets will FAIL if you try to delete the S3 without first emptying it.

DeletionPolicy: Retain -> Prevents a pacific resource from being deleted if template is destroyed.
DeletionPolicy: Snapshot -> Create a final snapshot before deleting resource

20
Q

If user needs to select a value from Cloud FOrmation from list of approved types ……

A

AllowedValues inside Parameter

21
Q

Lookup a value from dictionary such as AMI type in CF ?

A

Mappings and !FindInMap[ myMap, Key1, Key2]

22
Q

aws cli useful commands

A

S3
aws s3 ls
aws s3 cp s3://steve-app-bucket/demo.py /apps/demo.py

Lambda
aws lambda list-functions
Sync Call
aws lambda invoke –function-name demo-lambda-python –cli-binary-format raw-in-base64-out –payload ‘{“key1”: “lilly”, “key2”: “olivia”, “key3”:”jack”}’ response.json

Asycn Call
aws lambda invoke –function-name demo-lambda-python –cli-binary-format raw-in-base64-out –payload ‘{“key1”: “lilly”, “key2”: “olivia”, “key3”:”jack”}’ –invocation-type Event response.json

SQS
aws sqs list-queues
aws sqs send-message –queue-url https://sqs.eu-west-2.amazonaws.com/8681…. –message-body “Hello Steve”
aws sqs receive-message –queue-url https://sqs.eu-west-2.amazonaws.com/8681
aws sqs delete-message –queue-url xxxxxx –receipt-handle yyyyyy

Iam
aws iam list-users

ec2
aws ec2 monitor-instances –instance-ids i-1234567890abcdef0 - MOnitor ec2 instance(s)

23
Q

Codedeploy inplace run order

A

Application Stop -> Before Install -> Application Start -> ValidateService

24
Q

CodeDEploy In-Place v BlueGreen deploy

A

In-place Deployment

The application on each instance in the deployment group is stopped, the latest application revision is installed, and the new version of the application is started and validated. You can use a load balancer so that each instance is deregistered during its deployment and then restored to service after the deployment is complete.

Blue/green Deployment

With a blue/green deployment, you provision a new set of instances on which CodeDeploy installs the latest version of your application. CodeDeploy then re-routes load balancer traffic from an existing set of instances running the previous version of your application to the new set of instances running the latest version. After traffic is re-routed to the new instances, the existing instances can be terminated.

25
Q

CDK order

A

cdk init app –language (java/python/typescript/…)

Cdk synth – Creates the CloudFormation template

Cdk deploy

26
Q

Deployment Strategies

A

All at once – Deploy the new version to all instances simultaneously. All instances in your environment are out of service for a short time while the deployment occurs.

Rolling – Deploy the new version in batches. Each batch is taken out of service during the deployment phase, reducing your environment’s capacity by the number of instances in a batch.

Rolling with additional batch – Deploy the new version in batches, but first launch a new batch of instances to ensure full capacity during the deployment process.

Immutable (doesn’t update, creates new ones)) – Deploy the new version to a fresh group of instances by performing an immutable update. Similar to Blue/Green but reatains same LB, just a new ASG. It also has the additional advantage of a quick and safe rollback in case the deployment fails.

Blue/Green - creates a completely new environment then switches all traffic to new environment so zero downtime.

Traffic splitting / Canary– Deploy the new version to a fresh group of instances and temporarily split incoming client traffic between the existing application version and the new one.

27
Q

in CF, do exported outputs names need to be unique across Regions?

A

NO. But they must be unique WITHIN the same Regio.

28
Q

What is the run order of the hooks for in-place deployments

A

STOP
Before Install
START
ValidateService

29
Q

How do you define LAMBDA functions in CloudFormation.

A

There are two ways:

Upload all the code as a zip to S3 and refer the object in AWS::Lambda::Function block

Write the AWS Lambda code inline in CloudFormation in the AWS::Lambda::Function block as long as there are no third-party dependencies