Tüm alıştırma soruları

1542 soru

Soru 441Soru

A developer is designing a financial ledger application that stores transaction data in an Amazon DynamoDB table named `AccountLedger`. The table has `AccountID` as the partition key and `TransactionTimestamp` as the sort key. The table contains millions of items, but each individual account has fewer than 100100 transactions. A new feature requires retrieving all transactions for a specific account where the transaction amount is greater than 500 USD500\text{ USD}. Which approach should the developer use to retrieve this data while minimizing read latency and Read Capacity Unit (RCU) consumption?

Cevabı ve açıklamayı göster

Cevap: Perform a Query operation specifying the AccountID in the key condition expression, and apply a filter expression on the transaction amount attribute.

Cevap

Perform a Query operation specifying the AccountID in the key condition expression, and apply a filter expression on the transaction amount attribute.
The correct approach is to perform a Query operation specifying the AccountID in the key condition expression, and apply a filter expression on the transaction amount attribute. A Query operation is highly efficient because it targets only the partition containing the target AccountID. Even though the filter expression on the amount is evaluated after the items are read from the partition, the number of read operations is limited to the transactions of that single account (fewer than 100 items), minimizing read latency and RCU consumption.

Adım Adım Çözüm

1
Analyze the table primary key design and requirements.
The table partition key is AccountID, and the query needs to retrieve data for a specific account.
Identifying the partition key helps determine if a Query operation is possible, as Query requires an equality match on the partition key.
2
Compare Query and Scan operations.
A Query only reads items matching the specified partition key, while a Scan reads the entire table.
Since the partition key is known and each account has few transactions, Query is significantly more efficient than Scan.
3
Determine how to handle the non-key attribute filter (amount > 500 USD).
Use a FilterExpression to evaluate the transaction amount after the Query returns the partition's items.
Since the amount is not part of the primary key, it cannot be used in the KeyConditionExpression directly. Using a FilterExpression in a Query confines the read operation to just the specific account's items.

Anahtar Kavram

Using Query instead of Scan for DynamoDB item retrieval when the partition key is known.
Tahmini Süre:1m 30s
Soru 442Soru

A developer is implementing a real-time data processing pipeline where an AWS Lambda function consumes batches of records from an Amazon Kinesis Data Stream. To securely write the processed results to an Amazon RDS database instance, the Lambda function is configured to run inside a private subnet of a Virtual Private Cloud (VPC). During testing, the Lambda function fails to retrieve records from the Kinesis Data Stream and consistently times out. Which of the following configurations should the developer implement to resolve this connection issue?

Cevabı ve açıklamayı göster

Cevap: Configure an interface VPC endpoint (AWS PrivateLink) for Amazon Kinesis in the VPC, or route the private subnet traffic through a NAT Gateway in a public subnet.

Cevap

Configure an interface VPC endpoint (AWS PrivateLink) for Amazon Kinesis in the VPC, or route the private subnet traffic through a NAT Gateway in a public subnet.
The correct answer is to configure an interface VPC endpoint or route traffic through a NAT Gateway. This is correct because Lambda functions deployed inside a private subnet of a VPC do not have public IP addresses or route tables that directly point to the internet. Since the Kinesis API endpoint is located on the public internet, the Lambda function needs a way to route traffic out of the VPC to reach Kinesis. An interface VPC endpoint (AWS PrivateLink) allows the Lambda function to connect privately to Kinesis using private IP addresses within the VPC, without requiring traffic to traverse the public internet. Alternatively, a NAT Gateway placed in a public subnet allows the Lambda function to route its internet-bound traffic through the NAT Gateway and Internet Gateway to reach public AWS service endpoints.

Adım Adım Çözüm

1
Identify the networking state of the Lambda function.
The Lambda function is deployed in a private VPC subnet and does not have a route to the public internet where the standard Amazon Kinesis endpoint resides.
To determine why the Lambda function is experiencing timeouts when communicating with Kinesis.
2
Determine the mechanism to allow VPC resources to reach public AWS services.
Traffic must either be routed to a NAT Gateway in a public subnet or directed through an Interface VPC Endpoint (AWS PrivateLink) specifically for Kinesis.
To establish a network path from the private subnet to the Kinesis service.
3
Select the matching configuration that establishes this network path.
The configuration using an interface VPC endpoint or a NAT Gateway.
To resolve the timeout and enable successful record retrieval from the Kinesis Data Stream.

Anahtar Kavram

VPC Networking and Connectivity for AWS Lambda stream consumers
Soru 443Soru

A developer is building a digital streaming application where video metadata is stored in an Amazon DynamoDB table. The table's partition key is `VideoID` and the sort key is `UploadTimestamp`. The application frequently retrieves a list of videos within a specific category, sorted by their upload date, where the rating is greater than 4.04.0. The category attribute is not part of the primary key. Which two actions should the developer take to retrieve this data efficiently while minimizing the consumption of Read Capacity Units (RCUs)?

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

Cevabı ve açıklamayı göster

Cevap: Create a Global Secondary Index (GSI) with `Category` as the partition key and `UploadTimestamp` as the sort key, projecting only the required video metadata attributes.; Perform a `Query` operation on the Global Secondary Index using the `Category` value in the key condition expression and a filter expression for the rating.

Cevap

