Refactoring

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A developer is instructed to configure a worker daemon to queue messages based on a specific schedule using a worker environment hosted in Elastic Beanstalk. Periodic tasks should be defined to automatically add jobs to your worker environment's queue at a regular interval. Which configuration file should the developer add in the source bundle to meet the above requirement?

cron.yaml

A developer has a set of EC2 instances which runs the Amazon Kinesis Client Library to process a data stream in AWS. Based on the custom metrics, it shows that the instances are maxing out their CPU Utilization, and there are insufficient Kinesis shards to handle the rate of data flowing through the stream. Which of the following is the BEST course of action that the developer should take to solve this issue and prevent this situation from re-occurring in the future?

Increase both the instance size and the number of open shards.

A serverless application composed of Lambda, API Gateway, and DynamoDB has been running without any issues for quite some time. As part of the IT compliance of the company, a developer was instructed to ensure that all of the new changes made to the items in DynamoDB are recorded and stored to another DynamoDB table in another region. In this scenario, which of the following is the MOST ideal way to comply with the given requirements?

Use DynamoDB streams

A company that sells smart security cameras uses an S3 bucket behind a CloudFront web distribution to store its static content, which they share to their customers around the world. They recently released a new firmware update that is intended to be used only by its premium customers. Any unauthorized access should be denied and the user authentication process must have a minimal latency. How can a developer refactor the current set up to achieve this requirement with the MOST efficient solution?

Use Lambda@Edge and Amazon Cognito to authenticate and authorize premium customers to download the firmware update.

A developer is moving a legacy web application from their on-premises data center to AWS. The application is concurrently used by thousands of people and it stores the user session state in memory. Its on-premises server usually reaches 100% CPU Utilization every time there is a surge on the number of people accessing the application. Which of the following is the best way to re-factor the performance and availability of the application's session management once it is migrated to AWS?

Use an ElastiCache for Redis cluster to store the user session state of the application.

Using AWS SAM, a developer recently deployed a serverless application which consists of Lambda, API Gateway, Kinesis, and DynamoDB. The application has worked fine for a few days but lately, there were a lot of ProvisionedThroughputExceeded exceptions being returned by DynamoDB. The developer also noticed that there's a sudden increase in read capacity units (RCU) usage whenever this issue happens. How should the developer refactor the application to find items based on primary key values and use the LEAST amount of RCU?

Use the Query operation with eventual consistency reads

A Lambda function is sending data to an Aurora MySQL DB Instance in your VPC. However, you are getting a MySQL: ERROR 1040: Too many connections error whenever there is a surge in incoming traffic. Upon investigation, you found that your function is always creating a new database connection whenever it is invoked. Which of the following is the MOST suitable and scalable solution to overcome this problem?

Use the execution context in your function and add logic in your code to check if a connection exists before creating one.

An application is sending thousands of log files to an S3 bucket everyday. The request to retrieve the list of objects using the AWS CLI aws s3api list-objects command is timing out due to the high volume of data being fetched. In order to rectify this issue, you have to use pagination to control the number of results returned on your request. Which of the following parameters should you include in CLI command for this scenario?

--page-size and --max-items

A developer has recently deployed an application, which is hosted in an Auto Scaling group of EC2 instances and processes data from an Amazon Kinesis Data Stream. Each of the EC2 instance has exactly one KCL worker processing one Kinesis data stream which has 10 shards. Due to performance issues, the system operations team has reshard the data stream to increase the number of open shards to 20. How many number of running EC2 instances should you ideally keep to maintain application performance?

20

An augmented reality mobile game has a serverless backend composed of Lambda, DynamoDB, and API Gateway. Due to the surge of new players globally, there were a lot of delays in retrieving the player data. You are instructed by your manager to improve the game's performance by reducing the database response times down to microseconds. Which of the following is the BEST service to use that can satisfy this scenario?

Amazon DynamoDB Accelerator (DAX)

The infrastructure of your application is designed where a producer sends data to a consumer via HTTPS. The consumer can sometimes take a while to process the messages, which causes the newer messages to not be acknowledged immediately and therefore, results in unexpected timeouts. You decided to introduce an Amazon SQS standard queue into the system but the duplicate messages are still not being handled properly. What should you do in order for the messages to be durably delivered and prevent having duplicate messages?

Configure the producer to set deduplication IDs for the messages and create a FIFO queue as a replacement for the standard queue

You are managing a distributed system which is composed of an Application Load Balancer, SQS queue, and an Auto Scaling group of EC2 instances. The system has been integrated with CloudFront to better serve their clients around the globe. To improve the security of your in-flight data, you were instructed to establish an end-to-end SSL connection between your origin and your end users. How can you meet this requirement using CloudFront?

Configure the Origin Protocol Policy and Viewer Protocol Policy

A Software Engineer is developing an application which will be hosted on an EC2 instance and will read messages from a standard SQS queue. The average time that it takes for the producers to send a new message to the queue is 40 seconds. Which of the following is the MOST efficient way for the application to query the new messages from the queue?

Configure the SQS queue to use long polling

A developer is working on a photo-sharing application which can automatically add filters to the high-resolution images uploaded by its users. For every new image that the user uploads, it would be sent to an SQS queue and will be handled by an image processing application hosted in Lambda. The processed image would then be stored in an S3 bucket. If the upload was successful, the application will return a prompt telling the user that the upload is successful. However, the entire processing typically takes an average of 5 minutes to complete, which causes the application to become unresponsive. Which of the following is the MOST suitable and cost-effective option which will prevent your application from being unresponsive?

