Troubleshooting and Optimization

271 soru

Soru 201Soru

A developer is troubleshooting a serverless application where an Amazon API Gateway stage triggers an AWS Lambda function written in Python. The function processes incoming requests and retrieves secrets from AWS Secrets Manager using the `boto3` library. Active tracing is enabled on both the API Gateway stage and the Lambda function. However, the AWS X-Ray trace map shows the segments for API Gateway and the Lambda function, but does not display any segments for the calls to AWS Secrets Manager. How should the developer resolve this issue to ensure the Secrets Manager calls are visible in the trace map?

Cevabı ve açıklamayı göster

Cevap: Import the AWS X-Ray SDK for Python and call `patch_all()` or `patch(['boto3'])` before initializing the Secrets Manager client.

Cevap

Import the AWS X-Ray SDK for Python and call `patch_all()` or `patch(['boto3'])` before initializing the Secrets Manager client.
To trace downstream calls made by the AWS SDK (such as `boto3` in Python) within an AWS Lambda function, the developer must instrument the SDK. Using the AWS X-Ray SDK for Python to patch `boto3` (using `patch_all()` or `patch(['boto3'])`) intercepts all downstream calls to AWS services, records the segment details, and propagates the tracing context.

Adım Adım Çözüm

1
Analyze the missing segments in the X-Ray trace map.
The trace map only displays the nodes for API Gateway and the Lambda function, but is missing the node for AWS Secrets Manager.
Although active tracing is enabled on Lambda, the AWS SDK client inside the function code must be explicitly instrumented or patched to generate downstream trace segments.
2
Use the AWS X-Ray SDK for Python to patch the boto3 library.
The boto3 library is dynamically patched at startup, wrapping all client operations with X-Ray interceptors.
Patching ensures that all subsequent AWS SDK calls created via boto3 automatically capture metadata and create subsegments linked to the parent execution context.
3
Redeploy the function and execute a test request.
The updated trace map shows the complete end-to-end flow, including the AWS Secrets Manager calls.
The instrumented boto3 client successfully transmits the subsegment data to the X-Ray daemon, which is then sent to AWS X-Ray.

Anahtar Kavram

AWS SDK instrumentation using the AWS X-Ray SDK for Python to trace downstream calls.
Soru 202Soru

VoltMetric is a utility analytics platform that processes electricity usage metrics from millions of smart meters. The application writes high-frequency meter readings to an Amazon DynamoDB table configured with provisioned write throughput. The table uses `ZipCode` as the partition key and `Timestamp` as the sort key. During a heatwave, the application experiences a surge in writes from a highly populated urban zip code, leading to numerous `ProvisionedThroughputExceededException` errors in the ingest client logs. An analysis reveals that the total table write capacity is underutilized, but requests to this specific zip code are being throttled.

Which TWO actions should a developer take to resolve the write throttling and optimize the table's performance? (Select TWO.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Append a calculated hash or a random integer suffix to the ZipCode partition key before writing new items to the table.; Configure the ingest client SDK to use exponential backoff and jitter for request retries.

Cevap

To resolve the write throttling, the developer should append a calculated hash or a random integer suffix to the ZipCode partition key and configure the application SDK client to implement exponential backoff with jitter.
The correct options are appending a random suffix to the partition key (write sharding/salting) and configuring the client SDK to use exponential backoff with jitter. Appending a suffix distributes the writes across multiple logical partitions, preventing a single hot partition key from exceeding the partition-level limit of 10001000 WCU. Implementing exponential backoff and jitter handles transient throttling by spreading retry attempts over time, reducing collision rates.

Adım Adım Çözüm

1
Analyze the ProvisionedThroughputExceededException errors and determine if the workload is unevenly distributed.
Identify that the total write capacity is underutilized, but certain partition keys (ZipCode values representing high-density areas) are throttled, pointing to a hot partition issue.
To confirm that the root cause is a key distribution issue (hot partition) rather than a table-wide capacity limitation.
2
Apply a write sharding strategy to partition keys by appending a calculated hash or random suffix.
The writes are distributed across multiple physical partitions, raising the throughput limit for that logical partition.
DynamoDB partitions have a hard limit of 10001000 Write Capacity Units (WCUs). Appending a suffix (e.g., from 11 to NN) splits the hot key into multiple distinct partition keys.
3
Configure the AWS SDK client with exponential backoff and jitter.
The client retries throttled requests with progressively longer delay intervals that contain randomized offsets.
To handle transient throttling gracefully and prevent retry storms, ensuring that retried requests do not collide and cause further throttling.

Anahtar Kavram

Resolving DynamoDB Hot Partitions and Implementing Retry Backoff
Soru 203Soru

A gaming company is experiencing high read latency on a metadata table in Amazon DynamoDB, which is causing slow response times in their mobile leaderboard application. The read latency needs to be reduced from single-digit milliseconds to microseconds to support a real-time user experience. Which of the following caching solutions is the most appropriate to resolve this latency bottleneck?

Cevabı ve açıklamayı göster

Cevap: Deploy an Amazon DynamoDB Accelerator (DAX) cluster to serve as an in-memory cache directly in front of the DynamoDB table.