Create a Global Secondary Index (GSI) with the category as the partition key and the upload timestamp as the sort key, projecting only the required attributes. Then, perform a Query operation on the GSI using the category value in the key condition expression and a filter expression for the rating.
To search and sort by attributes that are not the base table's primary key, a Global Secondary Index (GSI) must be defined with the search attribute as the partition key and the sorting attribute as the sort key. Performing a Query operation on this GSI is highly efficient because it reads only the subset of items under the specified partition key. Projecting only necessary attributes further minimizes RCU footprint.

Adım Adım Çözüm

1
Analyze the access pattern
The application needs to search by an attribute (`Category`) that is not the partition key of the base table, and sort by `UploadTimestamp`.
DynamoDB base tables can only be queried directly by their partition key. Searching by other attributes requires either a Scan or a Secondary Index.
2
Design the index structure
Create a Global Secondary Index (GSI) with `Category` as the partition key and `UploadTimestamp` as the sort key.
This allows query operations to target specific categories and obtain sorted results by timestamp without scanning the table. Projecting only required attributes reduces RCU consumption.
3
Select the API operation
Use the Query API on the GSI with a KeyConditionExpression for the category and a FilterExpression for the rating.
Query operations are much more efficient than Scan operations because they only read items that share the partition key value.

Anahtar Kavram

Using Global Secondary Indexes (GSIs) and Query operations to optimize data retrieval and minimize Read Capacity Unit consumption.
Tahmini Süre:1m 30s
Soru 444Soru

A logistics company tracks fleet vehicle coordinates using IoT devices. The devices stream geolocation data to an Amazon Kinesis Data Stream. An AWS Lambda function is configured as a consumer to process batches of records and write them to a database inside a private VPC subnet. During peak hours, the developer notices two issues:
1. Some shards in the Kinesis Data Stream are experiencing ProvisionedThroughputExceededException errors, while others are underutilized.
2. The Lambda function runs but is unable to connect to external endpoints to fetch auxiliary driver details, resulting in connection timeouts.

Which two actions should the developer take to resolve these issues? (Select TWO.)

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

Cevabı ve açıklamayı göster

Cevap: Modify the producer application to use a high-entropy partition key, such as a combination of vehicle ID and timestamp, instead of a static region ID.; Configure a NAT Gateway in a public subnet of the VPC, and update the route table of the private subnet to route all outbound traffic (0.0.0.0/00.0.0.0/0) to the NAT Gateway.

Cevap

Modify the producer application to use a high-entropy partition key (vehicle ID combined with a timestamp) and configure a NAT Gateway in a public subnet of the VPC to route outbound traffic from the private subnet.
Using a high-entropy partition key (vehicle ID combined with a timestamp) ensures data is evenly distributed across Kinesis shards, avoiding hot shards. Configuring a NAT Gateway in a public subnet and updating the private subnet route tables provides the Lambda function inside the private subnet with a valid path to route outbound traffic to the internet.

Adım Adım Çözüm

1
Analyze Kinesis Data Stream metrics and identify that uneven write distribution is causing ProvisionedThroughputExceededException errors.
Confirm that a low-entropy partition key (region ID) causes hot shards.
Correcting the partition key to a high-entropy value (vehicle ID and timestamp) ensures write distribution across all shards.
2
Inspect Lambda configuration and subnets to identify why outbound connections to external endpoints are failing.
Confirm the Lambda function is in private subnets with no route to the internet.
Lambda functions in private VPC subnets require a NAT Gateway in a public subnet to communicate with external endpoints.

Anahtar Kavram

Amazon Kinesis Data Stream partitioning and AWS Lambda VPC network routing.
Soru 445Soru

A developer is building a dashboard for an IoT smart home application. The application must retrieve the status logs of a specific smart device (identified by `DeviceId`) over the past 24 hours from an Amazon DynamoDB table named `DeviceStatusLogs`. The table's primary key consists of `DeviceId` (partition key) and `Timestamp` (sort key). Which approach should the developer use to retrieve this data with the lowest latency and the most efficient use of Read Capacity Units (RCUs)?

Cevabı ve açıklamayı göster

Cevap: Perform a Query operation on the table with a KeyConditionExpression that specifies the DeviceId and a range condition on the Timestamp sort key.

Cevap

Perform a Query operation on the table with a KeyConditionExpression that specifies the DeviceId and a range condition on the Timestamp sort key.
The correct approach is to perform a Query operation on the table with a KeyConditionExpression that specifies the DeviceId partition key and a range condition on the Timestamp sort key. This allows DynamoDB to efficiently look up only the relevant items in the specific partition within the specified time range, consuming fewer RCUs and returning results with lower latency.

Adım Adım Çözüm

1
Identify the primary key structure of the target DynamoDB table.
The table has a composite primary key: `DeviceId` as the partition key and `Timestamp` as the sort key.
This tells us we can perform query operations that target specific partitions and sort ranges directly.
2
Evaluate DynamoDB operations to find the most efficient method for retrieving specific items.
A Query operation allows us to specify the partition key exactly and apply comparison operators on the sort key.
This ensures DynamoDB only reads physical items matching the partition key and the time range, minimizing RCU consumption.
3
Construct the Query parameters with KeyConditionExpression.
Set `KeyConditionExpression` to `DeviceId = :devId AND #ts >= :startTime`.
This targets the specific device and filters the timestamp range at the storage layer prior to returning data.

Anahtar Kavram

DynamoDB Query vs Scan optimization and SDK credential best practices.
Tahmini Süre:1m 30s
Soru 446Soru

A developer is designing a content management system (CMS) that stores article metadata in an Amazon DynamoDB table. The table's partition key is ArticleId. The developer needs to support two new access patterns:

