使用 AWS 服务进行开发 I
对照所有选项回顾评估问题和解释,以确保你具备充分理解,从而自信应对 AWS 认证开发者 – Associate (DVA-C02) 考试中的各类问题。
Answer: B
Why:
A primary key uniquely identifies each record and cannot contain duplicates or null values, whereas an indexing key is used to speed up data retrieval and can contain duplicates or nulls.
Using UserId as the partition key and PostTimestamp as the base table’s sort key allows efficient retrieval of a user’s posts in chronological order. To support querying posts by hashtag across all users, a Global Secondary Index (GSI) is necessary. It allows for a different partition key (hashtag) and an optional sort key (PostTimestamp) for alternative access patterns. GSIs enable queries that are not possible with the base table’s primary key.
Why not:
Option A: While a composite primary key is good, PostTimestamp as the partition key would likely lead to hot partitions if posts are created frequently, as new data would continuously be written to the same partition. An LSI shares the same partition key as the base table, so it wouldn’t allow querying by hashtag across all users.
Option C: A GSI with PostTimestamp as the partition key would still suffer from hot partition issues for frequently created posts.
Option D: Using hashtag as the primary partition key would make retrieving all posts by a specific user difficult and inefficient.
Answer: D
Why:
Aurora Global Database is designed for latency-sensitive, globally distributed applications. It allows a single primary Aurora cluster to asynchronously replicate data to up to five secondary (read-only) clusters deployed in a different AWS Region. This provides fast local reads for global users and enables disaster recovery by promoting a secondary cluster to primary in case of regional failure.
Why not:
Option A: Multi-AZ DB Clusters provide high availability within a region, Aurora MySQL supports cross-region binlog-based replication, but not natively by Aurora PostgreSQL for cross-region replication outside the global database model.
Option B: Aurora Replicas enhance read throughput and availability within a single AWS Region, but they do not provide cross-region read capabilities or disaster recovery for regional failures.
Option C: Aurora Serverless v2 automatically adjusts capacity within a region and can support global databases, but it’s not the feature that provides global replication and disaster recovery.
Answer: C
Why:
Amazon Athena is a serverless, pay-per-query service that enables analysis of structured and semi-structured data in Amazon S3 using ANSI SQL, eliminating the need to manage infrastructure or provision resources. This addresses the requirements for minimizing operational overhead and automatic scaling for SQL-based analysis on S3 data.
Why not:
Option A: The data warehousing solution, Redshift, requires cluster management and provisioning, which contradicts the “minimize operational overhead” and “serverless” requirements.
Option B: DynamoDB is a NoSQL database, not designed for SQL-based analytical queries on S3 data.
Option C: OpenSearch is for search and analytics, but it’s primarily used for indexing and querying log data and does not directly analyze data in S3 using ANSI SQL in a pay-per-query model like Athena.
Answer: D
Why:
Kinesis Data Streams (KDS) allows building real-time applications that consume high-throughput data with millisecond latency. We write data to a stream using AWS SDKs or the AWS CLI, then process that data using consumers like Lambda functions, EC2 applications, or custom code. This fits the requirement for immediate consumption by other applications.
Why not:
Option A: Kinesis Data Firehose simplifies delivery of real-time streams to destinations like S3 or Redshift; it’s more for data delivery than direct real-time consumption by other applications for processing.
Option B: Kinesis Data Analytics provides real-time analytics capabilities using SQL or Apache Flink on streaming data, but it is not designed to be the primary ingestion point. Instead, it consumes data from streams (like Kinesis Data Streams or Firehose) and outputs processed analytical results, rather than directly supporting consumption by multiple downstream applications.
Option C: The messaging service, SQS, is typically used for decoupling components and asynchronous processing, not for high-throughput, millisecond-latency real-time stream ingestion.
Answer: A
Why:
Task definitions in ECS explicitly specify container parameters, including CPU, memory, Docker image details, ports, environment variables, and networking settings. They serve as blueprints for launching containers on EC2 instances or AWS Fargate.
Why not:
Option B: The container agent communicates task state and resource utilization information from ECS instances to the ECS service but does not define container configurations.
Option C: A service definition specifies how ECS runs and maintains a specified number of task instances, but doesn’t directly define container-level configurations such as CPU or Docker images.
Option D: Capacity providers manage the infrastructure capacity, such as EC2 Auto Scaling groups or Fargate capacity, for running ECS tasks, but don’t specify container settings.