Cevap

Deploy an Amazon DynamoDB Accelerator (DAX) cluster to serve as an in-memory cache directly in front of the DynamoDB table.
Deploying a DynamoDB Accelerator (DAX) cluster is the correct approach because DAX provides a fully managed, highly available, in-memory cache directly in front of DynamoDB tables. It reduces read latency to microseconds and is API-compatible, meaning developers can use it without changing client-side logic.

Adım Adım Çözüm

1
Identify the database latency requirement.
The target latency is in the microsecond range, down from single-digit milliseconds.
This determines that an in-memory database cache is required.
2
Evaluate DynamoDB-specific caching technologies.
Amazon DynamoDB Accelerator (DAX) is the native in-memory caching service designed specifically for DynamoDB.
DAX provides microsecond latency and is API-compatible, eliminating the need to rewrite application caching logic.

Anahtar Kavram

Amazon DynamoDB Accelerator (DAX) is the dedicated caching solution for DynamoDB, providing microsecond read performance without requiring application-side cache management code.
Tahmini Süre:45s
Soru 204Soru

A developer is troubleshooting a local Node.js application running inside a Docker container. The application uses the AWS SDK for JavaScript (v3) to read data from an Amazon DynamoDB table. The application is configured to run under a non-root user named `node` with a home directory at `/home/node`. The developer wants the containerized application to use the AWS credentials defined in the `dev-profile` profile from the host machine's `~/.aws/credentials` file. Which combination of actions will allow the application in the container to successfully authenticate using the `dev-profile` credentials? (Select TWO.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Mount the host machine's ~/.aws directory to /home/node/.aws inside the container.; Set the AWS_PROFILE environment variable to dev-profile inside the container.

Cevap

Mount the host machine's ~/.aws directory to /home/node/.aws inside the container and set the AWS_PROFILE environment variable to dev-profile inside the container.
The correct combination requires mounting the host's ~/.aws directory to the container user's home directory (/home/node/.aws) so that the AWS SDK running as the 'node' user can read the credentials file. Additionally, setting the AWS_PROFILE environment variable to dev-profile ensures that the SDK uses the specified profile instead of the default profile.

Adım Adım Çözüm

1
Expose the host credentials to the container's non-root user context.
Mounting the host directory ~/.aws to /home/node/.aws makes the credentials accessible to the node user's default home directory path.
By default, the AWS SDK looks for credentials at ~/.aws/credentials in the current user's home directory. Since the container runs as 'node', it searches /home/node/.aws/credentials.
2
Configure the container environment to select the specific profile.
Setting the AWS_PROFILE environment variable to dev-profile tells the AWS SDK which configuration profile to load from the mounted credentials file.
By default, the SDK looks for the default profile. Setting AWS_PROFILE ensures the SDK loads the credentials associated with dev-profile.

Anahtar Kavram

Configuring AWS credentials in local containerized development environments for non-root users.
Soru 205Soru

A client-side Next.js web portal hosted on https://portal.ecocharge.net sends a POST request to an Amazon API Gateway REST API configured with a Lambda Proxy integration to register new users. The API Gateway has CORS enabled on the resource. The web portal console shows a CORS error stating that the 'Access-Control-Allow-Origin' header is missing on the requested resource after the browser successfully completes the OPTIONS preflight request. Which of the following is the correct action to resolve this issue?

Cevabı ve açıklamayı göster

Cevap: Modify the backend Lambda function's response to return a JSON object containing a 'headers' key with the 'Access-Control-Allow-Origin' header.

Cevap

Modify the backend Lambda function's response to return a JSON object containing a 'headers' key with the 'Access-Control-Allow-Origin' header.
For a Lambda Proxy integration in Amazon API Gateway, the backend Lambda function is responsible for returning the complete response structure, including the status code, body, and all HTTP headers. While enabling CORS in the API Gateway console configures the preflight OPTIONS method, the actual method response (such as the POST response) must return the 'Access-Control-Allow-Origin' header directly within the Lambda function's JSON response payload.

Adım Adım Çözüm

1
Analyze the integration type configured on the API Gateway resource.
The resource uses Lambda Proxy integration.
Lambda Proxy integration requires the backend Lambda function to format its output as a specific JSON object containing status code, headers, and body.
2
Determine where the CORS headers must be added.
Since API Gateway CORS enabling only sets headers on the OPTIONS preflight method automatically, the actual method (POST) must return the CORS headers from the integration backend.
For Lambda Proxy integrations, API Gateway does not evaluate or inject headers for integration responses on non-OPTIONS methods.
3
Update the Lambda function's output dictionary format.
The Lambda function returns a payload containing: { 'statusCode': 200, 'headers': { 'Access-Control-Allow-Origin': '*' }, 'body': '...' }
This structural output satisfies the Lambda Proxy integration contract and includes the required CORS headers for the browser to accept the request.

Anahtar Kavram

Lambda Proxy Integration CORS Requirements
Tahmini Süre:1m 30s
Soru 206Soru