Configure the application to asynchronously process the requests and change the invocation type of the Lambda function to Event

An application is hosted in an Amazon ECS Cluster which uses an RDS database. You noticed that the application performance slows down whenever there is a surge in requests that use the same SQL read queries. This has prompted you to optimize the queries of your application to improve performance, however, the problem still persists even after applying the change. Which of the following can you do to resolve this performance issue?

Create Read Replicas and implement database caching using Elasticache

An online magazine is deployed in AWS and uses an Elastic Load Balancer, an Auto Scaling group of EC2 instances, and an RDS MySQL Database. Some of the readers are complaining about the website's sluggish performance when loading the articles. Upon checking, there is a high number of read operations in the database which affects the website's performance. Which of the following actions should you do to quickly resolve the issue with minimal cost and code change?

Create an RDS Read Replica instance and configure the application to use this for read queries.

A clickstream application is using Amazon Kinesis Data Stream for real-time processing. PutRecord API calls are being used by the producer to send data to the stream. However, there are cases where the producer was intermittently restarted while doing the processing, which resulted to sending the same data twice to the stream. This inadvertently causes duplication of entries in the data stream which affects the processing of the consumers. Which of the following should you implement to resolve this issue?

Embed a primary key within the record

An application hosted in an Amazon ECS Cluster processes a large stream of data and stores the result to a DynamoDB table. There is an urgent requirement to detect new entries in the table then automatically trigger a Lambda function to run some tests to verify the processed data. Which of the following options can satisfy the requirement with minimal configuration?

Enable DynamoDB Streams to detect the new entries and automatically trigger the Lambda function.

You have an Amazon Kinesis data stream which has 20 open shards and 5 EC2 instances running as Kinesis Client Library (KCL) workers. Upon monitoring the metrics of your application in CloudWatch, it shows that your EC2 workers are consuming all of their CPU resources when processing the shards. Which of the following is the BEST solution to optimize your application and prevent workers from maxing out their CPU resources?

Launch an additional 15 instances

You are managing a real-time fraud detection application which ingests a stream of data using Amazon Kinesis. The systems works well with millisecond end-to-end latency but the allocated shards are way underutilized based on the performance data in CloudWatch. Which of the following is the MOST suitable solution to reduce the cost and capacity of your stream?

Merge cold shards

A reporting application is hosted in Elastic Beanstalk and uses DynamoDB as its database. If a user requests for data, it scans the entire table and returns the requested data. In the coming weeks, it is expected that the table will grow due to the surge of new users and requested reports. Which of the following should be done as a preparation to improve the performance of the application with minimal cost?

Reduce page size and use query operations instead

A website is hosted in an Auto Scaling group of EC2 instances behind an Application Load Balancer. It also uses CloudFront with a default domain name to distribute its static assets and dynamic contents. However, the website has a poor search ranking as it doesn't use a secure HTTPS/SSL on its site. Which are the possible solutions that the developer can implement in order to set up HTTPS communication between the viewers and CloudFront?

Set the Viewer Protocol Policy to use HTTPS Only and Redirect to HTTP to HTTPS

A real-time IoT device monitoring application is using Amazon Kinesis Data Stream to ingest data with several EC2 instances used for processing. The developer noticed that the rate of data flow in the stream is steadily growing which means that the stream's capacity must also be increased to maintain peak performance. What should the developer do to increase the capacity of the stream?

Split every shard in the system

A Lambda function downloads a file, with a size of 55 MB, from an external repository every time it is invoked. This causes the function to time out intermittently which greatly affects your serverless application. How should you refactor the function to solve this issue?

Store the file in the /tmp directory of the execution context and reuse it on succeeding invocations.

A DynamoDB table has several top-level attributes such as id, course_id, course_title, price, rating and many others. The database queries of your application returns all of the item attributes by default but you only want to fetch specific attributes such as the course_id and price per request. As the developer, how can you refactor your application to accomplish this requirement?

User projection expression

You have an AWS account, with an ID of 061218980612, which is used by the different departments of your company. You used the AWS CLI command iam create-account-alias --account-alias finance-dept to create a user-friendly identifier for your finance department. Which of the following is a valid sign-in page URL for your AWS account?

https://finance-dept.signin.aws.amazon.com/console

A developer has enabled API Caching on his application endpoints in Amazon API Gateway. For testing purposes, he wants to fetch the latest data, and not the cache data, whenever he sends a GET request with a Cache-Control: max-age=0 header to a specific resource. Which of the following policies will allow him to invalidate the cache for requests?

{ "Version": "2012-10-7", "Statement": [ { "Effect": "Allow", "Action": [ "execute-api:InvalidateCache" ], "Resource": [ "arn:aws:execute-api..." ] } ] }


Ensembles d'études connexes

Conduction, Convection, Radiation

View Set

Chapter 3 - Investments in Debt & Equity Securities

View Set

Skin Health related to the Aging Adult

View Set

Mastering Chemistry Tro Chapter 10

View Set

Gastroenterología / Cirugía General

View Set

Day 4 Part 1: Immunology and Adaptive Immunity

View Set