1. Retrieve all articles belonging to a specific AuthorCategory (such as 'Technology' or 'Finance') sorted by their PublishDate.
2. Retrieve all articles belonging to a specific AuthorCategory sorted by their ViewCount.

Which two solutions should the developer implement to meet these requirements with the lowest latency and optimal read capacity consumption? (Select TWO.)

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

Cevabı ve açıklamayı göster

Cevap: Create a Global Secondary Index (GSI) with AuthorCategory as the partition key and PublishDate as the sort key.; Create a Global Secondary Index (GSI) with AuthorCategory as the partition key and ViewCount as the sort key.

Cevap

Create a Global Secondary Index (GSI) with AuthorCategory as the partition key and PublishDate as the sort key, and create another Global Secondary Index (GSI) with AuthorCategory as the partition key and ViewCount as the sort key.
To support queries with a partition key (AuthorCategory) that differs from the base table's partition key (ArticleId), Global Secondary Indexes (GSIs) must be created. The first GSI uses AuthorCategory as the partition key and PublishDate as the sort key, enabling sorted queries by publication date. The second GSI uses AuthorCategory as the partition key and ViewCount as the sort key, enabling sorted queries by view count. Using Query operations on these GSIs ensures low latency and efficient capacity consumption.

Adım Adım Çözüm

1
Analyze the access pattern requirements.
The application needs to query articles by AuthorCategory (which is not the partition key of the base table, ArticleId) and sort them by PublishDate and ViewCount.
Understanding the required partition and sort keys for the queries is necessary to design the correct index structure.
2
Determine the appropriate index type.
Since the partition key of the queries (AuthorCategory) is different from the base table's partition key (ArticleId), Global Secondary Indexes (GSIs) must be used. Local Secondary Indexes (LSIs) cannot be used because they require the same partition key as the base table.
Choosing GSIs over LSIs ensures that queries can filter by a non-key attribute as the partition key.
3
Define the GSIs.
Create one GSI with AuthorCategory as the partition key and PublishDate as the sort key, and a second GSI with AuthorCategory as the partition key and ViewCount as the sort key.
This setup allows Query operations to return sorted results directly from the index, minimizing latency and Read Capacity Unit (RCU) consumption.

Anahtar Kavram

Using Global Secondary Indexes (GSIs) in Amazon DynamoDB to support query patterns with partition keys different from the base table's partition key, avoiding inefficient Scan operations.
Soru 447Soru

A retail company is developing a web analytics application to track user clickstream data in real time. The website events are sent to an Amazon Kinesis Data Stream. An AWS Lambda function is configured as the consumer to process these records and write aggregated metrics to a database. During peak traffic, the developer notices a high rate of ProvisionedThroughputExceededException errors on a single shard, even though the overall stream throughput is well below the limit. Additionally, the Lambda function occasionally terminates before completing the processing of its batch. Which action should the developer take to resolve these issues?

Cevabı ve açıklamayı göster

Cevap: Modify the producer to use a high-entropy partition key such as session_id instead of a static value, and increase the Lambda function's timeout or decrease its batch size.

Cevap

Modify the producer to use a high-entropy partition key such as session_id instead of a static value, and increase the Lambda function's timeout or decrease its batch size.
Using a high-entropy partition key such as session_id ensures that data is evenly distributed across all shards in the stream, preventing a single shard from becoming a bottleneck and throwing ProvisionedThroughputExceededException errors. Adjusting the Lambda function's timeout or decreasing the batch size ensures the function has sufficient time to complete processing before the execution is terminated.

Adım Adım Çözüm

1
Analyze the ProvisionedThroughputExceededException on Kinesis.
Identify that the exception occurs on a single shard despite low overall stream usage, indicating an uneven partition key distribution (a hot shard).
Kinesis uses partition keys to determine which shard receives a record. A low-entropy or static key concentrates data on one shard.
2
Select a high-entropy partition key.
Change the partition key to a unique identifier such as session_id on the producer side.
High-entropy keys ensure even hashing and distribution of records across all available shards.
3
Resolve the Lambda function premature termination.
Increase the Lambda execution timeout limit or decrease the batch size of the Kinesis event source mapping.
Lambda functions must be configured to accommodate the batch size processing time; otherwise, the execution terminates before the batch completes.

Anahtar Kavram

Even shard distribution using high-entropy partition keys in Amazon Kinesis Data Streams, combined with aligning Lambda batch size and timeout settings.
Soru 448Soru

A developer is building an e-learning application. The application tracks student progress in an Amazon DynamoDB table named `CourseEnrollments`. The table uses `StudentID` as the partition key and `CourseID` as the sort key. The table contains attributes such as `CompletionPercentage` and `LastAccessedDate`. The developer needs to retrieve all progress records for a specific student where the `CompletionPercentage` is greater than 80%80\%. Which approach should the developer take to retrieve these records while minimizing the Read Capacity Units (RCUs) consumed?

Cevabı ve açıklamayı göster

Cevap: Perform a `Query` operation specifying the `StudentID` in the `KeyConditionExpression`, and use a `FilterExpression` to evaluate the `CompletionPercentage`.

Cevap

Perform a `Query` operation specifying the `StudentID` in the `KeyConditionExpression`, and use a `FilterExpression` to evaluate the `CompletionPercentage`.
The correct approach is to perform a `Query` operation specifying the partition key (`StudentID`) in the `KeyConditionExpression`, and then use a `FilterExpression` to narrow the results based on the `CompletionPercentage`. A `Query` operation only reads items that match the specified partition key, which significantly reduces the amount of data read and the number of Read Capacity Units (RCUs) consumed compared to a table scan. The `FilterExpression` is applied after the query reads the items from the partition but before returning the results to the application.

