Amazon DVA-C02 Practice Test - Questions Answers, Page 18
List of questions
Question 171

A company has a web application that runs on Amazon EC2 instances with a custom Amazon Machine Image (AMI) The company uses AWS CloudFormation to provision the application The application runs in the us-east-1 Region, and the company needs to deploy the application to the us-west-1 Region
An attempt to create the AWS CloudFormation stack in us-west-1 fails. An error message states that the AMI ID does not exist. A developer must resolve this error with a solution that uses the least amount of operational overhead
Which solution meets these requirements?
Explanation:
Problem: CloudFormation can't find the custom AMI in the target region (us-west-1) because AMIs are region-specific.
Copying AMIs:
AMIs can be copied across regions, maintaining their configuration.
This approach minimizes operational overhead as the existing CloudFormation template can be reused with a minor update.
Updating the Template:
Modify the CloudFormation template in us-west-1 to reference the newly copied AMI's ID in that region.
Copying AMIs:https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html
CloudFormation Templates and AMIs:[invalid URL removed]
Question 172

A company is creating an application that processes csv files from Amazon S3 A developer has created an S3 bucket The developer has also created an AWS Lambda function to process the csv files from the S3 bucket
Which combination of steps will invoke the Lambda function when a csv file is uploaded to Amazon S3? (Select TWO.)
Explanation:
Amazon EventBridge:A service that reacts to events from various AWS sources, including S3. Rules define which events trigger actions (like invoking Lambda functions).
S3 Object Created Events:EventBridge can detect these, providing seamless integration for automated CSV processing.
S3 Lifecycle Rules:Allow for actions based on object age or prefixes. These can directly trigger Lambda functions for file processing.
Amazon EventBridge Documentation:https://docs.aws.amazon.com/eventbridge/
Working with S3 Event Notifications:https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html
S3 Lifecycle Configuration:https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html
Question 173

A developer is creating an AWS Lambda function in VPC mode An Amazon S3 event will invoke the Lambda function when an object is uploaded into an S3 bucket The Lambda function will process the object and produce some analytic results that will be recorded into a file Each processed object will also generate a log entry that will be recorded into a file.
Other Lambda functions. AWS services, and on-premises resources must have access to the result files and log file. Each log entry must also be appended to the same shared log file. The developer needs a solution that can share files and append results into an existing file.
Which solution should the developer use to meet these requirements?
Explanation:
Amazon EFS:A network file system (NFS) providing shared, scalable storage across multiple Lambda functions and other AWS resources.
Lambda Mounting:EFS file systems can be mounted within Lambda functions to access a shared storage space.
Log Appending:EFS supports appending data to existing files, making it ideal for the log file scenario.
Amazon EFS Documentation:https://docs.aws.amazon.com/efs/
Using Amazon EFS with AWS Lambda:https://docs.aws.amazon.com/lambda/latest/dg/services-efs.html
Question 174

A company hosts its application on AWS. The application runs on an Amazon Elastic Container Service (Amazon ECS) cluster that uses AWS Fargate. The cluster runs behind an Application Load Balancer The application stores data in an Amazon Aurora database A developer encrypts and manages database credentials inside the application
The company wants to use a more secure credential storage method and implement periodic credential rotation.
Which solution will meet these requirements with the LEAST operational overhead?
Explanation:
Secrets Management:AWS Secrets Manager is designed specifically for storing and managing sensitive credentials.
Built-in Rotation:Secrets Manager provides automatic secret rotation functionality, enhancing security posture significantly.
IAM Integration:IAM policies and roles grant fine-grained access to ECS Fargate, ensuring the principle of least privilege.
Reduced Overhead:This solution centralizes secrets management and automates rotation, reducing operational overhead compared to the other options.
AWS Secrets Manager:https://aws.amazon.com/secrets-manager/
Secrets Manager Rotation:https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html
IAM for Secrets Manager:https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_iam-policies.html
Question 175

A developer is testing a RESTful application that is deployed by using Amazon API Gateway and AWS Lambda When the developer tests the user login by using credentials that are not valid, the developer receives an HTTP 405 METHOD_NOT_ALLOWED error The developer has verified that the test is sending the correct request for the resource
Which HTTP error should the application return in response to the request?
Explanation:
HTTP Status Codes:Each HTTP status code has a specific meaning in RESTful APIs.
HTTP 405 (Method Not Allowed):Indicates that the request method (e.g., POST) is not supported for the specified resource.
HTTP 401 (Unauthorized):Represents a failure to authenticate, which is the appropriate response for invalid login credentials.
HTTP Status Codes:https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
Question 176