A developer is containerizing a Go application that retrieves messages from an Amazon SQS queue. For local testing, the application runs inside a Docker container on a local workstation. The developer has configured the AWS CLI on the host workstation with a default profile, and the CLI successfully connects to SQS. However, when the containerized application runs, it fails with a credentials provider error indicating that no credentials could be found. Which of the following is the most secure and appropriate way to resolve this credential error in the local development environment?

Cevabı ve açıklamayı göster

Cevap: Pass the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables to the container at runtime using the docker run command with environment flags.

Cevap

Pass the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables to the container at runtime using the docker run command with environment flags.
Passing the environment variables to the container at runtime resolves the credentials error because container environments are isolated by default. The default credential provider chain in the AWS SDK checks environment variables first before checking configuration files or IAM roles, allowing the application to successfully retrieve credentials passed via the environment flags.

Adım Adım Çözüm

1
Analyze the container execution environment and the SDK credential lookup sequence.
The Go application inside the container runs in an isolated environment and does not inherit environment variables or files from the host machine by default.
Understanding why the SDK is failing to locate credentials.
2
Evaluate the order of precedence in the AWS Default Credential Provider Chain.
The chain first looks for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables before looking at config/credentials files or container/instance metadata endpoints.
Determining the cleanest and most standard way to inject credentials.
3
Select the option that correctly injects the credentials at runtime without violating security guidelines.
Passing the environment variables into the container via the docker run command's environment flags (-e or --env) provides the containerized SDK with the necessary credentials.
Selecting the correct resolution.

Anahtar Kavram

AWS SDK Default Credential Provider Chain and Container Environment Isolation
Tahmini Süre:1m 30s
Soru 207Soru

A developer is building a weather forecasting web application that retrieves current weather conditions from an Amazon DynamoDB table based on a postal code. The application experiences a large number of duplicate read requests for the same popular postal codes, resulting in high latency and read throttling. The developer wants to optimize the application's read performance with minimal changes to the application code. Which action should the developer take to resolve this issue?

Cevabı ve açıklamayı göster

Cevap: Configure and deploy an Amazon DynamoDB Accelerator (DAX) cluster to cache the read requests from the DynamoDB table.

Cevap

Configure and deploy an Amazon DynamoDB Accelerator (DAX) cluster to cache the read requests from the DynamoDB table.
Amazon DynamoDB Accelerator (DAX) is a fully managed, in-memory cache designed specifically for DynamoDB. It provides sub-millisecond response times for read-heavy workloads with minimal application code modifications, as the DAX client SDK is API-compatible with the standard DynamoDB client.

Adım Adım Çözüm

1
Analyze the application's read pattern and latency requirement.
The application reads identical data keys (postal codes) repeatedly, resulting in read throttling and high latency.
Identifying that the workload has repetitive read patterns helps select an in-memory caching solution to offload the database.
2
Select the caching solution that integrates directly with DynamoDB without major code modifications.
Amazon DynamoDB Accelerator (DAX) is chosen because it acts as a seamless write-through/read-through cache.
DAX provides API-compatible caching, enabling sub-millisecond response times with minimal application change.

Anahtar Kavram

Using DynamoDB Accelerator (DAX) to optimize read performance and reduce latency for read-heavy workloads with minimal code changes.
Soru 208Soru

A web-based partner portal hosted on `https://partner.datasync.io` receives a `502 Bad Gateway` error and a CORS block message in the browser console when sending a `PATCH` request to an Amazon API Gateway REST API. The API is configured with a Lambda Proxy integration. The developer checks the Amazon CloudWatch logs and confirms that the backend Lambda function executed successfully and returned the following JSON structure:

{
"statusCode": 200,
"body": "{\"message\": \"Update successful\"}"
}

Which action should the developer take to resolve this error?

Cevabı ve açıklamayı göster

Cevap: Modify the Lambda function response to include the Access-Control-Allow-Origin header in a headers object within the returned JSON.

Cevap

Modify the Lambda function response to include the Access-Control-Allow-Origin header in a headers object within the returned JSON.
In a Lambda Proxy integration, API Gateway expects the backend Lambda function to return a structured JSON response that includes status code, headers, and body. Because the integration bypasses API Gateway's integration response mappings, the Lambda function is solely responsible for returning the `Access-Control-Allow-Origin` header in its response. Without this header, the browser blocks the response, leading to a CORS policy violation and a client-side error.

Adım Adım Çözüm

1
Analyze the error context and integration type.
The endpoint uses a Lambda Proxy integration, meaning API Gateway expects the backend Lambda function to format its output exactly as a JSON object containing statusCode, body, and optionally headers.
Determining the integration type dictates whether API Gateway mapping templates (custom integration) or the Lambda function code (proxy integration) must supply the CORS headers.
2
Inspect the backend Lambda function output.
The function returns statusCode and body but is missing the headers object with Access-Control-Allow-Origin.
For proxy integrations, the browser's CORS requirements are satisfied only if the backend code explicitly provides the Access-Control headers in the returned payload.
3
Update the returned JSON object in the Lambda code.
The function now returns: { "statusCode": 200, "headers": { "Access-Control-Allow-Origin": "https://partner.datasync.io" }, "body": "..." }.
This payload format complies with both the API Gateway proxy integration contract and the browser's CORS policy, resolving the error.

