AWS 15, 16, 17 Flashcards

1
Q

How do we enable Cross Account in CodeCommit?

A

Use IAM Role in your AWS Account and use AWS STS (with AssumeRole API)

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

How can you trigger CodeCommit notifications?

A

AWS SNS, AWS Lambda or AWS CloudWatch Event Rules

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

What are artifacts in CodePipeline?

A

Artifacts are stored in Amazon S3 and passed on to the next stage. It is the result of the previous stages action.

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

What must you do before you can interact (clone, pull, push, etc) with a CodeCommit repository?

A

You must generate credentials for either HTTPS or SSH in IAM for the User you are using.

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

What is the CodePipeline service role?

A

It is an IAM role that allows CodePipeline to communicate with the services it needs to

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

Stages in CodePipeline cannot have multiple Action Groups, true or false?

A

False. Stages can have multiple action groups

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

How can we define our CodeBuild build instructions?

A

With a buildspec.yml file. Must be root of directory.

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

How can we speed up our building of an artifact in CodeBuild?

A

We can choose the cache option to store needed dependencies for our build

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

By default, your CodeBuild containers will be launched inside your VPC, true or false?

A

False. They will be launched outside. Therefore, it cannot access resources in a VPC. You must specify a VPC configuration.

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

What are the steps to make CodeDeploy work?

A

Each EC2 machine (or On Premise machine) must be running the CodeDeploy Agent;
The agent is continuously polling AWS CodeDeploy for work to do;
Application is pulled from GitHub or S3;
EC2 will run the deployment instructions;
CodeDeploy Agent will report success / failure of deployment on the instance

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

How are EC2 instances grouped in CodeDeploy?

A

They are grouped by deployment group (dev / test/ prod)

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

What is the order of the hooks in CodeDeploy?

A
ApplicationStop;
DownloadBundle;
BeforeInstall;
AfterInstall;
ApplicationStart;
ValidateService;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the two primary types of deployment targets for AWS CodeDeploy?

A

Set of EC2 instances with tags, or directly to an ASG. Can do a mix of both if needed/wanted/

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

Before we can do CodeDeploy with EC2 instances, what must we do?

A

Make sure the Instances have the CodeDeploy agent;
We must create two IAM roles. We need to create one for CodeDeploy to interact with other AWS services and create one for our EC2 so that it can access necessary resources.

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

What file must be present for your application in CodeDeploy?

A

appspec.yml ; Must be at root directory.

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

What are the two deployment types for CodeDeploy?

A

In-place and Blue/Green

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

What are the three provided deployment configurations for CodeDeploy Deployment Group?

A

AllAtOnce, OneAtATime, HalfAtATime

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

Regarding in-place deployments between CodeDeploy and an ASG, what happens to instances that are created after a deploy by the ASG?

A

CodeDeploy and ASG will go ahead and run a deployment on those instances

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

For a Blue/Green deployment in CodeDeploy with an ASG, what must we make sure we have?

A

We need an ELB. A new target group will be created to deploy the new instances and versions and health check them. Then the ELB will route to the new versions in the new target group. Will get rid of the old one.

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

If a rollback happens in CodeDeploy, what happens?

A

CodeDeploy redeploys the last known good revision as a new deployment. So we will get a new deployment id.

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

What is CodeStar?

A

It quickly builds a project with a CICD pipeline, repository, possible IDE, team member access and other project needs.

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

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

A

CodeBuild

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

Integrate SNS / Lambda with CodeCommit

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

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

A

AWS CloudWatch events that push to SNS

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

What are the use cases for SNS / Lambda notifications in CodeCommit?

A

Deletion of branches;
Trigger for pushes that happens in master branch;
Notify external Build System;
Trigger AWS Lambda functions to perform codebase analysis;

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

What are the use cases for CloudWatch Event Rules?

A

Trigger for pull request updates (created, updated, deleted, commented);
Commit comment events;

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

Setup an IAM Role in your account and tell him to use STS cross-account access to assume that role

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

How can we react to CodePipeline state changes?

A

AWS CloudWatch Events. We can have these create SNS notifications like failed pipelines and cancelled stages

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

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

A

AWS Cloud Trail

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

