Development with AWS Services Flashcards

1
Q

Which of the following approaches can improve the performance of your Lambda function?

A

-Establish your database connections from within the Lambda execution environment to enable connection reuse

Establishing connections within the execution environment allows them to be reused next time the function is invoked which saves time. Only including the libraries you need will minimise the time taken for Lambda to unpack the deployment package. Lambda Best Practices Lambda Execution Model

-Only include the libraries you need to minimize the size of your deployment package

Establishing connections within the execution environment allows them to be reused next time the function is invoked which saves time. Only including the libraries you need will minimise the time taken for Lambda to unpack the deployment package.

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

What is the name of the SAM template property that defines the point in a Lambda function’s code where execution begins?

A

Handler

The Handler property specifies the Lambda function’s entry point. For example, if the Lambda function was written in Python, and Handler was set to lambda_function.lambda_handler, execution would begin with the lambda_handler function, contained within the lambda_function.py file.

Runtime refers to the language in which the Lambda function is written. For example, python3.6 or nodejs6.10, etc.

Source and Index are not valid SAM template properties.

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

Which of the following Elastic Beanstalk deployment approaches allow you to maintain full capacity while performing an update?

A

-Immutable

Rolling with Additional Batch and Immutable both involve provisioning new servers to ensure capacity is not reduced. All At Once means the application will be offline for the duration of the update. Performing a Rolling Update without an additional batch of servers means a reduction in capacity.

-Rolling With Additional Batch

Rolling with Additional Batch and Immutable both involve provisioning new servers to ensure capacity is not reduced. All At Once means the application will be offline for the duration of the update. Performing a Rolling Update without an additional batch of servers means a reduction in capacity.

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

A DynamoDB table is configured in provisioned throughput mode with 500 RCU and 100 WCU. How much data can be read and written to the table each second?

A

2000 KB for strongly consistent read operations, 4000 KB for eventually consistent read operations, 100 KB for write operations.

One read capacity unit is equivalent to one strongly consistent read per second, or two eventually consistent reads per second, for an item up to 4 KB in size. One write capacity unit is equivalent to one write per second for an item up to 1 KB in size. Therefore, 500 RCU is equivalent to: 1) 500 RCU * 4KB = 2000 KB per second for strongly consistent read operations; 2) 500 RCU * 4KB = 2000 KB per second * 2 = 4000 KB per second for eventually consistent read operations; 3) 100 WCU * 1KB = 100 KB per second for write operations.

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

An organization wishes to use CodeDeploy to automate its application deployments. The organization has asked a developer to advise on which of their services can integrate with CodeDeploy.

Which of the following services can the developer advise are compatible with CodeDeploy managed deployments?

A

-EC2

CodeDeploy supports EC2, ECS (both EC2 and Fargate), Lambda, and on-premise servers.

-ECS Fargate

CodeDeploy supports EC2, ECS (both EC2 and Fargate), Lambda, and on-premise servers. CodeDeploy - supported compute platforms

-Lambda

CodeDeploy supports EC2, ECS (both EC2 and Fargate), Lambda, and on-premise servers.

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

What is the maximum size of an item in a DynamoDB table?

A

The maximum item size in DynamoDB is 400 KB.

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

You are working on a Serverless application written in Node.js. You updated the Node.js code and uploaded a new zip file containing your code to Lambda. Your application references the function using the alias “Prod”, however it not seem to be using the new code. Which of the following is likely to fix this?

A

You need to update the alias to reference the new version of your function

The problem is that the application is referencing the function using an alias pointing to a previous version of the code. When you use versioning in AWS Lambda, you can publish one or more versions of your function. So that you can use different variations of your Lambda function in your development workflow such as development, beta, and production. Lambda also supports creating aliases for each of your Lambda function versions. Conceptually, an AWS Lambda alias is a pointer to a specific Lambda function version. You can update aliases to point to different versions of functions.

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

You are running a large distributed application using a mix of EC2 instances and Lambda. Your EC2 instances are spread across multiple availability zones for resilience and are configured inside a VPC. You have just developed a new Lambda function which you are testing. However, when you try to complete the testing, your function cannot access a number of application servers which are located in the same private subnet. Which of the following could be a possible reason for this?

A

The function execution role does not include permission to connect to the VPC

To connect to a VPC, your functions execution role must have the following permissions: ec2:CreateNetworkInterface, ec2:DescribeNetworkInterfaces, ec2:DeleteNetworkInterface. These permissions are included in the AWSLambdaVPCAccessExecutionRole managed policy.

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

A developer is configuring CodeDeploy to deploy an application to an EC2 instance. The application’s source code is stored within AWS CodeCommit.

What permissions need to be configured to allow CodeDeploy to perform the deployment to EC2?

A

Create an IAM policy with an action to allow codecommit:GitPull on the required repository. Attach the policy to the EC2 instance profile role.

CodeDeploy interacts with EC2 via the CodeDeploy Agent, which must be installed and running on the EC2 instance. During a deployment the CodeDeploy Agent running on EC2 pulls the source code from CodeCommit. The EC2 instance accesses CodeCommit using the permissions defined in its instance profile role; therefore, it is the EC2 instance itself that needs CodeCommit access.

The specific CodeCommit permission needed to pull code is codecommit:GitPull.

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

An IAM user with programmatic access wants to get information about specific EC2 instances on the us-east-1 region. Due to strict policy, the user was compelled to use the describe-instances operation using AWS Command Line Interface (CLI). He wants to check whether he has the required permission to initiate the command without actually making the request.

Which of the following actions should be done to solve the problem?

A

Add the –dry-run parameter to the describe-instances command

The –dry-run parameter checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRun-Operation. Otherwise, it is UnauthorizedOperation.

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

A serverless architecture running a state machine is composed of multiple Lambda functions invoking one another. The development team has to make significant code changes whenever they update the state machine. The team wants to improve its workflow by refactoring the architecture.

Which service should the team use?

A

AWS Step Functions

Step Functions automatically triggers and tracks each step, and retries when there are errors so your application executes in order and as expected. With Step Functions, you can craft long-running workflows such as machine learning model training, report generation, and IT automation.

You can manage the coordination of a state machine in Step Functions using the Amazon States Language. The Amazon States Language is a JSON-based, structured language used to define your state machine, a collection of states, that can do work (Task states), determine which states to transition to next (Choice states), stop execution with an error (Fail states), and so on.

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

A developer is writing a custom script that will run in an Amazon EC2 instance. The script needs to access the local IP address from the instance to manage a connection to an application outside the AWS Cloud. The developer found out that the details about an instance can be viewed by visiting a certain Uniform Resource Identifier (URI).

Which of the following is the correct URI?

A

http://169.254.169.254/latest/meta-data/

To view all categories of instance metadata from within a running instance, use the http://169.254.169.254/latest/meta-data/ URI.

Note that the IP address 169.254.169.254 is a link-local address and is valid only from the instance.

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

A transcoding media service is being developed on Amazon Cloud. Photos uploaded to Amazon S3 will trigger a Lambda function. The Lambda function will cause the Step Functions to coordinate a series of processes that will do the image analysis tasks. The input of each function should be preserved on the result to conform to the application’s logic flow.

What should the developer do?

A

Declare a ResultPath field filter on the Amazon States Language specification.

Out of these field filters, the ResultPath field filter is the only one that can control input values and its previous results to be passed to the state output.

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