Anahtar Kavram

Handling CORS and response formatting in API Gateway Lambda Proxy integrations.
Soru 209Soru

A logistics tracking application named PackTrack records real-time delivery status updates for packages. The underlying Amazon DynamoDB table uses `PackageID` as the partition key and `StatusTimestamp` as the sort key. A fleet monitoring dashboard needs to display all deliveries that are currently delayed. To retrieve this data, the dashboard runs a weekly batch process using a `Scan` operation with a `FilterExpression` on the `DeliveryStatus` attribute where the value equals `DELAYED`. As package volume increases, the scan operation consistently throws `ProvisionedThroughputExceededException` errors, causing the dashboard to load partially or fail entirely, despite the developer scaling up the table's read capacity units (RCUs). Which of the following is the most cost-effective and appropriate solution to resolve this throttling issue?

Cevabı ve açıklamayı göster

Cevap: Create a Global Secondary Index (GSI) with DeliveryStatus as the partition key and StatusTimestamp as the sort key, and update the dashboard to query the GSI instead of scanning the base table.

Cevap

Create a Global Secondary Index (GSI) with DeliveryStatus as the partition key and StatusTimestamp as the sort key, and update the dashboard to query the GSI instead of scanning the base table.
The correct option is to create a Global Secondary Index (GSI) with DeliveryStatus as the partition key and query it. A Scan operation in DynamoDB reads every item in the table and then applies the filter, which consumes massive amounts of Read Capacity Units (RCUs) and leads to throttling as the table grows. By creating a GSI with DeliveryStatus as the partition key, the application can perform a Query operation instead. A Query only reads the items that match the partition key, consuming significantly fewer RCUs and resolving the throttling issue in a cost-effective manner.

Adım Adım Çözüm

1
Analyze the cause of the ProvisionedThroughputExceededException.
Identify that the dashboard is using a Scan operation with a FilterExpression to locate specific records (delayed packages) rather than querying them directly.
Scan operations read the entire table before filtering out results, which consumes RCUs proportional to the size of the table rather than the number of matching items.
2
Select a strategy to convert the Scan into a Query.
Since the partition key of the base table is PackageID (high cardinality but not matching the query criteria), a secondary index is required to query by DeliveryStatus.
A Global Secondary Index (GSI) allows redefining the partition key to DeliveryStatus, enabling efficient Query operations.
3
Create the GSI and update the application logic.
Create a GSI with DeliveryStatus as the partition key and StatusTimestamp as the sort key. Modify the dashboard code to execute a Query against this GSI.
Querying the GSI retrieves only the relevant items matching 'DELAYED', which dramatically reduces RCU consumption and resolves throttling.

Anahtar Kavram

Resolving DynamoDB throttling issues by replacing inefficient Scan operations with targeted Query operations on a Global Secondary Index (GSI).
Soru 210Soru

A developer is troubleshooting a local C# (.NET) console application that uses the AWS SDK for .NET to read objects from an Amazon S3 bucket. The developer has configured the AWS CLI on their workstation with a named profile called `dev-profile` containing valid AWS credentials. However, when executing the application locally, it throws an `AmazonServiceException` indicating that the credentials cannot be found. No environment variables are set on the workstation, and the SDK is initialized using default client configuration. Which of the following actions is the most secure and appropriate way to resolve this credential error for local development?

Cevabı ve açıklamayı göster

Cevap: Set the AWS_PROFILE environment variable to dev-profile in the local shell environment.

Cevap

Set the AWS_PROFILE environment variable to dev-profile in the local shell environment.
The correct answer is to set the AWS_PROFILE environment variable to the named profile. The default credential provider chain in the AWS SDK for .NET automatically checks for this variable. If set, it overrides the default profile search and reads the credentials from the matching named block in the shared AWS credentials file. This avoids exposing secrets and requires no modification of the application code.

Adım Adım Çözüm

1
Analyze how the AWS SDK for .NET searches for credentials locally.
The default credential provider chain searches environment variables, followed by the shared credentials file (~/.aws/credentials).
Understanding the lookup order helps identify why the named profile was not automatically detected.
2
Identify the root cause of the credential lookup failure.
Since no environment variables are set, the SDK looks for the default profile in the credentials file, but the credentials are saved under the named profile dev-profile.
Named profiles are ignored by default unless explicitly requested via configuration or environment variables.
3
Select the correct mechanism to configure the profile name without changing the source code.
Exporting the AWS_PROFILE environment variable pointing to dev-profile ensures the default chain locates the credentials.
Setting the environment variable is non-intrusive, secure, and adheres to standard configuration precedence.

Anahtar Kavram

AWS SDK Credential Provider Chain and Named Profiles
Soru 211Soru

A digital library application retrieves book metadata from an Amazon DynamoDB table. During a reading campaign, a few popular books receive a high volume of read requests, causing DynamoDB read throttling. The developer wants to implement a caching solution to reduce read latency to sub-milliseconds for these popular books with minimal changes to the application code.