Your CodeBuild has failed. What isn’t a solution to troubleshoot what happened?
Look through Logs in AWS CloudWatch logs;
Look through Logs in AWS S3;
SSH into the CodeBuild container to debug from there;
Run CodeBuild locally to reproduce the build;

A

SSH into CodeBuild container. CodeBuild containers are deleted at the end of their execution. You can’t SSH into them, even while they’re running

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

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

A

ValidateService

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
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 the CodeDeploy agent

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

What is in-place deployment?

A

CodeDeploy will perform a rolling update across Amazon EC2 instances. We can specify the number of instances to be taken offline at a time.

34
Q

What is the Dockerrun.aws.json do for us in Elastic Beanstalk with Multi Docker Container?

A

It is used to generate the tasks definitions. Must be at the root of the source code.

35
Q

What are the Template components for CloudFormation?

A

Resources: your AWS resources declared in the template;
Parameters: the dynamic inputs for your template;
Mappings: the static variables for your template;
Outputs: References to what has been created;
Conditionals: List of conditions to perform resource creation;
Metadata;

36
Q

What is the AWS CloudFormation resource type reference form?

A

AWS::service-name::data-type-name (ex: AWS::EC2::Instance)

37
Q

How can you work around the AWS Services that are not yet supported in CloudFormation templates?

A

Use AWS Lambda Custom Resources

38
Q

How do we reference a parameter in AWS CloudFormation templates?

A

!Ref

39
Q

True or false, you can use parameters to reference resources in CloudFormation templates?

A

True. Say you create a new security group. We can reference that security group in the Instance resource declaration.

40
Q

What are Psuedo Parameters in CloudFormation templates?

A

They allow us to access values AWS and CloudFormation already know about such as Region, NoValue or maybe StackId

41
Q

What is the difference between mappings and parameters in CloudFormation template?

A

Mappings should be used when we know in advance all the values that can be taken and can be deduced from variables such as Region, AZ, AWS Account, Environment etc;

Use parameters when the values are really user specific

42
Q

What is the syntax for FindInMap

A

!FindInMap [MapName, TopLevelKey, SecondLevelKey]

43
Q

What are Outputs in CloudFormation template?

A

The Outputs section declares optional output values that we can import into other stacks (if you export them first)

44
Q

You can’t delete a CloudFormation stack that has outputs defined. Why not?

A

There is another CloudFormation stack that is using the outputs.

45
Q

What function do you use to import other StackFormation outputs?

A

Fn::ImportValue

46
Q

What do you get back if the FN::Ref function references a resource?

A

It returns the physical ID of the underlying resource (ex: EC2 ID)

47
Q

What is the Fn::Join syntax?

A

!Join [ delimiter, [ comma-delimited list of values ] ]

48
Q

What is a benefit of CloudWatch EC2 Detailed monitoring?

A

We can use detailed monitoring (for a cost) to get data on EC2 on a 1-minute period instead of the standard metric of “every 5 minutes”

49
Q

What is a high resolution custom metric in CloudWatch?

A

We can increase the metric resolution from the standard 1 minute to up to 1 second (StorageResolution API parameter);
Has higher cost;

50
Q

What is the API call for CloudWatch to send Metric Data?

A

PutMetricData

51
Q

What is the CloudWatch logs storage architecture?

A

There are log groups, usually representing an application;

Log stream, instances within application / log files / containers

52
Q

If logs are not sending to AWS CloudWatch, what could be a possible issue?

A

IAM permissions may not be correct

53
Q

By default, your logs will automatically go from your EC2 instance to your CloudWatch logs, true or false?

A

False. We must have a CloudWatch agent running on the EC2 instance.

54
Q

What is the difference between Logs Agent and the Unified Agent?

A

Logs Agent is the old agent and Unified Agent is the newer one;
Unified agent can grab addition system-level metrics and send them to CW;
There is also centralized configuration using the SSM Parameter Store

55
Q

CoudWatch log metric filters will retroactively grab data from logs, true or false?

A

False.

56
Q

We have created a Cloud Watch metric filter monitoring EC2 server errors. We want to notify developers when there is a certain number of errors. What can we do?

A

We can set a CloudWatch alarm on top of our metric filter, and send notifications to SNS

57
Q

What is the difference between EventBridge’s default event bus and partner event bus?

A

The default event bus are events generated by AWS services (CloudWatch Events);
The Partner event bus are events recieved from SaaS services or applications (3rd Party)