Adım Adım Çözüm

1
Identify the primary key structure of the DynamoDB table.
The table has a composite primary key consisting of a partition key (`StudentID`) and a sort key (`CourseID`).
Understanding the primary key structure allows the developer to choose the most efficient data retrieval operation.
2
Compare the efficiency of `Query` and `Scan` operations for retrieving data for a specific partition key.
A `Query` operation directly targets the partition for the specified `StudentID`, whereas a `Scan` operation evaluates every item in the entire table.
Restricting the read operation to a single partition using `Query` minimizes RCU consumption.
3
Apply filtering for the non-key attribute `CompletionPercentage`.
A `FilterExpression` is applied to discard items where the completion percentage is not greater than 80%80\% after the `Query` retrieves the partition items.
Since `CompletionPercentage` is not part of the primary key, it cannot be included in the `KeyConditionExpression` and must be evaluated using a `FilterExpression`.

Anahtar Kavram

DynamoDB Query vs Scan efficiency and RCU optimization
Tahmini Süre:1m 30s
Soru 449Soru

A developer is designing a real-time inventory management system for a global retail chain. Stock levels for millions of unique Stock Keeping Units (SKUs) across 500 warehouses are updated constantly. These updates are published to an Amazon Kinesis Data Stream. During peak sales events, the application's producers frequently encounter ProvisionedThroughputExceededException errors when writing to the stream, even though the overall write throughput of the stream is well below the stream's aggregate capacity. Which partition key design should the developer implement to resolve this issue?

Cevabı ve açıklamayı göster

Cevap: Use the SKU as the partition key to distribute write operations evenly across all available shards.

Cevap

Use the SKU as the partition key to distribute write operations evenly across all available shards.
Using the SKU as the partition key provides high entropy (millions of unique values) compared to the number of shards. This ensures that records are distributed evenly across all shards, preventing any single shard from becoming a bottleneck (hot shard) and resolving the ProvisionedThroughputExceededException.

Adım Adım Çözüm

1
Analyze the nature of the ProvisionedThroughputExceededException error during writes.
The error indicates that a single shard is exceeding its limits (1 MB/sec or 1,000 records/sec for writes), which is typically caused by an uneven distribution of records (a hot shard).
Understanding why the exception occurs is necessary to target the root cause (uneven record routing).
2
Evaluate the partition keys of the incoming records.
Using keys with low cardinality/entropy (like warehouse ID or static keys) causes Kinesis to hash multiple active records to the same shard.
Analyzing partition key entropy helps determine how evenly records will be hashed and mapped to the stream's shards.
3
Select a partition key with high entropy (cardinality).
Using the unique SKU (millions of values) ensures uniform hash distribution across all shards.
High-entropy partition keys ensure a balanced load across all shards, maximizing the aggregate throughput of the stream.

Anahtar Kavram

Selecting high-entropy partition keys is crucial in Amazon Kinesis Data Streams to prevent uneven data distribution and avoid hot shards that trigger ProvisionedThroughputExceededException during writes.
Soru 450Soru

A developer is building a dispatch system for a ride-sharing application. The application streams real-time driver location updates to an Amazon Kinesis Data Stream. An AWS Lambda function deployed inside a private subnet of a VPC processes the stream to update an Amazon RDS database. In addition, the developer must route specific high-priority alert events from the stream to an Amazon EventBridge custom event bus. Which two actions should the developer take to ensure optimal stream shard utilization, prevent connectivity issues, and maintain secure integration? (Select TWO.)

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

Cevabı ve açıklamayı göster

Cevap: Configure the stream producer to use a high-entropy string, such as a hash of the driver ID and a timestamp, as the partition key for each location update.; Deploy a NAT Gateway in the public subnet or configure interface VPC endpoints for Kinesis and EventBridge in the VPC.

Cevap

The developer should configure the stream producer to use a high-entropy partition key (such as a hash of the driver ID and timestamp) and deploy a NAT Gateway or configure VPC endpoints in the VPC.
To achieve optimal shard utilization and avoid throttling, records must be distributed evenly across shards. This is done by using a high-entropy partition key (such as a hash of the driver ID and a timestamp). Additionally, because the Lambda function is deployed within a private VPC subnet, it cannot access public endpoints like Kinesis and EventBridge by default. Providing a NAT Gateway or setting up VPC endpoints allows the function to securely reach these services.

Adım Adım Çözüm

1
Analyze partition key strategy for record distribution.
Select a partition key with high entropy to distribute traffic across shards.
Kinesis uses partition keys to determine which shard receives a record. A low-entropy key causes hot shards.
2
Resolve network connectivity for the private subnet Lambda function.
Provision a NAT Gateway in a public subnet or configure interface VPC endpoints (PrivateLink) for Kinesis and EventBridge.
Lambda functions in private subnets cannot access public AWS endpoints directly without a route to the internet or service endpoints.
3
Verify IAM execution role trust relationships.
Ensure the execution role's trust policy targets the Lambda service principal, and grant read/write permissions via policy statements.
AWS Lambda polls the stream and assumes the execution role; Kinesis does not perform the invocation.

Anahtar Kavram

Distributing stream records with high-entropy partition keys and enabling public AWS service connectivity for VPC-bound Lambda functions.
Soru 451Soru

