Troubleshooting and Optimization
271 soru
A developer has deployed a containerized application to Amazon ECS on AWS Fargate. The application code needs to retrieve customer records from an Amazon DynamoDB table. During execution, the container logs display an AccessDeniedException when attempting to call DynamoDB API operations. The developer verifies that the ECS task execution role has an attached policy allowing the necessary DynamoDB permissions. How should the developer resolve this authorization failure?
An AWS Lambda function is configured with an execution role named `LambdaProcessingRole`. The role has the following identity-based permission policy attached:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"dynamodb:PutItem",
"sns:Publish"
],
"Resource": "*"
}
]
}
Additionally, the developer has attached an IAM Permissions Boundary named `DeveloperBoundary` to the role. The policy document for the permissions boundary is:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"dynamodb:*",
"s3:*"
],
"Resource": "*"
}
]
}
During execution, the Lambda function successfully writes items to the Amazon DynamoDB table, but attempts to publish messages to the Amazon SNS topic fail with an `AccessDeniedException` error.
Which of the following modifications is required to resolve this authorization failure?
A developer deploys a new AWS Lambda function configured with the default timeout of seconds to process image uploads. During testing with larger image files, the function execution fails and logs a task timeout error. Additionally, the developer notices that no log groups or log streams are being created in Amazon CloudWatch Logs for this function. Which two configuration changes should the developer make to resolve these issues?
Geçerli olan tümünü seçin
A development team has deployed a microservice using AWS Lambda. The function is associated with private subnets in a custom VPC so it can securely access an internal Amazon Aurora MySQL database. Additionally, this function must send transaction logs to a public SaaS logging endpoint. While the database operations are performing correctly, all attempts to connect to the external SaaS endpoint result in timeout errors. How can this connectivity issue be resolved?
A developer designs an AWS Lambda function to process event logs. To track processed message IDs within a test execution, the developer declares a global list variable `processed_ids = []` outside the Lambda handler function. During testing, the developer observes that subsequent invocations of the function run slower, eventually timing out, and contain data from previous invocations. Which of the following explains why this issue is occurring?
A developer has enabled active tracing on an AWS Lambda function that processes incoming requests and writes data to an Amazon DynamoDB table. When viewing the traces in AWS X-Ray, the developer can see the Lambda function segment, but the downstream calls to DynamoDB are missing from the trace map. Which action should the developer take to resolve this issue?
A developer has a serverless application consisting of Amazon API Gateway, an AWS Lambda function, and an Amazon DynamoDB table. The developer enables active tracing on both the API Gateway stage and the Lambda function. However, when inspecting the AWS X-Ray service map, the developer notices that downstream DynamoDB service calls are missing from the trace path. Which of the following actions is required to ensure that DynamoDB calls are included in the distributed trace?
A developer is troubleshooting a Node.js AWS Lambda function that processes events from an Amazon DynamoDB stream. The function is configured to run inside two private subnets of a custom VPC to write caching updates to an Amazon ElastiCache for Redis cluster in the same subnets. The function also makes HTTPS calls to an external third-party service to validate customer addresses. The developer observes two symptoms in Amazon CloudWatch Logs: first, the function fails to connect to the external address validation API, resulting in connection timeout errors; second, even when address validation succeeds, the function execution duration frequently runs close to the maximum configured timeout of seconds because the database connections in the connection pool remain active, preventing the Node.js event loop from exiting. Which two actions should the developer take to resolve these issues? (Select two.)
Geçerli olan tümünü seçin
A reporting service executes an AWS Lambda function residing in private VPC subnets to generate PDF documents. The function must fetch raw data from an Amazon S3 bucket, compile the PDF, and then register the document ID by making an HTTPS request to an external registry API. Under the current configuration, the Lambda function consistently fails to connect to both Amazon S3 and the external registry API, resulting in connection timeout errors.
Which two network modifications should the developer implement to enable successful execution? (Select TWO.)
Geçerli olan tümünü seçin
An e-commerce application uses Amazon API Gateway to trigger an AWS Lambda function that processes checkout requests. Although API Gateway and Lambda have active tracing enabled, the downstream calls made by the Lambda function using the AWS SDK for Python (Boto3) to an Amazon DynamoDB table are missing from the trace map in AWS X-Ray. What should the developer do to ensure downstream DynamoDB calls are included in the trace?
A developer is deploying a backend compliance service using an AWS Lambda function. The function is configured to connect to an Amazon Aurora PostgreSQL database in a private subnet, and it also calls a third-party compliance verification HTTPS endpoint on the internet.
The Lambda function is configured with:
- Execution timeout:
- Memory:
- VPC configuration: Attached to Subnet A and Subnet B
- Security Group: Outbound allows all traffic (`0.0.0.0/0`); Inbound is restricted.
Subnet A's route table has a route for `0.0.0.0/0` pointing to a NAT Gateway located in a public subnet. However, Subnet B's route table has a route for `0.0.0.0/0` pointing directly to an Internet Gateway.
During testing under high concurrency, the developer observes two issues in Amazon CloudWatch Logs:
1. The Lambda function intermittently fails with a timeout error after during peak traffic. The database client connection pool is initialized outside the Lambda handler function.
2. The function fails to connect to the third-party compliance verification endpoint, throwing a network connection timeout, but only during execution threads that run in Subnet B.
Which two actions should the developer take to resolve these execution and configuration issues?
Geçerli olan tümünü seçin
A developer has deployed a microservice as an Amazon ECS task. The application writes JSON-formatted logs to an Amazon CloudWatch Logs group named `/aws/ecs/payment-service`. A sample log event is shown below:
{
"level": "error",
"responseCode": 504,
"latency": 1500,
"context": {
"api": "charge"
}
}
The developer needs to:
1. Create a CloudWatch metric filter to increment a custom metric named `PaymentTimeoutCount` whenever `responseCode` is and `latency` is greater than . Currently, the developer's metric filter pattern `[level = "error", responseCode = 504, latency > 1000]` is matching zero events.
2. Stream these matching log events in real time to an Amazon Kinesis Data Firehose delivery stream for archiving in Amazon S3. The developer has created a CloudWatch subscription filter pointing to Kinesis Data Firehose, but logs are not arriving in the S3 bucket, and CloudWatch Logs reports delivery errors.
Which two actions must the developer perform to resolve these issues? (Select two.)
Geçerli olan tümünü seçin
A developer is deploying a Node.js application to Amazon ECS using the AWS Fargate launch type. The application calls downstream AWS services using the AWS SDK. The developer needs to configure distributed tracing with AWS X-Ray for this containerized application. Which two actions must the developer take to instrument the application and enable trace data collection? (Select TWO.)
Geçerli olan tümünü seçin
A developer is troubleshooting a containerized Node.js application deployed on Amazon ECS with AWS Fargate. The application calls an external third-party API for address validation and writes records to an Amazon DynamoDB table. The developer configured the AWS X-Ray daemon as a sidecar container in the ECS task definition. While DynamoDB tracing is working correctly, the external API calls do not appear on the X-Ray service map, and trace context is lost for downstream transactions.
Which two actions should the developer take to resolve these issues and ensure complete distributed tracing? (Select TWO.)
Geçerli olan tümünü seçin
A developer is deploying a backend worker microservice as an AWS Lambda function. The function is designed to poll an Amazon SQS queue, process incoming JSON messages, and write results to an Amazon DynamoDB table. The developer creates an IAM role named BackendWorkerRole and attaches the managed policies AWSLambdaSQSQueueExecutionRole and AmazonDynamoDBFullAccess to it. However, when trying to associate BackendWorkerRole as the execution role in the Lambda function's configuration using the AWS CLI, the command fails with the following error:
An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: The role defined for the function cannot be assumed by Lambda.
Which of the following configuration adjustments is required to resolve this error?
A developer is troubleshooting a Python-based AWS Lambda function that processes real-time telemetry packets from an Amazon Kinesis Data Stream. The function is configured with a memory limit of and a timeout of . It is attached to a private subnet within a VPC to query an Amazon RDS database. During testing, the developer observes the following issues:
- The Lambda function logs `Task timed out after 3.00 seconds` when processing batches with larger telemetry packets.
- The Lambda function fails with a socket timeout error when trying to send analytical summaries to an external third-party API.
Which two actions should the developer take to resolve these issues? (Select two.)
Geçerli olan tümünü seçin
An IoT telemetry ingestion application processes sensor data using an AWS Lambda function written in Node.js and writes the parsed payloads to an Amazon RDS database. During testing under heavy load, the Lambda function execution terminates prematurely after seconds, and the database metrics show a spike in active client connections that reaches the database's limit. The database connection client initialization code is currently located inside the Lambda handler function.
Which TWO actions should be taken to resolve these configuration and execution issues?
Geçerli olan tümünü seçin
A developer has configured an AWS Lambda function inside a private subnet of a VPC to connect to an internal database. The function also needs to call an external API on the public internet, but all connection attempts to the external API time out. Which configuration change will resolve this issue while maintaining access to the private database?
A developer is running a Python daemon application on an Amazon EC2 instance. The application processes tasks by retrieving messages from an Amazon SQS queue and making downstream API calls to an external gateway using the `requests` library. The AWS X-Ray daemon is running on the EC2 instance, and the EC2 instance profile has the `AWSXRayDaemonWriteAccess` policy attached. The application code imports `patch_all` from the AWS X-Ray SDK and calls it at startup. However, when the application runs, the external API calls do not appear in the X-Ray console, and the logs display `SegmentNotFoundException` errors.
What is the root cause of this issue?
A developer has enabled active tracing on an AWS Lambda function that is triggered by an Amazon SQS queue. The Lambda function processes the messages and writes the results to an Amazon DynamoDB table. While reviewing the trace map in the AWS X-Ray console, the developer observes that the Lambda function execution is traced, but the downstream calls to DynamoDB do not appear in the traces. Which of the following actions should the developer take to resolve this issue?