58
Q

How do we enable X-Ray?

A

1) In your code, we must import the AWS X-Ray SDK with code modifications
2) Install the X-Ray daemon or enable X-Ray AWS Integration

59
Q

If X-Ray is not working on an EC2 instance what could be 2 possible causes?

A

Ensure the IAM Role has proper permissions;

Ensure the EC2 Instance is running the X-Ray Daemon

60
Q

If X-Ray is not working in AWS Lambda what could be 2 possible causes?

A

1) Ensure it has an IAM execution role with proper policy

2) Ensure that X-Ray is imported in the code

61
Q

What is X-Ray Instrumentation in code?

A

It is installing the X-Ray SDK, a little configuration and it gives you the ability to customize and annotate the data that the SDK sends to X-Ray

62
Q

What are annotations in X-Ray?

A

They are key value pairs that we use to index traces and use with filters

63
Q

What is X-Ray sampling?

A

It allows you to control the amount of data that is recorded.
We define a reservoir, which ensures a minimum amount of data is collected;
We define a rate, which is additional data beyond the reservoir size

64
Q

What are the X-Ray Write APIs?

A

PutTraceSegments: Uploads segment documents to AWS X-Ray
PutTelemetryRecords: Used by the AWS X-Ray daemon to upload telemetry
GetSamplingRules: Retrieve all sampling rules (to know what/when to send)

65
Q

What is the difference between BatchGetTraces and GetTraceSummaries in the X-Ray Read API?

A

GetTraceSummaries will retrieve IDs and annotations for traces available for a specified time frame using an optional filter.
To get the full traces, we can pass the IDs to BatchGetTraces and receive a collection of segment documents that originates from a single request.

66
Q

What is a trace, segment and sub-segment in X-Ray?

A

A segment is a section of data about the compute resources running application logic when a process happens.
A sub-segment is a smaller chunk of the segment process.
A trace collects all the segments generated by a single request.

67
Q

Elastic Beanstalk comes with the X-Ray daemon and runs it automatically, true or false?

A

False. It comes with the daemon but must be configured with a .config file in the .ebextension folder or in the EB console;
Make sure the instance profile has correct IAM permissions to write to X-Ray;
Instrument your application code with the X-Ray SDK

68
Q

X-Ray daemon is provided for Multicontainer Docker, true or false?

A

False

69
Q

How can we configure X-Ray and ECS?

A

You can configure a container to be a “deamon container” either as a container on each EC2 instance or as a side car (running a deamon container alongside each app container)

70
Q

How do we configure X-Ray and Fargate?

A

The side car pattern. We can link the deamon container and the application container together. he have to do the side car pattern because we don’t have control over the instances

71
Q

What is CloudTrail best used for?

A

Monitoring user, account and resource activity regarding AWS Services and changes to AWS infrastructure

72
Q

We’d like to have CloudWatch Metrics for EC2 at a 1 minute rate. What should we do?

A

Enable Detailed Monitoring;

Basic Monitoring is metrics every five minutes

73
Q

We want more prompt scaling with ASG. What should we do in CloudWatch?

A

Enable detailed monitoring. It will find metrics quicker and therefor scale quicker.

74
Q

High Resolution Custom Metrics have a minimum resolution of …

A

1 second

75
Q

To send a custom metric to CloudWatch, which API should we use?

A

PutMetricData

76
Q

An Alarm on a High Resolution Metric can be triggered as often as

A

10 seconds

77
Q

CloudWatch logs automatically expire after 7 days by default, true or false?

A

False. They never expire by default

78
Q

All of a sudden, your CodePipeline breaks because it says it cannot find the target Elastic Beanstalk environment to deploy your application to. What should you do to find the root cause of this problem?

A

Look in CloudTrail. There is likely a “delete” event in Elastic Beanstalk.

79
Q

How should you configure the XRay daemon to send traces across accounts?

A

Create a role on another account, and allow a role in your account to assume that role.

80
Q

You would like to index your XRay traces in order to search and filter through them efficiently. What should you use?

A

Annotations

81
Q

GetSamplingRules is a GET call, true or false?

A

False, it is a POST call

82
Q

What is the default X-Ray sampling configuration for the SDK?

A

The reservoir is the first request every second and five percent additional requests