A developer is building an IoT application where temperature sensors send data to an Amazon Kinesis Data Stream. An AWS Lambda function is configured to process the stream in batches and write the processed records to a database inside a private subnet of a VPC. During testing, the developer notices two issues: some shards are heavily throttled with ProvisionedThroughputExceededException errors, and the Lambda function cannot access the Kinesis stream endpoints to read the records. How should the developer resolve both the stream throttling and the Lambda connectivity issues?

Cevabı ve açıklamayı göster

Cevap: Select the unique device ID as the Kinesis partition key to distribute data evenly across shards, and configure interface VPC endpoints for Kinesis in the VPC to allow the Lambda function to access the stream.

Cevap

Select the unique device ID as the Kinesis partition key to distribute data evenly across shards, and configure interface VPC endpoints for Kinesis in the VPC to allow the Lambda function to access the stream.
The correct option addresses both the data distribution and network access requirements. First, using the unique device ID as the partition key provides high entropy, which distributes the data evenly across Kinesis shards, preventing hot shards and ProvisionedThroughputExceededException errors. Second, deploying interface VPC endpoints (AWS PrivateLink) inside the VPC allows the Lambda function in the private subnet to securely communicate with Kinesis endpoints without routing traffic over the public internet.

Adım Adım Çözüm

1
Analyze partition key entropy for Kinesis Data Streams.
Using a high-entropy value like the unique device ID distributes records uniformly across shards, avoiding the hot shard problem.
Uneven data distribution causes ProvisionedThroughputExceededException errors when one shard receives disproportionate traffic.
2
Address private subnet network routing for AWS Lambda.
By adding interface VPC endpoints (PrivateLink) for Kinesis, traffic stays within the AWS network and allows the private Lambda function to reach the service.
Lambda functions in private subnets cannot access public AWS endpoints directly unless they go through a NAT Gateway or VPC endpoints.

Anahtar Kavram

Selecting high-entropy partition keys for Amazon Kinesis to avoid hot shards, and using VPC endpoints for private resource connectivity.
Soru 452Soru

A developer is building a supply chain shipment tracking application that stores transit logs in an Amazon DynamoDB table. Each item contains metadata about a shipment, including ShipmentID (partition key), TransitTime (sort key), and the current WarehouseID where the shipment is located. The application needs to retrieve all transit logs for a specific shipment that occurred within the last 48 hours. The table contains over 10 million items. Which of the following approaches is the most performant and cost-effective method to retrieve the required transit logs?

Cevabı ve açıklamayı göster

Cevap: Perform a Query operation on the table using a KeyConditionExpression for the ShipmentID and a range comparison on the TransitTime attribute.

Cevap

Perform a Query operation on the table using a KeyConditionExpression for the ShipmentID and a range comparison on the TransitTime attribute.
Performing a Query operation with a KeyConditionExpression is the most performant and cost-effective approach. DynamoDB directly targets the partition associated with the partition key (ShipmentID) and uses the sort key (TransitTime) to narrow down the results, consuming RCUs only for the items read rather than the entire table.

Adım Adım Çözüm

1
Analyze the table's key schema and query requirements.
The table has ShipmentID as the partition key and TransitTime as the sort key. The search requires finding logs for a specific ShipmentID within a specific TransitTime range.
Understanding the key structure determines if we can perform a direct key-based lookup (Query) or if a full-table Scan is required.
2
Evaluate the performance and cost impact of the Query operation compared to the Scan operation.
A Query only reads the items in the specific ShipmentID partition. A Scan reads all 10 million items in the table, incurring excessive costs and latency.
Selecting Query over Scan is the standard best practice for retrieving items sharing the same partition key.
3
Formulate the final API request using KeyConditionExpression.
A Query with a KeyConditionExpression specifying the ShipmentID and a range condition on TransitTime is identified as the optimal method.
This guarantees that DynamoDB only reads the subset of items that match the criteria, maximizing performance and minimizing RCUs.

Anahtar Kavram

Selecting Query over Scan for efficient data retrieval in DynamoDB using the primary key structure.
Soru 453Soru

A developer is building a security auditing system. An application publishes security events to Amazon EventBridge. A specific rule on the EventBridge event bus matches high-priority authorization failure events and routes them to an Amazon Kinesis Data Stream. An AWS Lambda function is configured to process events from the Kinesis Data Stream to detect potential security threats in real-time. During testing, the developer observes two issues:

1. The Kinesis Data Stream is experiencing throughput throttling on a single shard, even though the overall data volume is well below the stream's aggregate limit.
2. The Lambda function, which is deployed in a private VPC subnet to access a database, is failing to call the EventBridge API to publish alerts.

Which two actions should the developer take to resolve these issues?

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

Cevabı ve açıklamayı göster

Cevap: Update the producer application to use a high-entropy partition key, such as the unique userId, when publishing events to the Amazon Kinesis Data Stream.; Create an interface VPC endpoint (AWS PrivateLink) for Amazon EventBridge in the VPC, or route the private subnet traffic through a NAT Gateway in a public subnet.

Cevap

To resolve the issues, the developer should configure the producer application to use a high-entropy partition key like the unique userId for Kinesis Data Streams, and establish VPC network connectivity for the Lambda function using an interface VPC endpoint or a NAT Gateway.
The correct approach involves using a high-entropy partition key (such as userId) to distribute traffic evenly across shards, and resolving the private VPC subnet's lack of internet/AWS public service connectivity by creating a VPC endpoint or routing through a NAT Gateway.