A company runs an application on AWS The application uses an AWS Lambda function that is configured with an Amazon Simple Queue Service (Amazon SQS) queue called high priority queue as the event source A developer is updating the Lambda function with another SQS queue called low priority queue as the event source The Lambda function must always read up to 10 simultaneous messages from the high priority queue before processing messages from low priority queue. The Lambda function must be limited to 100 simultaneous invocations.
Which solution will meet these requirements'?
Explanation:
Lambda Concurrency:The 'maximum concurrency' setting in event source mappings controls the maximum number of simultaneous invocations Lambda allows for that specific source.
Prioritizing Queues:Setting a lower maximum concurrency for the 'high priority queue' ensures it's processed first while allowing more concurrent invocations from the 'low priority queue'.
Batching:Batch size settings affect the number of messages Lambda retrieves from a queue per invocation, which is less relevant to the prioritization requirement.
Lambda Event Source Mappings:https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html
Lambda Concurrency:https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html
Question 177

A developer deployed an application to an Amazon EC2 instance The application needs to know the public IPv4 address of the instance
How can the application find this information?
Explanation:
Instance Metadata Service:EC2 instances have access to an internal metadata service. It provides instance-specific information like instance ID, security groups, and public IP address.
Accessing Metadata:
Make an HTTP GET request to the base URL:http://169.254.169.254/latest/meta-data/
You'll get a list of available categories. The public IPv4 address is underpublic-ipv4.
Instance Metadata and User Data:https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
Question 178

A company has a web application that is hosted on Amazon EC2 instances The EC2 instances are configured to stream logs to Amazon CloudWatch Logs The company needs to receive an Amazon Simple Notification Service (Amazon SNS) notification when the number of application error messages exceeds a defined threshold within a 5-minute period
Which solution will meet these requirements?
Explanation:
CloudWatch for Log Analysis:CloudWatch is the best fit here because logs are already centralized. Here's the process:
Metric Filter: Create a metric filter on the CloudWatch Logs log group. Design a pattern to specifically identify application error messages.
Custom Metric: This filter generates a new custom CloudWatch metric (e.g.,ApplicationErrors). This metric tracks the error count.
CloudWatch Alarm: Create an alarm on theApplicationErrorsmetric. Configure the alarm with your desired threshold and a 5-minute evaluation period.
SNS Action: Set the alarm to trigger an SNS notification when it enters the alarm state.
CloudWatch Metric Filters:https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/MonitoringLogData.html
CloudWatch Alarms:https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html
Question 179

A developer is creating a service that uses an Amazon S3 bucket for image uploads. The service will use an AWS Lambda function to create a thumbnail of each image Each time an image is uploaded the service needs to send an email notification and create the thumbnail The developer needs to configure the image processing and email notifications setup.
Which solution will meet these requirements?
Explanation:
SNS as a Fan-out Mechanism:SNS is perfect for triggering multiple actions from a single event (here, the image upload).
Workflow:
SNS Topic:Create an SNS topic that will be the central notification point.
S3 Event Notification:Configure the S3 bucket to send 'Object Created' event notifications to the SNS topic.
Lambda Subscription:Subscribe your thumbnail-creating Lambda function to the SNS topic.
Email Subscription:Subscribe an email address to the SNS topic to trigger notifications.
S3 Event Notifications:https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html
SNS Subscriptions:https://docs.aws.amazon.com/sns/latest/dg/SNSMobilePush.html
Question 180

A developer is building a microservices-based application by using Python on AWS and several AWS services The developer must use AWS X-Ray The developer views the service map by using the console to view the service dependencies. During testing, the developer notices that some services are missing from the service map
What can the developer do to ensure that all services appear in the X-Ray service map?
Explanation:
AWS X-Ray SDK:The primary way to enable X-Ray tracing within applications. The SDK sends data about requests and subsegments to the X-Ray daemon for service map generation.
Instrumenting All Services:To visualize a complete microservice architecture on the service map, each relevant service must include the X-Ray SDK.
AWS X-Ray Documentation:https://docs.aws.amazon.com/xray/
X-Ray SDK for Python:https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-python.html
Question