Which two actions should the developer take to resolve the throttling and meet the performance requirements? (Select two.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Create an Amazon DynamoDB Accelerator (DAX) cluster.; Configure the application to use the DAX SDK client instead of the standard DynamoDB client.

Cevap

To resolve read throttling and achieve sub-millisecond read latency with minimal application changes, the developer should create an Amazon DynamoDB Accelerator (DAX) cluster and configure the application to use the DAX SDK client.
Creating an Amazon DynamoDB Accelerator (DAX) cluster and configuring the application to use the DAX SDK client is the correct approach. DAX is an in-memory, write-through cache that is API-compatible with DynamoDB. Replacing the standard client with the DAX client requires minimal code changes and routes read operations through the cache, reducing read latency to sub-milliseconds and offloading the read volume from the database table.

Adım Adım Çözüm

1
Identify the caching solution that integrates with DynamoDB with minimal code changes.
Amazon DynamoDB Accelerator (DAX) is selected as the dedicated, API-compatible caching service for DynamoDB.
Unlike general-purpose caching systems, DAX does not require application logic to manage cache population or invalidation.
2
Provision the cache cluster.
A DAX cluster is created in the same region as the DynamoDB table.
The DAX cluster will serve as the read cache in front of the DynamoDB table.
3
Configure the client application.
The application code is updated to instantiate the DAX client library instead of the default AWS SDK DynamoDB client.
The DAX client routes read and write operations directly to the DAX cluster, fallbacking to DynamoDB automatically.

Anahtar Kavram

DynamoDB Accelerator (DAX) caching implementation
Tahmini Süre:1m 0s
Soru 212Soru

An online banking application retrieves user transaction history using an Amazon DynamoDB table. During end-of-month processing, users experience high query latencies, and the application log shows frequent `ProvisionedThroughputExceededException` errors on read operations. The primary key structure uses a partition key of `UserId` and a sort key of `TransactionTimestamp`. The developer plans to implement Amazon DynamoDB Accelerator (DAX) to achieve sub-millisecond read latency and alleviate the read workload on the DynamoDB table. The application code currently initiates reads with the parameter `ConsistentRead` set to `true`.

Which combination of actions must the developer take to resolve the performance issue and successfully utilize caching? (Select two.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Modify the application's query requests to use eventually consistent reads by setting the `ConsistentRead` parameter to `false`.; Initialize the DAX client in the application code and configure it to route requests to the DAX cluster endpoint.

Cevap

To resolve the performance issue and enable caching, the developer must modify query requests to use eventually consistent reads by setting the consistent read parameter to false, and configure the application SDK to initialize the DAX client pointing to the DAX cluster endpoint.
To successfully leverage Amazon DynamoDB Accelerator (DAX) caching to reduce read latency and read throughput consumption, two main adjustments are required. First, the application must perform eventually consistent reads. Strongly consistent reads bypass the DAX cache and are routed directly to DynamoDB, consuming read capacity units. Setting the consistent read parameter to false enables caching. Second, the application must be updated to initialize the DAX client and target the DAX cluster endpoint so that queries go through the DAX cache layer instead of directly to DynamoDB.

Adım Adım Çözüm

1
Identify why the DAX cache is being bypassed despite cluster deployment.
Strongly consistent reads (ConsistentRead=true) always bypass DAX caching and are sent directly to DynamoDB.
DAX does not serve strongly consistent reads from its cache to guarantee strong consistency, resulting in table RCU consumption.
2
Switch read queries to eventually consistent reads.
ConsistentRead parameter is set to false in the read API options.
Eventually consistent reads allow DAX to serve the data from its item or query cache, avoiding calls to the underlying table.
3
Configure the application to route requests through DAX.
The SDK's standard DynamoDB client is replaced with the DAX client, configured with the DAX cluster endpoint.
Without targeting the DAX cluster endpoint, the application will continue to query the DynamoDB endpoint directly.

Anahtar Kavram

Amazon DynamoDB Accelerator (DAX) configuration, caching behavior for strongly consistent reads, and client initialization best practices.
Soru 213Soru

A developer is optimizing a reporting service that retrieves product catalog listings from an Amazon DynamoDB table. The service frequently executes the same Query operations to retrieve items by category. To reduce latency, the developer deploys an Amazon DynamoDB Accelerator (DAX) cluster and updates the application code to use the DAX SDK client. While individual GetItem operations now exhibit sub-millisecond latency, the Query operations continue to experience high latency and consume the table's Provisioned Throughput. Which modification should the developer make to ensure the Query operations are successfully cached by DAX?

Cevabı ve açıklamayı göster

Cevap: Configure the Query operations in the application code to perform eventually consistent reads by setting the ConsistentRead parameter to false.

Cevap

Configure the Query operations in the application code to perform eventually consistent reads by setting the ConsistentRead parameter to false.
DAX does not cache strongly consistent reads (such as Query or Scan operations where ConsistentRead is set to true). These requests are passed through directly to the underlying DynamoDB table. To utilize the DAX query cache, the developer must configure the client to perform eventually consistent reads by setting ConsistentRead to false.

Adım Adım Çözüm

1
Analyze the DAX caching behavior for strongly consistent vs eventually consistent reads.
Identify that DAX does not cache strongly consistent reads (where ConsistentRead is set to true) and passes them through to DynamoDB.
To understand why Query operations are bypassing the DAX cache and consuming DynamoDB RCUs.
2
Change the configuration of the Query operation in the application code.
Set the ConsistentRead parameter to false for the query calls.
This allows DAX to cache the results of the Query operations in its query cache, serving subsequent identical requests from memory.

Anahtar Kavram

DAX Query Cache Consistency Requirements
Soru 214Soru

A developer is using the AWS Serverless Application Model (AWS SAM) CLI to test an AWS Lambda function locally by running the `sam local invoke` command. The Lambda function, written in Node.js, uses the AWS SDK for JavaScript (v3) to read from an Amazon DynamoDB table in the cloud.

When the developer runs the function locally, the SDK operations fail with an `AccessDeniedException`. The developer has already configured a local AWS CLI profile named `developer-local` in the `~/.aws/credentials` file on the host machine. This profile possesses all necessary permissions to access the DynamoDB table. The developer has also set the environment variable `AWS_PROFILE=developer-local` on the host command line.

Which actions should the developer take to ensure the locally running function has access to the credentials? (Select TWO.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Invoke the Lambda function locally by passing the profile name using the `--profile developer-local` parameter with the `sam local invoke` command.; Create a JSON file containing the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` from the profile, and pass this file to the command using the `--env-vars` parameter.

Cevap

To resolve the credential issue, the developer can either pass the profile name to the SAM CLI using the `--profile` parameter, or pass the credentials via a JSON file containing environment variables using the `--env-vars` parameter.
When running local Lambda functions with AWS SAM CLI (`sam local invoke`), the runtime environment executes inside a Docker container. This container is isolated and does not inherit host environment variables like `AWS_PROFILE` or host directories like `~/.aws` by default. To supply credentials, the developer can use the `--profile` flag, which instructs SAM CLI to read the specified profile's credentials from the host and mount/pass them to the container. Alternatively, the developer can write the credentials to a JSON file as environment variables and specify it using `--env-vars` to inject those values into the container environment.

Adım Adım Çözüm

1
Analyze why the local Lambda execution is failing to find credentials.
Identify that the Lambda function is running inside a Docker container managed by the AWS SAM CLI, which does not automatically inherit the environment variables (like `AWS_PROFILE`) or credentials folder (`~/.aws`) of the host machine.
Container isolation prevents the local runtime from accessing host credentials unless they are explicitly passed or mounted.
2
Evaluate methods to pass the host's AWS CLI credentials into the container environment.
The AWS SAM CLI provides two standard mechanisms: the `--profile` flag to mount and use credentials from a specific host profile, and the `--env-vars` flag to supply environment variables (such as `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`) from a JSON file.
Using these mechanisms correctly satisfies the SDK's credential provider chain inside the container without compromising security.

Anahtar Kavram

AWS SAM local development container credential propagation
Soru 215Soru

A developer is troubleshooting a serverless application where an AWS Lambda function written in C# (.NET) processes order events. The Lambda function is invoked by an Amazon API Gateway REST API. The function makes downstream HTTP calls to a third-party payment gateway and performs read/write operations on an Amazon DynamoDB table. Active tracing is enabled on both the API Gateway stage and the Lambda function. However, when inspecting the AWS X-Ray console, the developer observes that while the API Gateway and Lambda function segments appear, the HTTP calls to the payment gateway and the DynamoDB operations are missing from the trace.

Which of the following actions should the developer take to record the downstream calls in the X-Ray traces?

Cevabı ve açıklamayı göster

Cevap: Use the AWS X-Ray SDK for .NET to call AWSSDKHandler.RegisterXRayForAllServices() at application startup, and initialize HttpClient using the HttpClientXRayTracingHandler class.

Cevap

Use the AWS X-Ray SDK for .NET to call AWSSDKHandler.RegisterXRayForAllServices() at application startup, and initialize HttpClient using the HttpClientXRayTracingHandler class.
To trace AWS SDK operations and standard HTTP calls in a .NET application, the developer must instrument them using the AWS X-Ray SDK for .NET. Calling AWSSDKHandler.RegisterXRayForAllServices() registers the tracing handler globally for all AWS service clients, and initializing HttpClient with HttpClientXRayTracingHandler ensures that outbound HTTP calls to the payment gateway are intercepted and traced as subsegments.

Adım Adım Çözüm

1
Identify the missing components in the X-Ray trace.
The DynamoDB operations (AWS SDK calls) and the third-party payment gateway calls (HTTP requests) are missing.
By default, enabling active tracing on Lambda only creates the Lambda service segment, but downstream network libraries and AWS SDKs must be instrumented explicitly in code.
2
Instrument the AWS SDK calls.
Call AWSSDKHandler.RegisterXRayForAllServices() during application initialization.
This automatically registers a request pipeline handler with the AWS SDK to trace calls to all AWS services, including DynamoDB.
3
Instrument downstream HTTP calls.
Pass an instance of HttpClientXRayTracingHandler when creating the HttpClient.
This handler intercepts outgoing HTTP calls and injects the trace header while generating subsegments for downstream external API calls.

Anahtar Kavram

Instrumenting AWS SDK and HTTP clients in C# (.NET) with AWS X-Ray SDK.
Tahmini Süre:1m 30s
Soru 216Soru

A developer is troubleshooting a Python application on a local development workstation. The application uses the AWS SDK for Python (Boto3) to interact with AWS resources.

The developer has configured two profiles in the local `~/.aws/credentials` file: a `default` profile and a `custom-dev` profile.

To test the application locally, the developer runs the following commands in the terminal:

bash
export AWS_PROFILE=custom-dev
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

When the developer runs the application, they notice that the SDK uses the IAM credentials from the environment variables rather than the configuration defined for `custom-dev` in the credentials file.

Why does the AWS SDK execute the requests using the environment variable credentials instead of the `custom-dev` profile?

Cevabı ve açıklamayı göster

Cevap: The AWS SDK credential provider chain evaluates environment variables for explicit access keys before loading credentials from the shared credentials file.

Cevap

The AWS SDK credential provider chain evaluates environment variables for explicit access keys before loading credentials from the shared credentials file.
The AWS SDK default credential provider chain resolves credentials in a specific sequence. Environment variables containing explicit access keys (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) are checked before looking up the shared credentials file. As long as these environment variables are defined in the environment, the SDK will use them, ignoring the profile specified by AWS_PROFILE.

Adım Adım Çözüm

1
Analyze the credentials configured in the environment and the shared credentials file.
The terminal has both environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) and the AWS_PROFILE environment variable set to select a profile from the credentials file.
Understanding which credential configurations are active is necessary to diagnose the lookup behavior.
2
Review the order of precedence in the AWS SDK default credential provider chain.
The chain searches environment variables first, then credentials from the shared credentials/config files (controlled by AWS_PROFILE).
The SDK resolves credentials by checking sources in a strict, pre-defined order.
3
Compare the precedence of the active credential sources.
Because AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are defined in the environment variables, they take precedence over the AWS_PROFILE setting.
This explains why the SDK ignores the profile configuration and uses the direct environment variables.

Anahtar Kavram

AWS SDK Default Credential Provider Chain Precedence
Soru 217Soru

A ticket booking application named TicketSwift records concert reservations in an Amazon DynamoDB table. The table uses ConcertID as the partition key and BookingTimestamp as the sort key. During major ticket releases, the application experiences a surge in ProvisionedThroughputExceededException errors, even though the total read and write capacity units (RCUs and WCUs) are auto-scaled and remain well below the table-level limits. An analysis shows that millions of requests are targeting a single popular concert within a few minutes. Which combination of actions will resolve this throttling issue and optimize key distribution? (Select TWO.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Redesign the partition key schema by appending a random numeric suffix to the ConcertID during high-volume booking events.; Configure the application SDK client to implement exponential backoff and jitter for retrying requests.

Cevap

Redesigning the partition key schema by appending a random numeric suffix to the ConcertID and configuring the SDK to use exponential backoff and jitter.
Redesigning the partition key by appending a random numeric suffix (write sharding) distributes writes across multiple partitions, preventing a hot key issue. Implementing exponential backoff and jitter in the SDK handles transient throttling errors gracefully without overloading the database.

Adım Adım Çözüm

1
Analyze the table schema and partition key design.
Identify that the ConcertID partition key results in a hot partition during popular ticket sales, because all writes for a concert hit the same physical partition.
DynamoDB partition capacity is limited, and high throughput on a single key leads to throttling despite table-level scaling.
2
Introduce sharding to the partition key.
Append a random numeric suffix (e.g., ConcertID_1, ConcertID_2) to distribute the write requests across multiple physical partitions.
This spreads the write load, increasing the aggregate throughput support for the concert writes.
3
Configure client-side error handling.
Implement exponential backoff and jitter in the application SDK for handling ProvisionedThroughputExceededException.
This prevents the client from overwhelming the database during transient spikes and ensures successful retries.

Anahtar Kavram

DynamoDB Partition Key Sharding and SDK Retries
Tahmini Süre:2m 0s
Soru 218Soru

A developer is troubleshooting a serverless application deployed on AWS Lambda. The application logs events in a structured JSON format to Amazon CloudWatch Logs. The developer needs to configure CloudWatch metric filters to monitor two separate issues:

1. Lambda function execution timeouts, which generate service-level log lines containing the string: `Task timed out after`
2. Application API failures, where the log events are JSON objects containing a key `statusCode` with a value of 500 or greater.

Which two configurations should the developer implement to achieve this? (Select TWO.)

Geçerli olan tümünü seçin

Cevabı ve açıklamayı göster

Cevap: Create a metric filter for the execution timeouts using the filter pattern "Task timed out after".; Create a metric filter for the API failures using the JSON filter pattern { $.statusCode >= 500 }.

Cevap

The correct configurations are to create a metric filter for the execution timeouts using the filter pattern "Task timed out after" and to create a metric filter for the API failures using the JSON filter pattern { $.statusCode >= 500 }.
The correct options involve setting up a literal string filter pattern to match plain-text Lambda runtime log entries and a JSON path filter pattern to match structured JSON application log entries. Since Lambda service timeouts are logged as raw text lines, a literal string match is required. Since the application writes logs in JSON, the JSON path filter syntax allows matching numeric conditions on specific properties.

Adım Adım Çözüm

1
Analyze the log format of the Lambda service execution timeouts.
The Lambda service logs execution timeouts as raw, unstructured text strings containing the pattern 'Task timed out after'.
Understanding the format of the log lines dictates the type of metric filter pattern needed.
2
Analyze the log format of the application API failures.
The application writes log events in a structured JSON format containing a statusCode field.
JSON logs require structured JSON query syntax to isolate specific property values.
3
Define the appropriate filter pattern syntax for each log type.
Use a literal string pattern '"Task timed out after"' for the text logs, and the JSON pattern '{ $.statusCode >= 500 }' for the JSON logs.
Applying the correct pattern ensures that the metric filter accurately parses the log stream and increments the metric.

Anahtar Kavram

Distinguishing between plain-text and structured JSON log streams when configuring Amazon CloudWatch metric filters.
Tahmini Süre:2m 0s
Soru 219Soru

RideFlow is a ride-sharing platform that logs completed trips to an Amazon DynamoDB table. The table is configured with provisioned write capacity. The table's partition key is CityID and the sort key is TripTimestamp. During peak commute times, the platform experiences a high volume of writes for the city code NYC. As a result, the application logs ProvisionedThroughputExceededException errors, even though the total consumed write capacity units (WCUs) for the entire table are significantly below the provisioned threshold. Which strategy should a developer implement to resolve this throttling issue?

Cevabı ve açıklamayı göster

Cevap: Modify the write logic to append a random numeric suffix to the CityID partition key, distributing the write workload across multiple partition keys.

Cevap

Modify the write logic to append a random numeric suffix to the CityID partition key, distributing the write workload across multiple partition keys.
The correct solution is to modify the write logic to append a random numeric suffix to the CityID partition key. A single DynamoDB partition is limited to 1,000 WCUs. Since 'NYC' has a high volume of writes during peak times, it exceeds this partition-level limit even if the table's overall provisioned throughput is underutilized. Appending a random suffix distributes the writes across multiple partition keys (e.g., NYC_1, NYC_2) and thus across multiple physical partitions, resolving the hot partition throttling.

Adım Adım Çözüm

1
Identify the cause of throttling from metrics
Determine that ProvisionedThroughputExceededException is occurring because writes are concentrated on a single partition key ('NYC') representing a hot partition.
DynamoDB partitions have a hard limit of 1,000 WCUs. Concentrating writes on a single key exhausts the partition's capacity even if the table's overall provisioned capacity is much higher.
2
Select a distribution mitigation strategy
Implement write sharding by appending a random suffix to the partition key.
By appending a random suffix (e.g., NYC_1, NYC_2), writes are distributed across multiple partition keys and therefore multiple physical partitions, avoiding the single-partition WCU limit.

Anahtar Kavram

Resolving hot partition keys and partition throttling via write sharding in DynamoDB.
Tahmini Süre:2m 0s
Soru 220Soru

An application deployed on Amazon ECS writes JSON-formatted logs to Amazon CloudWatch Logs. A sample log event is shown below:

{
"statusCode": 500,
"errorType": "DatabaseTimeoutException",
"message": "Connection to database timed out."
}

The developer needs to create a CloudWatch Metric Filter to count the occurrences of this specific database timeout error. Which filter pattern should the developer use to match logs where the statusCode is 500 and the errorType is exactly DatabaseTimeoutException?

Cevabı ve açıklamayı göster

Cevap: { .statusCode = 500 && .errorType = "DatabaseTimeoutException" }

Cevap

The metric filter pattern { .statusCode = 500 && .errorType = "DatabaseTimeoutException" } correctly filters JSON logs.
The correct metric filter pattern utilizes curly braces to specify a JSON log filter. Inside the braces, JSON properties are referenced using JSONPath-like notation starting with $. representing the root. The equality operator is a single = sign, and the logical combination uses &&.

Adım Adım Çözüm

1
Identify the log format.
The log format is JSON.
Metric filters parse JSON logs differently than space-delimited text logs, requiring curly braces and JSON-path selectors like $. to parse key-value structures.
2
Determine the correct comparison operator and logical operator.
The comparison operator is = and the logical AND operator is &&.
AWS CloudWatch metric filters use a single = for equality checks and && for logical AND conditions.
3
Construct the final filter pattern.
{ .statusCode = 500 && .errorType = "DatabaseTimeoutException" }
This matches both properties in the JSON structure according to CloudWatch Metric Filter syntax specifications.

Anahtar Kavram

CloudWatch Logs Metric Filter JSON Syntax
ÖncekiSayfa 11 / 14Sonraki
Troubleshooting and Optimization Alıştırma Soruları — AWS Certified Developer - Associate — Sayfa 11 | Examkin