Adım Adım Çözüm

1
Analyze the Kinesis Data Stream throttling.
Determine that the static partition key is causing a hot shard.
Using low-entropy keys like static strings hashes all records to the same shard.
2
Analyze the Lambda VPC network failure.
Identify the lack of internet or service routing from the private subnet.
Lambda functions in private subnets cannot reach public AWS endpoints without a NAT Gateway or VPC endpoint.
3
Implement the fixes.
Change the partition key design to userId and configure PrivateLink or a NAT Gateway.
This distributes the stream load across shards and opens a network path to the EventBridge API.

Anahtar Kavram

Stream Processing and Event Routing with Amazon Kinesis and EventBridge
Soru 454Soru

A developer is designing a real-time order processing system for an e-commerce platform. The system must ingest order events, execute real-time fraud analysis, and route notifications to third-party shipping partners. Order volume spikes unpredictably during promotional events, and the events must be processed in the strict order they are received for each unique customer. The developer decides to use Amazon Kinesis Data Streams for ingestion and Amazon EventBridge for event routing. Which TWO configurations or practices should the developer implement to meet these requirements?

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

Cevabı ve açıklamayı göster

Cevap: Use the customer ID as the partition key when publishing events to the Kinesis Data Stream to ensure that events for the same customer are routed to the same shard and processed in order.; Create an EventBridge rule with an event pattern that filters for specific order status events and routes them to shipping partners using API destinations.

Cevap

Use the customer ID as the partition key when publishing events to the Kinesis Data Stream, and create an EventBridge rule with an event pattern that filters for specific order status events and routes them to shipping partners using API destinations.
Using the customer ID as the partition key ensures that all records containing events for the same customer map to the same shard. Since Kinesis guarantees ordered delivery within a single shard, events are processed sequentially. Additionally, EventBridge rules combined with API destinations provide a native way to filter events and post them to third-party shipping HTTP endpoints without managing custom polling logic.

Adım Adım Çözüm

1
Select a partition key strategy that ensures ordered processing.
Using the customer ID as the partition key hashes the key to assign all events for a specific customer to the same Kinesis shard, guaranteeing they are processed in order.
Kinesis guarantees order within a shard, so related events must go to the same shard.
2
Set up event filtering and routing for third-party endpoints.
Create an EventBridge rule to match order-placed events and use API destinations to call third-party shipping APIs.
EventBridge integrates natively with third-party HTTP endpoints using API destinations.

Anahtar Kavram

Preserving order in Kinesis streams using high-entropy partition keys and routing events to HTTP targets via EventBridge API destinations.
Soru 455Soru

A developer is implementing a serverless stream processing application. Real-time telemetry data is ingested into an Amazon Kinesis data stream. An AWS Lambda function is configured with an active event source mapping to process the stream records. The Lambda function is deployed within a private subnet of an Amazon VPC to securely access an internal database, but it also needs to make HTTP calls to an external API to enrich the incoming telemetry data. During testing, the developer observes that the Kinesis stream is experiencing a hot shard issue, resulting in ProvisionedThroughputExceededException errors on a single shard even though overall stream throughput is well below the limits, and the Lambda function fails to connect to the external API, causing execution timeouts. Which set of modifications will resolve both issues?

Cevabı ve açıklamayı göster

Cevap: Modify the producer to use a high-entropy value such as a combination of device identifier and timestamp as the partition key, and deploy a NAT Gateway in a public subnet with routing configured from the private subnet.

Cevap

Modify the producer to use a high-entropy value such as a combination of device identifier and timestamp as the partition key, and deploy a NAT Gateway in a public subnet with routing configured from the private subnet.
The correct answer resolves both issues by using a high-entropy partition key (device identifier and timestamp) to distribute stream ingestion traffic uniformly across shards, and by deploying a NAT Gateway in a public subnet to allow the Lambda function inside the private subnet to reach the external API.

Adım Adım Çözüm

1
Address the hot shard issue in the Kinesis stream by using a high-entropy partition key.
Selecting a partition key that has high entropy (such as a device identifier combined with a timestamp) ensures that records are distributed uniformly across all available shards, avoiding ProvisionedThroughputExceededException errors.
Kinesis determines which shard a record is sent to based on the hash of its partition key. Low-entropy keys cause data to concentrate on specific shards.
2
Address the Lambda network connectivity issue in the VPC.
Deploy a NAT Gateway in a public subnet of the VPC and update the private subnet's route table to forward 0.0.0.0/0 traffic to the NAT Gateway.
Lambda functions in private VPC subnets do not have public IP addresses and cannot communicate directly with the public internet via an Internet Gateway. A NAT Gateway is required to translate private IPs to public IPs for outbound traffic.

Anahtar Kavram

Partition key design in Amazon Kinesis Data Streams and egress network routing for AWS Lambda functions in a VPC.
Tahmini Süre:1m 30s
Soru 456Soru

A developer is managing a high-throughput ticketing application where transaction records are stored in an Amazon DynamoDB table. The table uses EventId as the partition key and TransactionId as the sort key. During a flash sale for a highly anticipated concert, the application experiences a surge in write requests for that specific concert, resulting in ProvisionedThroughputExceededException errors. However, CloudWatch metrics indicate that the table's overall consumed write capacity is far below the total provisioned write capacity. Which approach should the developer take to resolve this throttling issue?

Cevabı ve açıklamayı göster

Cevap: Implement write sharding by appending a randomized suffix to the EventId partition key value, and adjust the query logic to aggregate results across these sharded partitions.

Cevap

Implement write sharding by appending a randomized suffix to the EventId partition key value, and adjust the query logic to aggregate results across these sharded partitions.
The correct option is to implement write sharding by appending a randomized suffix to the partition key. Because the throttling is caused by a hot partition key (high volume of writes to a single EventId), distributing the writes across sharded keys (e.g., EventId_1, EventId_2) allows DynamoDB to utilize multiple physical partitions. The application must then query all sharded partition keys to retrieve the full dataset.

Adım Adım Çözüm

1
Analyze the exception and the CloudWatch metrics.
The ProvisionedThroughputExceededException occurs despite the overall consumed capacity being below the provisioned limit, indicating a partition-level hot key issue rather than a table-level capacity issue.
DynamoDB distributes table capacity across multiple physical partitions based on the partition key. A high concentration of requests to a single partition key (a hot partition key) will throttle that partition even if the table-level limit is not reached.
2
Evaluate the solutions to mitigate hot partition keys.
Adding a randomized suffix (sharding) to the partition key distributes the write load across multiple partition keys.
By appending a suffix such as a random integer between 11 and NN, the single hot key is split into NN distinct keys, dispersing the traffic across multiple physical partitions.
3
Determine the changes required in the read path.
Modify the query logic to retrieve and aggregate results from all NN sharded partition keys.
Since the data is now distributed across multiple partition keys, a single query on the original partition key will no longer return all results; queries must be run across all sharded variations.

Anahtar Kavram

Mitigating hot partition keys in DynamoDB using write sharding
Soru 457Soru

A developer is building a smart home application that processes real-time device state updates from thousands of smart hubs. The hubs publish state updates to an Amazon Kinesis Data Stream. An AWS Lambda function, configured with an Event Source Mapping, processes the stream in batches. The Lambda function needs to query an Amazon ElastiCache for Redis cluster located in a private VPC subnet to retrieve device owner metadata, and then send alert notifications to an external push notification gateway API.

The developer configures the Lambda function to run inside the same private VPC subnets. However, during testing, the Lambda function fails to connect to the external API, resulting in batch processing failures.

Which configuration should the developer implement to resolve the connectivity issue and process the stream efficiently?

Cevabı ve açıklamayı göster

Cevap: Provision a NAT Gateway in a public VPC subnet, configure the route table of the private subnets to direct outbound traffic (0.0.0.0/00.0.0.0/0) to the NAT Gateway, and ensure the smart hubs write to the Kinesis stream using a high-entropy partition key, such as a unique device ID.

Cevap

Provision a NAT Gateway in a public VPC subnet, configure the route table of the private subnets to direct outbound traffic to the NAT Gateway, and ensure the smart hubs write to the Kinesis stream using a high-entropy partition key, such as a unique device ID.
To allow the Lambda function to reach the external notification gateway API while retaining access to the private ElastiCache cluster, the function must remain in private subnets, and internet-bound traffic (0.0.0.0/00.0.0.0/0) must be routed through a NAT Gateway provisioned in a public subnet. Additionally, using a high-entropy partition key (such as the unique device ID) is critical for stream efficiency as it distributes the incoming payloads evenly across shards, preventing the Kinesis stream from experiencing hot shards and ProvisionedThroughputExceededException.

Adım Adım Çözüm

1
Analyze the network configuration of the Lambda function running inside the VPC.
The Lambda function is inside private subnets and can access the ElastiCache cluster, but it cannot access the external API because private subnets do not have direct routes to the internet.
Identify why the Lambda function fails to connect to the external API.
2
Determine the required network components for outbound internet access from private VPC subnets.
A NAT Gateway must be provisioned in a public subnet, and the route table for the private subnets must direct outbound traffic (0.0.0.0/00.0.0.0/0) to the NAT Gateway.
Establish routing for outbound external API requests from private subnets.
3
Evaluate Kinesis partition key strategies for processing updates from thousands of devices.
A high-entropy partition key (like a unique device ID) distributes records evenly across shards, avoiding hot shards and provisioning issues, whereas static or low-entropy keys (like manufacturer name) lead to hot shards.
Optimize stream processing performance and avoid write throttling.

Anahtar Kavram

Outbound VPC connectivity for AWS Lambda and partition key optimization for Kinesis Data Streams.
Soru 458Soru

A developer is building a recipe sharing platform. The recipes are stored in an Amazon DynamoDB table with `RecipeID` as the partition key. Each recipe item contains attributes such as `Title`, `PrepTime`, and `Category` (e.g., 'Dessert', 'Main Course'). The application homepage needs to display all recipes in the 'Dessert' category. The developer wants to retrieve these items while minimizing the latency and the consumption of Read Capacity Units (RCUs).

Which approach should the developer take to retrieve these recipes?

Cevabı ve açıklamayı göster

Cevap: Create a Global Secondary Index (GSI) with `Category` as the partition key, and perform a `Query` operation on the GSI using the category value.

Cevap

Create a Global Secondary Index (GSI) with `Category` as the partition key, and perform a `Query` operation on the GSI using the category value.
The correct answer is to create a Global Secondary Index (GSI) with `Category` as the partition key and query the GSI. Because the base table's partition key is `RecipeID`, querying by `Category` is not directly supported on the base table. By creating a GSI, you can perform a `Query` operation that target-retrieves only the items matching the 'Dessert' category. This consumes RCUs only for the matched items and projected attributes, offering low latency and maximum cost-efficiency.

Adım Adım Çözüm

1
Analyze the table structure and the retrieval requirements.
The base table uses `RecipeID` as the partition key. To find all items in a specific category, a query on the base table is not possible because it requires a specific `RecipeID` in the KeyConditionExpression.
This establishes that querying the base table directly for a category is not viable.
2
Compare the impact of Scan vs Indexing.
A Scan operation reads all items in the base table, consuming RCUs proportional to the total size of the table. Creating a GSI with `Category` as the partition key allows the application to query the GSI directly.
This shows how a GSI changes the access pattern from a scan to a targeted query.
3
Select the optimal strategy that minimizes RCUs and latency.
Querying the GSI using the category value as the key condition retrieves only the items that match the category, minimizing RCUs consumed and reducing latency.
This identifies the most efficient and cost-effective approach.

Anahtar Kavram

Using Global Secondary Indexes (GSIs) to enable query operations on non-key attributes in Amazon DynamoDB.
Soru 459Soru

A developer is designing a backend service for a smart fitness application. The application tracks user workout histories in an Amazon DynamoDB table. The table uses `UserID` as the partition key and `WorkoutTimestamp` as the sort key. The developer needs to implement two features:

1. Retrieve only the single most recent workout session for a given user.
2. Log a new workout session and update the user's weekly streak counter simultaneously, ensuring that both operations must either succeed together or fail together.

Which combination of DynamoDB operations and configurations should the developer implement to meet these requirements? (Select TWO.)

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

Cevabı ve açıklamayı göster

Cevap: Perform a `Query` operation on the table with `ScanIndexForward` set to `false` and `Limit` set to 11.; Perform a `TransactWriteItems` operation containing a `Put` action for the workout and an `Update` action for the streak counter.

Cevap

To meet the requirements, the developer must perform a Query operation with ScanIndexForward set to false and Limit set to 1 to retrieve the latest workout, and use TransactWriteItems to write the workout and update the streak counter atomically.
The correct options are performing a Query with ScanIndexForward set to false and Limit set to 1, and using TransactWriteItems. Querying with ScanIndexForward set to false scans the sort key in descending order, so a Limit of 1 retrieves only the latest workout. TransactWriteItems ensures that both the workout creation and the streak update succeed or fail together, maintaining data integrity.

Adım Adım Çözüm

1
Query the table for the user's workouts with descending sort order.
By specifying the UserID partition key and setting ScanIndexForward to false, DynamoDB traverses the WorkoutTimestamp sort key in descending order.
This puts the most recent workout at the beginning of the result set.
2
Apply a Limit parameter of 1 to the Query operation.
Only the single most recent workout item is retrieved from the table.
This minimizes the consumed Read Capacity Units (RCUs) by avoiding reading historical workouts.
3
Group the new workout creation and streak update into a TransactWriteItems call.
Both the Put and Update operations are executed in an all-or-nothing transaction.
This guarantees that the user's weekly streak counter is never out of sync with their logged workouts.

Anahtar Kavram

Using DynamoDB Query with sorting and limit features for retrieval, and TransactWriteItems for atomic updates across multiple items.
Tahmini Süre:2m 0s
Soru 460Soru

A developer is building a collaborative document editing application that stores revision history in an Amazon DynamoDB table. The table, named `DocumentRevisions`, uses `DocumentID` as the partition key and `RevisionTimestamp` (representing Unix epoch time in milliseconds) as the sort key. The developer needs to implement a feature to retrieve all revisions for a specific document created within the last 2424 hours, sorted from most recent to oldest. Which combination of actions should the developer take to achieve this with the best performance and minimal resource utilization? (Select TWO.)

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

Cevabı ve açıklamayı göster

Cevap: Perform a Query operation specifying the DocumentID and the range of RevisionTimestamp in the KeyConditionExpression.; Set the ScanIndexForward parameter to false in the request to return the results in descending order of the sort key.

Cevap

Perform a Query operation specifying the DocumentID and the range of RevisionTimestamp in the KeyConditionExpression, and set the ScanIndexForward parameter to false in the request to return the results in descending order of the sort key.
To retrieve revisions for a specific document within a certain time window in descending order, the developer should use a Query operation with a KeyConditionExpression containing the partition key (DocumentID) and a range condition on the sort key (RevisionTimestamp). Since Query returns items in ascending order of the sort key by default, setting ScanIndexForward to false reverses the order to descending, returning the most recent revisions first.

Adım Adım Çözüm

1
Determine the optimal DynamoDB API operation to retrieve items with a known partition key.
Identify that a Query operation is much more efficient than a Scan operation since Query targets a single partition key, whereas Scan reads the entire table.
Minimizing RCU consumption and latency.
2
Formulate the search criteria using KeyConditionExpression.
Specify the DocumentID partition key as an exact match and add a condition on the RevisionTimestamp sort key (e.g., greater than or equal to the timestamp from 24 hours ago).
Applying the key conditions directly to the query index filter rather than post-filtering with a FilterExpression.
3
Configure the sort order of the returned items.
Set the ScanIndexForward parameter to false to reverse the default ascending sort order of the sort key to descending (newest first).
Meeting the requirement to return the revisions sorted from most recent to oldest.

Anahtar Kavram

Optimizing read operations in Amazon DynamoDB by using Query instead of Scan and leveraging the ScanIndexForward parameter to control sort order.
ÖncekiSayfa 23 / 78Sonraki