AWS DVA-C02 Practice Questions with Explanations
Free AWS DVA-C02 practice questions. 50 of them, each with the correct answer, a full explanation, and the reason every other option is wrong. These are real questions from the DVA-C02 exam, not paraphrases, and every explanation is written out rather than just marking the right letter.
They are drawn from the same bank as the full DVA-C02 pack, which has 557 questions in total.
Get the full DVA-C02 question bank (557 questions) →
DVA-C02 practice questions
Question 1
A company is implementing an application on Amazon EC2 instances. The application needs to process incoming transactions. When the application detects a transaction that is not valid, the application must send a chat message to the company's support team. To send the message, the application needs to retrieve the access token to authenticate by using the chat API. A developer needs to implement a solution to store the access token. The access token must be encrypted at rest and in transit. The access token must also be accessible from other AWS accounts. Which solution will meet these requirements with the LEAST management overhead?
- A. Use an AWS Systems Manager Parameter Store SecureString parameter that uses an AWS Key Management Service (AWS KMS) AWS managed key to store the access token. Add a resource-based policy to the parameter to allow access from other accounts. Update the IAM role of the EC2 instances with permissions to access Parameter Store. Retrieve the token from Parameter Store with the decrypt flag enabled. Use the decrypted access token to send the message to the chat.
- B. Encrypt the access token by using an AWS Key Management Service (AWS KMS) customer managed key. Store the access token in an Amazon DynamoDB table. Update the IAM role of the EC2 instances with permissions to access DynamoDB and AWS KMS. Retrieve the token from DynamoDDecrypt the token by using AWS KMS on the EC2 instances. Use the decrypted access token to send the message to the chat.
- C. Use AWS Secrets Manager with an AWS Key Management Service (AWS KMS) customer managed key to store the access token. Add a resource-based policy to the secret to allow access from other accounts. Update the IAM role of the EC2 instances with permissions to access Secrets Manager. Retrieve the token from Secrets Manager. Use the decrypted access token to send the message to the chat.
- D. Encrypt the access token by using an AWS Key Management Service (AWS KMS) AWS managed key. Store the access token in an Amazon S3 bucket. Add a bucket policy to the S3 bucket to allow access from other accounts. Update the IAM role of the EC2 instances with permissions to access Amazon S3 and AWS KMS. Retrieve the token from the S3 bucket. Decrypt the token by using AWS KMS on the EC2 instances. Use the decrypted access token to send the massage to the chat.
Show answer and explanation ▾
Correct answer: C
AWS Secrets Manager is purpose-built for storing sensitive data like access tokens with automatic encryption at rest using KMS, encryption in transit via TLS, and built-in resource-based policy support for cross-account access. It requires the least management overhead compared to alternatives because it handles rotation, versioning, and access control natively. Parameter Store lacks native cross-account support without workarounds, DynamoDB and S3 require manual encryption and decryption logic on the application side.
Why the other options are wrong:
- A. Parameter Store SecureString requires additional workarounds for cross-account access and is not optimized for sensitive secrets management.
- B. DynamoDB requires manual encryption/decryption logic on EC2 instances and is not designed for secrets storage.
- D. S3 is not designed for secrets storage and requires manual encryption/decryption handling on the application side.
Question 2
A company is running Amazon EC2 instances in multiple AWS accounts. A developer needs to implement an application that collects all the lifecycle events of the EC2 instances. The application needs to store the lifecycle events in a single Amazon Simple Queue Service (Amazon SQS) queue in the company's main AWS account for further processing. Which solution will meet these requirements?
- A. Configure Amazon EC2 to deliver the EC2 instance lifecycle events from all accounts to the Amazon EventBridge event bus of the main account. Add an EventBridge rule to the event bus of the main account that matches all EC2 instance lifecycle events. Add the SQS queue as a target of the rule.
- B. Use the resource policies of the SQS queue in the main account to give each account permissions to write to that SQS queue. Add to the Amazon EventBridge event bus of each account an EventBridge rule that matches all EC2 instance lifecycle events. Add the SQS queue in the main account as a target of the rule.
- C. Write an AWS Lambda function that scans through all EC2 instances in the company accounts to detect EC2 instance lifecycle changes. Configure the Lambda function to write a notification message to the SQS queue in the main account if the function detects an EC2 instance lifecycle change. Add an Amazon EventBridge scheduled rule that invokes the Lambda function every minute.
- D. Configure the permissions on the main account event bus to receive events from all accounts. Create an Amazon EventBridge rule in each account to send all the EC2 instance lifecycle events to the main account event bus. Add an EventBridge rule to the main account event bus that matches all EC2 instance lifecycle events. Set the SQS queue as a target for the rule.
Show answer and explanation ▾
Correct answer: D
Option D correctly implements cross-account event routing by configuring the main account's event bus to receive events from other accounts, creating forwarding rules in each child account to send EC2 lifecycle events to the main account event bus, and then matching those events with an SQS queue target. This is the standard AWS pattern for centralized event collection across accounts using EventBridge's event bus permissions and rules.
Why the other options are wrong:
- A. EC2 cannot be directly configured to deliver events to another account's EventBridge; EventBridge rules in source accounts must forward events.
- B. SQS resource policies do not directly work with EventBridge event routing across accounts; EventBridge rules and event bus permissions are the correct mechanism.
- C. Polling Lambda every minute is inefficient, non-real-time, and not the recommended approach for event-driven architectures.
Question 3
An application is using Amazon Cognito user pools and identity pools for secure access. A developer wants to integrate the user-specific file upload and download features in the application with Amazon S3. The developer must ensure that the files are saved and retrieved in a secure manner and that users can access only their own files. The file sizes range from 3 KB to 300 MB. Which option will meet these requirements with the HIGHEST level of security?
- A. Use S3 Event Notifications to validate the file upload and download requests and update the user interface (UI).
- B. Save the details of the uploaded files in a separate Amazon DynamoDB table. Filter the list of files in the user interface (UI) by comparing the current user ID with the user ID associated with the file in the table.
- C. Use Amazon API Gateway and an AWS Lambda function to upload and download files. Validate each request in the Lambda function before performing the requested operation.
- D. Use an IAM policy within the Amazon Cognito identity prefix to restrict users to use their own folders in Amazon S3.
Show answer and explanation ▾
Correct answer: D
Using IAM policies within Cognito identity prefixes allows fine-grained, attribute-based access control where users can only access S3 paths matching their identity (e.g., s3:::bucket/cognito-identity/${cognito-identity.amazonaws.com:sub}/*). This provides the highest security by enforcing access at the AWS credential level rather than relying on application-level validation. It works for all file sizes and is built-in to AWS IAM.
Why the other options are wrong:
- A. S3 Event Notifications are for triggering actions after uploads, not for validating or securing access.
- B. DynamoDB filtering in the UI provides no actual security; users could bypass the UI and directly access files belonging to other users.
- C. API Gateway and Lambda add complexity and management overhead compared to native IAM policy-based access control through Cognito identity.
Question 4
A company is building a scalable data management solution by using AWS services to improve the speed and agility of development. The solution will ingest large volumes of data from various sources and will process this data through multiple business rules and transformations. The solution requires business rules to run in sequence and to handle reprocessing of data if errors occur when the business rules run. The company needs the solution to be scalable and to require the least possible maintenance. Which AWS service should the company use to manage and automate the orchestration of the data flows to meet these requirements?
- A. AWS Batch
- B. AWS Step Functions
- C. AWS Glue
- D. AWS Lambda
Show answer and explanation ▾
Correct answer: B
AWS Step Functions is purpose-built for orchestrating workflows with sequential execution of tasks, built-in error handling and retry logic, and automatic reprocessing capabilities. It requires minimal maintenance, scales automatically, and provides state machine-based orchestration ideal for managing complex business rules and transformations in sequence.
Why the other options are wrong:
- A. AWS Batch is for large-scale parallel batch computing, not sequential orchestration with error handling.
- C. AWS Glue is an ETL service focused on data cataloging and transformation, not workflow orchestration.
- D. AWS Lambda alone lacks native orchestration, sequencing, and error handling for complex multi-step workflows.
Question 5
A developer has created an AWS Lambda function that is written in Python. The Lambda function reads data from objects in Amazon S3 and writes data to an Amazon DynamoDB table. The function is successfully invoked from an S3 event notification when an object is created. However, the function fails when it attempts to write to the DynamoDB table. What is the MOST likely cause of this issue?
- A. The Lambda function's concurrency limit has been exceeded.
- B. DynamoDB table requires a global secondary index (GSI) to support writes.
- C. The Lambda function does not have IAM permissions to write to DynamoDB.
- D. The DynamoDB table is not running in the same Availability Zone as the Lambda function.
Show answer and explanation ▾
Correct answer: C
The Lambda function successfully reads from S3 (proven by successful invocation and data reading), but fails on DynamoDB writes. This indicates the execution role lacks DynamoDB write permissions. IAM permissions are the most common cause of such write failures in Lambda. The function needs explicit permissions to perform PutItem or similar write operations on the DynamoDB table.
Why the other options are wrong:
- A. Concurrency limits would prevent invocation, not individual write failures; the function is being invoked successfully.
- B. GSI is optional and not required for basic write operations; tables write to the base table automatically.
- D. Lambda can write to DynamoDB in any region/AZ; there is no AZ-based restriction for DynamoDB writes.
Question 6
A developer is creating an AWS CloudFormation template to deploy Amazon EC2 instances across multiple AWS accounts. The developer must choose the EC2 instances from a list of approved instance types. How can the developer incorporate the list of approved instance types in the CloudFormation template?
- A. Create a separate CloudFormation template for each EC2 instance type in the list.
- B. In the Resources section of the CloudFormation template, create resources for each EC2 instance type in the list.
- C. In the CloudFormation template, create a separate parameter for each EC2 instance type in the list.
- D. In the CloudFormation template, create a parameter with the list of EC2 instance types as AllowedValues.
Show answer and explanation ▾
Correct answer: D
CloudFormation parameters with AllowedValues constraint restrict user input to a predefined list of approved EC2 instance types. This is the cleanest, most maintainable approach that enforces the list at template design time and provides validation during stack creation. Users cannot select instance types outside the approved list.
Why the other options are wrong:
- A. Creating separate templates for each instance type is inefficient and not scalable.
- B. Creating resources for each instance type in the Resources section would create all instances, not allow selection of one.
- C. Creating separate parameters for each instance type is redundant and does not provide a unified list constraint.
Question 7
A company is running a custom application on a set of on-premises Linux servers that are accessed using Amazon API Gateway. AWS X-Ray tracing has been enabled on the API test stage. How can a developer enable X-Ray tracing on the on-premises servers with the LEAST amount of configuration?
- A. Install and run the X-Ray SDK on the on-premises servers to capture and relay the data to the X-Ray service.
- B. Install and run the X-Ray daemon on the on-premises servers to capture and relay the data to the X-Ray service.
- C. Capture incoming requests on-premises and configure an AWS Lambda function to pull, process, and relay relevant data to X-Ray using the PutTraceSegments API call.
- D. Capture incoming requests on-premises and configure an AWS Lambda function to pull, process, and relay relevant data to X-Ray using the PutTelemetryRecords API call.
Show answer and explanation ▾
Correct answer: B
The X-Ray daemon is the minimal installation required on on-premises servers to capture and relay trace data to the X-Ray service. The daemon runs as a background process, receives trace segments from applications via UDP, and forwards them to AWS. This requires the least configuration compared to SDK installation, which needs code integration and language-specific setup.
Why the other options are wrong:
- A. The SDK requires code integration into the application itself, which is more configuration than just running a daemon.
- C. Lambda-based pulling and processing adds unnecessary complexity and latency; the daemon is simpler.
- D. PutTelemetryRecords is for sampling statistics, not trace segments; PutTraceSegments is used for trace data, but Lambda is still overkill.
Question 8
A company wants to share information with a third party. The third party has an HTTP API endpoint that the company can use to share the information. The company has the required API key to access the HTTP API. The company needs a way to manage the API key by using code. The integration of the API key with the application code cannot affect application performance. Which solution will meet these requirements MOST securely?
- A. Store the API credentials in AWS Secrets Manager. Retrieve the API credentials at runtime by using the AWS SDK. Use the credentials to make the API call.
- B. Store the API credentials in a local code variable. Push the code to a secure Git repository. Use the local code variable at runtime to make the API call.
- C. Store the API credentials as an object in a private Amazon S3 bucket. Restrict access to the S3 object by using IAM policies. Retrieve the API credentials at runtime by using the AWS SDK. Use the credentials to make the API call.
- D. Store the API credentials in an Amazon DynamoDB table. Restrict access to the table by using resource-based policies. Retrieve the API credentials at runtime by using the AWS SDK. Use the credentials to make the API call.
Show answer and explanation ▾
Correct answer: A
AWS Secrets Manager is specifically designed for managing API keys, credentials, and other sensitive data. It provides automatic rotation, fine-grained access control via IAM, encryption at rest and in transit, and integrates seamlessly with the AWS SDK for runtime retrieval without impacting performance. The secret can be accessed programmatically without storing credentials in code.
Why the other options are wrong:
- B. Storing credentials in code variables and pushing to Git, even a secure repository, violates security best practices and creates exposure risks.
- C. S3 is not designed for secrets management; it lacks features like automatic rotation and is primarily for object storage, making it less secure for sensitive credentials.
- D. DynamoDB is not appropriate for secrets storage; it lacks encryption features purpose-built for credentials and should not be used for managing sensitive authentication data.
Question 9
A developer is deploying a new application to Amazon Elastic Container Service (Amazon ECS). The developer needs to securely store and retrieve different types of variables. These variables include authentication information for a remote API, the URL for the API, and credentials. The authentication information and API URL must be available to all current and future deployed versions of the application across development, testing, and production environments. How should the developer retrieve the variables with the FEWEST application changes?
- A. Update the application to retrieve the variables from AWS Systems Manager Parameter Store. Use unique paths in Parameter Store for each variable in each environment. Store the credentials in AWS Secrets Manager in each environment.
- B. Update the application to retrieve the variables from AWS Key Management Service (AWS KMS). Store the API URL and credentials as unique keys for each environment.
- C. Update the application to retrieve the variables from an encrypted file that is stored with the application. Store the API URL and credentials in unique files for each environment.
- D. Update the application to retrieve the variables from each of the deployed environments. Define the authentication information and API URL in the ECS task definition as unique names during the deployment process.
Show answer and explanation ▾
Correct answer: A
AWS Systems Manager Parameter Store allows centralized management of application configuration across multiple environments with minimal code changes. It supports hierarchical paths for environment-specific variables, integrates with IAM for access control, and works across all deployed versions. Credentials are separately stored in Secrets Manager, which provides additional security features. The application needs only one update to retrieve from Parameter Store.
Why the other options are wrong:
- B. AWS KMS is a key management service, not designed for storing and retrieving configuration variables; it would require multiple code updates and doesn't support the hierarchical organization needed.
- C. Encrypted files stored with the application require code changes for each environment and complicate version management across environments.
- D. Defining variables in ECS task definitions requires code changes for each deployment and doesn't provide a centralized management approach for current and future versions.
Question 10
A company is migrating legacy internal applications to AWS. Leadership wants to rewrite the internal employee directory to use native AWS services. A developer needs to create a solution for storing employee contact details and high-resolution photos for use with the new application. Which solution will enable the search and retrieval of each employee's individual details and high-resolution photos using AWS APIs?
- A. Encode each employee's contact information and photos using Base64. Store the information in an Amazon DynamoDB table using a sort key.
- B. Store each employee's contact information in an Amazon DynamoDB table along with the object keys for the photos stored in Amazon S3.
- C. Use Amazon Cognito user pools to implement the employee directory in a fully managed software-as-a-service (SaaS) method.
- D. Store employee contact information in an Amazon RDS DB instance with the photos stored in Amazon Elastic File System (Amazon EFS).
Show answer and explanation ▾
Correct answer: B
Storing contact information in DynamoDB enables efficient querying and retrieval of employee details using native APIs, while storing high-resolution photos in S3 (object storage optimized for large files) and referencing them via object keys in the DynamoDB table provides the best separation of concerns. This approach scales well, leverages AWS services appropriately, and allows independent management of metadata and binary content.
Why the other options are wrong:
- A. Base64 encoding photos and storing them in DynamoDB with contact information would bloat the database, degrade query performance, and is inefficient for large binary files.
- C. Amazon Cognito user pools are designed for identity and access management, not for storing and retrieving employee contact details and photos.
- D. RDS is for relational databases and not ideal for storing large binary files like high- resolution photos; EFS is a file system service, not a database-backed retrieval mechanism with proper indexing.
Question 11
A developer is creating an application that will give users the ability to store photos from their cellphones in the cloud. The application needs to support tens of thousands of users. The application uses an Amazon API Gateway REST API that is integrated with AWS Lambda functions to process the photos. The application stores details about the photos in Amazon DynamoDB. Users need to create an account to access the application. In the application, users must be able to upload photos and retrieve previously uploaded photos. The photos will range in size from 300 KB to 5 MB. Which solution will meet these requirements with the LEAST operational overhead?
- A. Use Amazon Cognito user pools to manage user accounts. Create an Amazon Cognito user pool authorizer in API Gateway to control access to the API. Use the Lambda function to store the photos and details in the DynamoDB table. Retrieve previously uploaded photos directly from the DynamoDB table.
- B. Use Amazon Cognito user pools to manage user accounts. Create an Amazon Cognito user pool authorizer in API Gateway to control access to the API. Use the Lambda function to store the photos in Amazon S3. Store the object's S3 key as part of the photo details in the DynamoDB table. Retrieve previously uploaded photos by querying DynamoDB for the S3 key.
- C. Create an IAM user for each user of the application during the sign-up process. Use IAM authentication to access the API Gateway API. Use the Lambda function to store the photos in Amazon S3. Store the object's S3 key as part of the photo details in the DynamoDB table. Retrieve previously uploaded photos by querying DynamoDB for the S3 key.
- D. Create a users table in DynamoDB. Use the table to manage user accounts. Create a Lambda authorizer that validates user credentials against the users table. Integrate the Lambda authorizer with API Gateway to control access to the API. Use the Lambda function to store the photos in Amazon S3. Store the object's S3 key as par of the photo details in the DynamoDB table. Retrieve previously uploaded photos by querying DynamoDB for the S3 key.
Show answer and explanation ▾
Correct answer: B
Amazon Cognito user pools handle account management without operational overhead. S3 is the appropriate service for storing large binary files (300 KB to 5 MB photos), while DynamoDB stores metadata including the S3 object keys. This design leverages AWS managed services, eliminates the need to manage file storage within Lambda or database, scales to tens of thousands of users, and requires minimal operational effort.
Why the other options are wrong:
- A. Storing photos directly in DynamoDB is inefficient for large binary files, causes database bloat, and negatively impacts performance and cost.
- C. Creating an IAM user for each application user is operationally overhead-intensive, doesn't scale well, and is not the intended use of IAM for customer-facing applications.
- D. Manually managing a users table in DynamoDB with custom Lambda authorizers adds unnecessary operational complexity compared to using Cognito, which is a fully managed service.
Question 12
A company receives food orders from multiple partners. The company has a microservices application that uses Amazon API Gateway APIs with AWS Lambda integration. Each partner sends orders by calling a customized API that is exposed through API Gateway. The API call invokes a shared Lambda function to process the orders. Partners need to be notified after the Lambda function processes the orders. Each partner must receive updates for only the partner's own orders. The company wants to add new partners in the future with the fewest code changes possible. Which solution will meet these requirements in the MOST scalable way?
- A. Create a different Amazon Simple Notification Service (Amazon SNS) topic for each partner. Configure the Lambda function to publish messages for each partner to the partner's SNS topic.
- B. Create a different Lambda function for each partner. Configure the Lambda function to notify each partner's service endpoint directly.
- C. Create an Amazon Simple Notification Service (Amazon SNS) topic. Configure the Lambda function to publish messages with specific attributes to the SNS topic. Subscribe each partner to the SNS topic. Apply the appropriate filter policy to the topic subscriptions.
- D. Create one Amazon Simple Notification Service (Amazon SNS) topic. Subscribe all partners to the SNS topic.
Show answer and explanation ▾
Correct answer: C
Using a single SNS topic with message attributes and filter policies on subscriptions provides the most scalable solution. Each partner subscribes to the topic with a filter policy that matches only their orders based on message attributes. New partners can be added by simply creating new subscriptions with appropriate filter policies, requiring no changes to the Lambda function code and minimal operational changes.
Why the other options are wrong:
- A. Creating a separate SNS topic for each partner requires code changes to the Lambda function every time a new partner is added, reducing scalability.
- B. Creating separate Lambda functions for each partner adds code duplication, complexity, and requires changes for each new partner addition.
- D. Subscribing all partners to a single topic without filtering means all partners receive all orders, violating the requirement that each partner receives only their own order updates.
Question 13
A financial company must store original customer records for 10 years for legal reasons. A complete record contains personally identifiable information (PII). According to local regulations, PII is available to only certain people in the company and must not be shared with third parties. The company needs to make the records available to third-party organizations for statistical analysis without sharing the PII. A developer wants to store the original immutable record in Amazon S3. Depending on who accesses the S3 document, the document should be returned as is or with all the PII removed. The developer has written an AWS Lambda function to remove the PII from the document. The function is named removePii. What should the developer do so that the company can meet the PII requirements while maintaining only one copy of the document?
- A. Set up an S3 event notification that invokes the removePii function when an S3 GET request is made. Call Amazon S3 by using a GET request to access the object without PII.
- B. Set up an S3 event notification that invokes the removePii function when an S3 PUT request is made. Call Amazon S3 by using a PUT request to access the object without PII.
- C. Create an S3 Object Lambda access point from the S3 console. Select the removePii function. Use S3 Access Points to access the object without PII.
- D. Create an S3 access point from the S3 console. Use the access point name to call the GetObjectLegalHold S3 API function. Pass in the removePii function name to access the object without PII.
Show answer and explanation ▾
Correct answer: C
S3 Object Lambda access points intercept GET requests and invoke the removePii Lambda function to process and transform the object before returning it to the client. This allows maintaining a single immutable original document in S3 while presenting different views based on the accessor's permissions. The solution is native to S3, requires no application code changes, and transparently applies the PII removal function.
Why the other options are wrong:
- A. S3 event notifications on GET requests don't prevent the original unmodified object from being returned; they fire after the request, not intercepting the response.
- B. S3 event notifications on PUT requests are for processing uploads, not for filtering data on retrieval, and don't solve the problem of conditional PII removal on access.
- D. GetObjectLegalHold is an API for managing legal hold status on objects, not for invoking transformation functions or controlling conditional access to object data.
Question 14
A developer is deploying an AWS Lambda function The developer wants the ability to return to older versions of the function quickly and seamlessly. How can the developer achieve this goal with the LEAST operational overhead?
- A. Use AWS OpsWorks to perform blue/green deployments.
- B. Use a function alias with different versions.
- C. Maintain deployment packages for older versions in Amazon S3.
- D. Use AWS CodePipeline for deployments and rollbacks.
Show answer and explanation ▾
Correct answer: B
Lambda aliases point to specific versions of a function, allowing instant rollback by updating the alias to reference a previous version. This approach requires minimal operational overhead-no additional services, no deployment pipelines, and no manual package management. Changing an alias to point to an older version is a single API call that takes effect immediately.
Why the other options are wrong:
- A. AWS OpsWorks is designed for EC2 infrastructure management with Chef; it adds unnecessary complexity for Lambda function deployments.
- C. Manually maintaining deployment packages in S3 requires operational effort to manage, retrieve, and redeploy older versions compared to using built-in versioning.
- D. AWS CodePipeline adds operational overhead with pipeline configuration, testing stages, and deployment management compared to the simplicity of alias switching.
Question 15
A developer has written an AWS Lambda function. The function is CPU-bound. The developer wants to ensure that the function returns responses quickly. How can the developer improve the function's performance?
- A. Increase the function's CPU core count.
- B. Increase the function's memory.
- C. Increase the function's reserved concurrency.
- D. Increase the function's timeout.
Show answer and explanation ▾
Correct answer: B
In AWS Lambda, memory allocation directly determines CPU allocation. Increasing memory increases the available CPU cores proportionally, which improves the execution speed of CPU-bound functions. This is the direct way to improve performance for computationally intensive workloads without other overhead.
Why the other options are wrong:
- A. Lambda doesn't expose direct CPU core count configuration; CPU allocation is tied to memory selection.
- C. Reserved concurrency controls how many function instances can run simultaneously; it doesn't improve individual function execution speed or response time.
- D. Timeout controls how long a function can run before being terminated; it doesn't improve performance but rather allows longer execution, which is counterproductive for improving response time.
Question 16
For a deployment using AWS Code Deploy, what is the run order of the hooks for in- place deployments?
- A. BeforeInstall -> ApplicationStop -> ApplicationStart -> AfterInstall
- B. ApplicationStop -> BeforeInstall -> AfterInstall -> ApplicationStart
- C. BeforeInstall -> ApplicationStop -> ValidateService -> ApplicationStart
- D. ApplicationStop -> BeforeInstall -> ValidateService -> ApplicationStart
Show answer and explanation ▾
Correct answer: B
For in-place deployments, AWS CodeDeploy executes lifecycle event hooks in a specific order: ApplicationStop runs first to stop the currently running application, BeforeInstall prepares the instance for installation, AfterInstall performs post-installation configuration, and finally ApplicationStart starts the newly deployed application. This sequence ensures the old version is cleanly stopped before the new version is installed and started.
Why the other options are wrong:
- A. Incorrect order-BeforeInstall cannot run before ApplicationStop; the running application must be stopped first.
- C. ValidateService is not a standard lifecycle hook in CodeDeploy; the correct hooks are ApplicationStop, BeforeInstall, AfterInstall, and ApplicationStart.
- D. ValidateService is not a standard CodeDeploy lifecycle hook, and the order does not match the documented sequence.
Question 17
A company is building a serverless application on AWS. The application uses an AWS Lambda function to process customer orders 24 hours a day, 7 days a week. The Lambda function calls an external vendor's HTTP API to process payments. During load tests, a developer discovers that the external vendor payment processing API occasionally times out and returns errors. The company expects that some payment processing API calls will return errors. The company wants the support team to receive notifications in near real time only when the payment processing external API error rate exceed 5% of the total number of transactions in an hour. Developers need to use an existing Amazon Simple Notification Service (Amazon SNS) topic that is configured to notify the support team. Which solution will meet these requirements?
- A. Write the results of payment processing API calls to Amazon CloudWatch. Use Amazon CloudWatch Logs Insights to query the CloudWatch logs. Schedule the Lambda function to check the CloudWatch logs and notify the existing SNS topic.
- B. Publish custom metrics to CloudWatch that record the failures of the external payment processing API calls. Configure a CloudWatch alarm to notify the existing SNS topic when error rate exceeds the specified rate.
- C. Publish the results of the external payment processing API calls to a new Amazon SNS topic. Subscribe the support team members to the new SNS topic.
- D. Write the results of the external payment processing API calls to Amazon S3. Schedule an Amazon Athena query to run at regular intervals. Configure Athena to send notifications to the existing SNS topic when the error rate exceeds the specified rate.
Show answer and explanation ▾
Correct answer: B
Publishing custom metrics to CloudWatch allows the application to record payment API failures in real time. A CloudWatch alarm can then monitor these metrics and trigger when the error rate exceeds 5% within an hour, automatically notifying the existing SNS topic. This approach is native to CloudWatch, provides near-real-time alerting, and requires no additional query logic or scheduled jobs.
Why the other options are wrong:
- A. Using CloudWatch Logs Insights with scheduled Lambda functions introduces unnecessary latency and operational complexity compared to native CloudWatch alarms.
- C. Subscribing the support team to a new SNS topic would send notifications for every error, not just when the error rate exceeds 5%, resulting in alert fatigue.
- D. Writing to S3 and scheduling Athena queries introduces significant latency and does not provide near-real-time notifications as required.
Question 18
A company is offering APIs as a service over the internet to provide unauthenticated read access to statistical information that is updated daily. The company uses Amazon API Gateway and AWS Lambda to develop the APIs. The service has become popular, and the company wants to enhance the responsiveness of the APIs. Which action can help the company achieve this goal?
- A. Enable API caching in API Gateway.
- B. Configure API Gateway to use an interface VPC endpoint.
- C. Enable cross-origin resource sharing (CORS) for the APIs.
- D. Configure usage plans and API keys in API Gateway.
Show answer and explanation ▾
Correct answer: A
API caching in API Gateway stores frequently accessed responses and returns cached results on subsequent requests, dramatically improving responsiveness without executing backend Lambda functions. Since the statistical information is updated daily and accessed frequently, caching is ideal for reducing latency and improving performance.
Why the other options are wrong:
- B. Interface VPC endpoints are used for private connectivity to AWS services and do not improve API responsiveness for public unauthenticated read access.
- C. CORS configuration allows browsers to make cross-origin requests but does not enhance API responsiveness or performance.
- D. Usage plans and API keys are for throttling and controlling access, not for improving response times of existing APIs.
Question 19
A developer wants to store information about movies. Each movie has a title, release year, and genre. The movie information also can include additional properties about the cast and production crew. This additional information is inconsistent across movies. For example, one movie might have an assistant director, and another movie might have an animal trainer. The developer needs to implement a solution to support the following use cases: For a given title and release year, get all details about the movie that has that title and release year. For a given title, get all details about all movies that have that title. For a given genre, get all details about all movies in that genre. Which data store configuration will meet these requirements?
- A. Create an Amazon DynamoDB table. Configure the table with a primary key that consists of the title as the partition key and the release year as the sort key. Create a global secondary index that uses the genre as the partition key and the title as the sort key.
- B. Create an Amazon DynamoDB table. Configure the table with a primary key that consists of the genre as the partition key and the release year as the sort key. Create a global secondary index that uses the title as the partition key.
- C. On an Amazon RDS DB instance, create a table that contains columns for title, release year, and genre. Configure the title as the primary key.
- D. On an Amazon RDS DB instance, create a table where the primary key is the title and all other data is encoded into JSON format as one additional column.
Show answer and explanation ▾
Correct answer: A
This configuration supports all three use cases: querying by title and release year uses the primary key directly, querying by title only uses the partition key of the primary key, and querying by genre uses the global secondary index. DynamoDB's flexible schema naturally accommodates inconsistent additional properties (cast and crew information) as document attributes, making it ideal for semi-structured data.
Why the other options are wrong:
- B. Using genre as the partition key and release year as the sort key makes it difficult to query by title alone, and the secondary index lacks a sort key to efficiently retrieve all movies with that title.
- C. RDS with a relational schema requires predefined columns and struggles with the inconsistent additional properties; it would require separate tables and complex joins.
- D. Storing all data as JSON in a single column defeats the purpose of RDS and provides no efficient querying capability for title or genre lookups.
Question 20
A developer maintains an Amazon API Gateway REST API. Customers use the API through a frontend UI and Amazon Cognito authentication. The developer has a new version of the API that contains new endpoints and backward- incompatible interface changes. The developer needs to provide beta access to other developers on the team without affecting customers. Which solution will meet these requirements with the LEAST operational overhead?
- A. Define a development stage on the API Gateway API. Instruct the other developers to point the endpoints to the development stage.
- B. Define a new API Gateway API that points to the new API application code. Instruct the other developers to point the endpoints to the new API.
- C. Implement a query parameter in the API application code that determines which code version to call.
- D. Specify new API Gateway endpoints for the API endpoints that the developer wants to add.
Show answer and explanation ▾
Correct answer: A
API Gateway stages allow multiple versions of the same API to coexist with different configurations and backends. Creating a development stage for the new API version enables beta testing without affecting production customers. This requires minimal operational overhead-just a stage configuration and endpoint routing-and uses existing AWS infrastructure.
Why the other options are wrong:
- B. Creating a separate API Gateway instance duplicates infrastructure and increases operational overhead compared to using stages.
- C. Implementing query parameter logic in application code adds complexity, requires code changes, and is harder to manage than using API Gateway stages.
- D. Specifying new endpoints without a stage strategy does not provide version isolation or the ability to manage development and production separately.
Question 21
A developer is creating an application that will store personal health information (PHI). The PHI needs to be encrypted at all times. An encrypted Amazon RDS for MySQL DB instance is storing the data. The developer wants to increase the performance of the application by caching frequently accessed data while adding the ability to sort or rank the cached datasets. Which solution will meet these requirements?
- A. Create an Amazon ElastiCache for Redis instance. Enable encryption of data in transit and at rest. Store frequently accessed data in the cache.
- B. Create an Amazon ElastiCache for Memcached instance. Enable encryption of data in transit and at rest. Store frequently accessed data in the cache.
- C. Create an Amazon RDS for MySQL read replica. Connect to the read replica by using SSL. Configure the read replica to store frequently accessed data.
- D. Create an Amazon DynamoDB table and a DynamoDB Accelerator (DAX) cluster for the table. Store frequently accessed data in the DynamoDB table.
Show answer and explanation ▾
Correct answer: A
ElastiCache for Redis supports encryption both in transit and at rest, protecting PHI as required. Redis also provides advanced data structures and native support for sorting and ranking operations, making it ideal for caching while maintaining compliance with encryption requirements.
Why the other options are wrong:
- B. Memcached does not support encryption at rest, which is a critical requirement for storing PHI.
- C. RDS read replicas are for high-availability database replication, not caching, and do not provide the sorting/ranking capabilities needed.
- D. DynamoDB and DAX are not purpose-built for caching frequently accessed data from an existing database, and this architecture adds unnecessary complexity.
Question 22
A company has a multi-node Windows legacy application that runs on premises. The application uses a network shared folder as a centralized configuration repository to store configuration files in .xml format. The company is migrating the application to Amazon EC2 instances. As part of the migration to AWS, a developer must identify a solution that provides high availability for the repository. Which solution will meet this requirement MOST cost-effectively?
- A. Mount an Amazon Elastic Block Store (Amazon EBS) volume onto one of the EC2 instances. Deploy a file system on the EBS volume. Use the host operating system to share a folder. Update the application code to read and write configuration files from the shared folder.
- B. Deploy a micro EC2 instance with an instance store volume. Use the host operating system to share a folder. Update the application code to read and write configuration files from the shared folder.
- C. Create an Amazon S3 bucket to host the repository. Migrate the existing .xml files to the S3 bucket. Update the application code to use the AWS SDK to read and write configuration files from Amazon S3.
- D. Create an Amazon S3 bucket to host the repository. Migrate the existing .xml files to the S3 bucket. Mount the S3 bucket to the EC2 instances as a local volume. Update the application code to read and write configuration files from the disk.
Show answer and explanation ▾
Correct answer: C
Amazon S3 provides high availability across multiple AZs, automatic redundancy, and versioning for configuration files at minimal cost. Using the AWS SDK to access S3 is more reliable and scalable than network shares, and it eliminates the need to maintain shared folder infrastructure while providing durable storage for XML configuration files.
Why the other options are wrong:
- A. A single EBS volume attached to one instance is not highly available; if that instance fails, the configuration repository becomes unavailable.
- B. Instance store volumes are ephemeral and are lost when the instance stops, providing no high availability or durability for a configuration repository.
- D. Mounting S3 as a local volume via a FUSE driver adds operational complexity and performance overhead compared to directly accessing S3 via SDK.
Question 23
A company wants to deploy and maintain static websites on AWS. Each website's source code is hosted in one of several version control systems, including AWS CodeCommit, Bitbucket, and GitHub. The company wants to implement phased releases by using development, staging, user acceptance testing, and production environments in the AWS Cloud. Deployments to each environment must be started by code merges on the relevant Git branch. The company wants to use HTTPS for all data exchange. The company needs a solution that does not require servers to run continuously. Which solution will meet these requirements with the LEAST operational overhead?
- A. Host each website by using AWS Amplify with a serverless backend. Conned the repository branches that correspond to each of the desired environments. Start deployments by merging code changes to a desired branch.
- B. Host each website in AWS Elastic Beanstalk with multiple environments. Use the EB CLI to link each repository branch. Integrate AWS CodePipeline to automate deployments from version control code merges.
- C. Host each website in different Amazon S3 buckets for each environment. Configure AWS CodePipeline to pull source code from version control. Add an AWS CodeBuild stage to copy source code to Amazon S3.
- D. Host each website on its own Amazon EC2 instance. Write a custom deployment script to bundle each website's static assets. Copy the assets to Amazon EC2. Set up a workflow to run the script when code is merged.
Show answer and explanation ▾
Correct answer: A
AWS Amplify is purpose-built for hosting static websites and integrates directly with multiple Git repositories (CodeCommit, GitHub, Bitbucket). It automatically triggers deployments on branch merges, supports multiple environments, provides HTTPS by default, and requires no server management-all with minimal operational overhead.
Why the other options are wrong:
- B. Elastic Beanstalk is designed for application servers, not static websites, and requires continuous server instances, adding unnecessary cost and operational complexity.
- C. While CodePipeline with S3 can work, it requires manual pipeline configuration and CodeBuild setup, adding operational overhead compared to Amplify's integrated approach.
- D. Running static websites on EC2 instances with custom deployment scripts is the most operationally intensive option and contradicts the serverless requirement.
Question 24
A company is migrating an on-premises database to Amazon RDS for MySQL. The company has read-heavy workloads. The company wants to refactor the code to achieve optimum read performance for queries. Which solution will meet this requirement with LEAST current and future effort?
- A. Use a multi-AZ Amazon RDS deployment. Increase the number of connections that the code makes to the database or increase the connection pool size if a connection pool is in use.
- B. Use a multi-AZ Amazon RDS deployment. Modify the code so that queries access the secondary RDS instance.
- C. Deploy Amazon RDS with one or more read replicas. Modify the application code so that queries use the URL for the read replicas.
- D. Use open source replication software to create a copy of the MySQL database on an Amazon EC2 instance. Modify the application code so that queries use the IP address of the EC2 instance.
Show answer and explanation ▾
Correct answer: C
Read replicas are the native AWS solution for read-heavy workloads on RDS. They distribute read traffic without requiring code modifications beyond routing reads to the replica endpoint. This approach scales horizontally with minimal effort and is fully managed by AWS. Unlike multi-AZ deployments which maintain a standby for high availability but cannot be used for reads, read replicas are specifically designed for this use case and represent the least effort solution both now and in the future.
Why the other options are wrong:
- A. Multi-AZ deployments do not improve read performance; the secondary instance cannot be accessed for reads and is only for failover.
- B. Multi-AZ deployments do not allow direct access to secondary instances; secondaries are not readable and only become primary during failover.
- D. Using EC2 with open source replication introduces operational overhead, manual maintenance burden, and loss of managed service benefits compared to native RDS read replicas.
Question 25
A developer is creating an application that will be deployed on IoT devices. The application will send data to a RESTful API that is deployed as an AWS Lambda function. The application will assign each API request a unique identifier. The volume of API requests from the application can randomly increase at any given time of day. During periods of request throttling, the application might need to retry requests. The API must be able to handle duplicate requests without inconsistencies or data loss. Which solution will meet these requirements?
- A. Create an Amazon RDS for MySQL DB instance. Store the unique identifier for each request in a database table. Modify the Lambda function to check the table for the identifier before processing the request.
- B. Create an Amazon DynamoDB table. Store the unique identifier for each request in the table. Modify the Lambda function to check the table for the identifier before processing the request.
- C. Create an Amazon DynamoDB table. Store the unique identifier for each request in the table. Modify the Lambda function to return a client error response when the function receives a duplicate request.
- D. Create an Amazon ElastiCache for Memcached instance. Store the unique identifier for each request in the cache. Modify the Lambda function to check the cache for the identifier before processing the request.
Show answer and explanation ▾
Correct answer: B
DynamoDB is the optimal choice for storing request identifiers to detect duplicates. It provides fast, consistent lookups with automatic scaling for unpredictable traffic patterns. The Lambda function can check if the unique identifier exists before processing, preventing duplicate processing while handling the throttling and retry scenarios. DynamoDB's scalability and performance characteristics make it ideal for handling variable request volumes from IoT devices.
Why the other options are wrong:
- A. RDS requires connection management and does not scale as efficiently with sudden traffic spikes as DynamoDB does.
- C. Returning a client error response does not prevent inconsistencies or data loss; the request still needs idempotent handling to avoid duplicates.
- D. ElastiCache (Memcached) does not provide the durability guarantees needed for request tracking; cached data can be evicted, potentially allowing duplicate processing.
Question 26
A developer wants to expand an application to run in multiple AWS Regions. The developer wants to copy Amazon Machine Images (AMIs) with the latest changes and create a new application stack in the destination Region. According to company requirements, all AMIs must be encrypted in all Regions. However, not all the AMIs that the company uses are encrypted. How can the developer expand the application to run in the destination Region while meeting the encryption requirement?
- A. Create new AMIs, and specify encryption parameters. Copy the encrypted AMIs to the destination Region. Delete the unencrypted AMIs.
- B. Use AWS Key Management Service (AWS KMS) to enable encryption on the unencrypted AMIs. Copy the encrypted AMIs to the destination Region.
- C. Use AWS Certificate Manager (ACM) to enable encryption on the unencrypted AMIs. Copy the encrypted AMIs to the destination Region.
- D. Copy the unencrypted AMIs to the destination Region. Enable encryption by default in the destination Region.
Show answer and explanation ▾
Correct answer: A
The correct approach is to create new encrypted AMIs with the latest changes and copy them to the destination Region, then delete unencrypted ones. Existing unencrypted AMIs cannot be encrypted in-place; AWS does not provide a direct encryption function for existing AMIs. Creating new encrypted AMIs is the standard AWS pattern and ensures compliance with the encryption requirement across all Regions.
Why the other options are wrong:
- B. AWS KMS cannot be used to retroactively encrypt existing unencrypted AMIs; encryption must be specified at AMI creation time.
- C. AWS Certificate Manager (ACM) is for SSL/TLS certificates, not for encrypting AMIs or EBS volumes.
- D. Enabling encryption by default in the destination Region does not encrypt already- created unencrypted AMIs; it only applies to new resources created in that Region.
Question 27
A company hosts a client-side web application for one of its subsidiaries on Amazon S3. The web application can be accessed through Amazon CloudFront from https://www.example.com. After a successful rollout, the company wants to host three more client-side web applications for its remaining subsidiaries on three separate S3 buckets. To achieve this goal, a developer moves all the common JavaScript files and web fonts to a central S3 bucket that serves the web applications. However, during testing, the developer notices that the browser blocks the JavaScript files and web fonts. What should the developer do to prevent the browser from blocking the JavaScript files and web fonts?
- A. Create four access points that allow access to the central S3 bucket. Assign an access point to each web application bucket.
- B. Create a bucket policy that allows access to the central S3 bucket. Attach the bucket policy to the central S3 bucket
- C. Create a cross-origin resource sharing (CORS) configuration that allows access to the central S3 bucket. Add the CORS configuration to the central S3 bucket.
- D. Create a Content-MD5 header that provides a message integrity check for the central S3 bucket. Insert the Content-MD5 header for each web application request.
Show answer and explanation ▾
Correct answer: C
The browser is blocking the JavaScript files and web fonts due to CORS (Cross-Origin Resource Sharing) policy. When web applications served from one S3 bucket access resources (JavaScript and fonts) from a different S3 bucket, the browser requires explicit CORS configuration on the central bucket to allow these cross-origin requests. Adding a CORS configuration to the central S3 bucket that permits requests from the application domains solves this issue.
Why the other options are wrong:
- A. S3 Access Points are not related to CORS and do not resolve cross-origin resource blocking issues.
- B. A bucket policy controls who can access the bucket, but does not address browser CORS restrictions on cross-origin requests.
- D. Content-MD5 headers provide integrity verification, not cross-origin resource access permissions; they do not affect browser CORS policies.
Question 28
A company has an application that uses Amazon Cognito user pools as an identity provider. The company must secure access to user records. The company has set up multi-factor authentication (MFA). The company also wants to send a login activity notification by email every time a user logs in. What is the MOST operationally efficient solution that meets this requirement?
- A. Create an AWS Lambda function that uses Amazon Simple Email Service (Amazon SES) to send the email notification. Add an Amazon API Gateway API to invoke the function. Call the API from the client side when login confirmation is received.
- B. Create an AWS Lambda function that uses Amazon Simple Email Service (Amazon SES) to send the email notification. Add an Amazon Cognito post authentication Lambda trigger for the function.
- C. Create an AWS Lambda function that uses Amazon Simple Email Service (Amazon SES) to send the email notification. Create an Amazon CloudWatch Logs log subscription filter to invoke the function based on the login status.
- D. Configure Amazon Cognito to stream all logs to Amazon Kinesis Data Firehose. Create an AWS Lambda function to process the streamed logs and to send the email notification based on the login status of each user.
Show answer and explanation ▾
Correct answer: B
A Cognito post authentication Lambda trigger is the most operationally efficient solution. It automatically invokes a Lambda function immediately after a user successfully authenticates, eliminating the need for client-side API calls or external monitoring. The Lambda function can use Amazon SES to send the login notification email. This approach is fully integrated with Cognito's authentication flow and requires no additional infrastructure or polling mechanisms.
Why the other options are wrong:
- A. Requiring client-side API calls adds implementation complexity and depends on client code execution, which is less reliable and operationally less efficient.
- C. CloudWatch Logs subscription filters require parsing log data and are less direct than native Cognito triggers for authentication events.
- D. Using Kinesis Data Firehose adds unnecessary complexity and operational overhead when a native Cognito trigger provides direct, simpler integration.
Question 29
A developer has an application that stores data in an Amazon S3 bucket. The application uses an HTTP API to store and retrieve objects. When the PutObject API operation adds objects to the S3 bucket the developer must encrypt these objects at rest by using server-side encryption with Amazon S3 managed keys (SSE-S3). Which solution will meet this requirement?
- A. Create an AWS Key Management Service (AWS KMS) key. Assign the KMS key to the S3 bucket.
- B. Set the x-amz-server-side-encryption header when invoking the PutObject API operation.
- C. Provide the encryption key in the HTTP header of every request.
- D. Apply TLS to encrypt the traffic to the S3 bucket.
Show answer and explanation ▾
Correct answer: B
To use SSE-S3 encryption when putting objects via the PutObject API operation, the developer must include the x-amz-server-side-encryption header with the value 'AES256'. This header tells S3 to encrypt the object with S3-managed keys. This is the required method for specifying server-side encryption on individual PUT requests.
Why the other options are wrong:
- A. AWS KMS keys are used for SSE-KMS encryption, not SSE-S3; SSE-S3 uses S3- managed keys.
- C. The encryption key should not be provided in HTTP headers by the client for SSE- S3; S3 manages all encryption keys internally.
- D. TLS encrypts data in transit to S3 but does not enable server-side encryption at rest; both are needed for complete security but TLS alone does not satisfy the SSE-S3 requirement.
Question 30
A developer needs to perform geographic load testing of an API. The developer must deploy resources to multiple AWS Regions to support the load testing of the API. How can the developer meet these requirements without additional application code?
- A. Create and deploy an AWS Lambda function in each desired Region. Configure the Lambda function to create a stack from an AWS CloudFormation template in that Region when the function is invoked.
- B. Create an AWS CloudFormation template that defines the load test resources. Use the AWS CLI create-stack-set command to create a stack set in the desired Regions.
- C. Create an AWS Systems Manager document that defines the resources. Use the document to create the resources in the desired Regions.
- D. Create an AWS CloudFormation template that defines the load test resources. Use the AWS CLI deploy command to create a stack from the template in each Region.
Show answer and explanation ▾
Correct answer: B
CloudFormation StackSets are the purpose-built AWS service for deploying resources across multiple Regions without additional application code. The create-stack-set command creates a stack set, and then stack instances are created in the specified Regions, automatically deploying the same resources defined in the template. This is the standard, operationally efficient approach for multi-Region deployments.
Why the other options are wrong:
- A. Using Lambda functions to invoke CloudFormation stack creation adds unnecessary custom code and operational complexity compared to native StackSets.
- C. AWS Systems Manager documents are for operational automation and automation runbooks, not for defining and deploying infrastructure resources.
- D. Using the AWS CLI deploy command requires manual invocation in each Region and does not provide the automated, managed multi-Region orchestration that StackSets offers.
Question 31
A developer is creating an application that includes an Amazon API Gateway REST API in the us-east-2 Region. The developer wants to use Amazon CloudFront and a custom domain name for the API. The developer has acquired an SSL/TLS certificate for the domain from a third-party provider. How should the developer configure the custom domain for the application?
- A. Import the SSL/TLS certificate into AWS Certificate Manager (ACM) in the same Region as the API. Create a DNS A record for the custom domain.
- B. Import the SSL/TLS certificate into CloudFront. Create a DNS CNAME record for the custom domain.
- C. Import the SSL/TLS certificate into AWS Certificate Manager (ACM) in the same Region as the API. Create a DNS CNAME record for the custom domain.
- D. Import the SSL/TLS certificate into AWS Certificate Manager (ACM) in the us- east-1 Region. Create a DNS CNAME record for the custom domain.
Show answer and explanation ▾
Correct answer: D
Import the SSL/TLS certificate into AWS Certificate Manager (ACM) in the us-east-1 Region. Create a DNS CNAME record for the custom domain. When using CloudFront with a custom domain for an API Gateway REST API, SSL/TLS certificates must be imported into AWS Certificate Manager (ACM) in the us-east-1 Region, as CloudFront requires certificates to be in us-east-1 regardless of the API's Region. The custom domain then uses a DNS CNAME record pointing to the CloudFront distribution. This is a CloudFront-specific requirement for certificate placement.
Why the other options are wrong:
- A. Importing the certificate in the same Region as the API (us-east-2) will not work for CloudFront, which requires certificates in us-east-1. Additionally, an A record is not used for custom domains with CloudFront.
- B. Certificates cannot be imported directly into CloudFront; they must be imported into ACM first, and CloudFront accesses them from there.
- C. While a CNAME record is correct, importing the certificate into ACM in us-east-2 (the same Region as the API) will not work for CloudFront, which specifically requires us- east-1.
Question 32
A developer is creating a template that uses AWS CloudFormation to deploy an application. The application is serverless and uses Amazon API Gateway, Amazon DynamoDB, and AWS Lambda. Which AWS service or tool should the developer use to define serverless resources in YAML?
- A. CloudFormation serverless intrinsic functions
- B. AWS Elastic Beanstalk
- C. AWS Serverless Application Model (AWS SAM)
- D. AWS Cloud Development Kit (AWS CDK)
Show answer and explanation ▾
Correct answer: C
AWS Serverless Application Model (AWS SAM) is purpose-built for defining serverless resources in YAML format. It provides a simplified syntax for CloudFormation templates specifically designed for serverless applications including API Gateway, Lambda, and DynamoDB. SAM handles the transformation of simplified YAML into complete CloudFormation templates automatically.
Why the other options are wrong:
- A. CloudFormation serverless intrinsic functions do not exist; CloudFormation has standard intrinsic functions but they are not specifically for serverless resource definition.
- B. AWS Elastic Beanstalk is for managing traditional web applications and containers, not optimized for defining serverless infrastructure.
- D. AWS CDK uses Python, TypeScript, or other programming languages rather than YAML, making it less ideal for this specific requirement.
Question 33
A developer wants to insert a record into an Amazon DynamoDB table as soon as a new file is added to an Amazon S3 bucket. Which set of steps would be necessary to achieve this?
- A. Create an event with Amazon EventBridge that will monitor the S3 bucket and then insert the records into DynamoDB.
- B. Configure an S3 event to invoke an AWS Lambda function that inserts records into DynamoDB.
- C. Create an AWS Lambda function that will poll the S3 bucket and then insert the records into DynamoDB.
- D. Create a cron job that will run at a scheduled time and insert the records into DynamoDB.
Show answer and explanation ▾
Correct answer: B
Configuring an S3 event to invoke a Lambda function is the standard, event-driven approach for triggering actions when files are added to S3. S3 can directly invoke Lambda functions when specific events occur, and the Lambda function can then insert records into DynamoDB. This is efficient, scalable, and requires no polling.
Why the other options are wrong:
- A. While EventBridge can monitor S3, it adds unnecessary complexity when S3 event notifications can directly invoke Lambda.
- C. Polling is inefficient and wasteful compared to event-driven architectures; it introduces unnecessary latency and costs.
- D. Scheduled cron jobs cannot respond to real-time S3 events and would miss file additions between execution windows.
Question 34
A company has an Amazon S3 bucket that contains sensitive data. The data must be encrypted in transit and at rest. The company encrypts the data in the S3 bucket by using an AWS Key Management Service (AWS KMS) key. A developer needs to grant several other AWS accounts the permission to use the S3 GetObject operation to retrieve the data from the S3 bucket. How can the developer enforce that all requests to retrieve the data provide encryption in transit?
- A. Define a resource-based policy on the S3 bucket to deny access when a request meets the condition "aws:SecureTransport": "false".
- B. Define a resource-based policy on the S3 bucket to allow access when a request meets the condition "aws:SecureTransport": "false".
- C. Define a role-based policy on the other accounts' roles to deny access when a request meets the condition of "aws:SecureTransport": "false".
- D. Define a resource-based policy on the KMS key to deny access when a request meets the condition of "aws:SecureTransport": "false".
Show answer and explanation ▾
Correct answer: A
A resource-based policy on the S3 bucket with a condition denying access when 'aws:SecureTransport' is 'false' ensures all requests use HTTPS/TLS encryption in transit. This policy applies to all principals accessing the bucket, including cross-account access, making it the most effective enforcement point for encryption in transit requirements.
Why the other options are wrong:
- B. Allowing access when SecureTransport is 'false' is the opposite of the requirement and would permit unencrypted traffic.
- C. Role-based policies on other accounts' roles would need to be replicated across multiple accounts and are harder to enforce centrally than a bucket policy.
- D. While a KMS key policy could restrict access, encryption in transit is an S3 transport concern, not a KMS key concern; the bucket policy is the correct enforcement point.
Question 35
An application that is hosted on an Amazon EC2 instance needs access to files that are stored in an Amazon S3 bucket. The application lists the objects that are stored in the S3 bucket and displays a table to the user. During testing, a developer discovers that the application does not show any objects in the list. What is the MOST secure way to resolve this issue?
- A. Update the IAM instance profile that is attached to the EC2 instance to include the S3:* permission for the S3 bucket.
- B. Update the IAM instance profile that is attached to the EC2 instance to include the S3:ListBucket permission for the S3 bucket.
- C. Update the developer's user permissions to include the S3:ListBucket permission for the S3 bucket.
- D. Update the S3 bucket policy by including the S3:ListBucket permission and by setting the Principal element to specify the account number of the EC2 instance.
Show answer and explanation ▾
Correct answer: B
The most secure approach is to grant the minimum required permission: S3:ListBucket on the specific S3 bucket. This allows the application to list objects without granting excessive S3:* permissions. The IAM instance profile attached to the EC2 instance is the correct place to apply this permission since that's what the application assumes to call AWS APIs.
Why the other options are wrong:
- A. S3:* grants overly broad permissions violating the principle of least privilege; it includes dangerous actions like DeleteBucket.
- C. The developer's user permissions are irrelevant; the EC2 instance needs the permissions through its instance profile to access S3.
- D. Setting Principal to an EC2 instance account number is incorrect; principals should reference IAM roles or the instance profile, not the account number alone.
Question 36
A company is planning to securely manage one-time fixed license keys in AWS. The company's development team needs to access the license keys in automaton scripts that run in Amazon EC2 instances and in AWS CloudFormation stacks. Which solution will meet these requirements MOST cost-effectively?
- A. Amazon S3 with encrypted files prefixed with "config"
- B. AWS Secrets Manager secrets with a tag that is named SecretString
- C. AWS Systems Manager Parameter Store SecureString parameters
- D. CloudFormation NoEcho parameters
Show answer and explanation ▾
Correct answer: C
AWS Systems Manager Parameter Store SecureString parameters is the most cost- effective solution for managing fixed license keys. It provides encryption at rest, is free for standard parameters, and integrates seamlessly with EC2 instances and CloudFormation. It's specifically designed for configuration and secrets management at scale without additional costs.
Why the other options are wrong:
- A. Amazon S3 with encrypted files is possible but less convenient for automation scripts and less purpose-built for secrets management.
- B. AWS Secrets Manager is more expensive than Parameter Store and better suited for managing rotating secrets and database credentials rather than static license keys.
- D. CloudFormation NoEcho parameters are only useful during stack creation/updates; they don't provide persistent secret storage for runtime access.
Question 37
A company has deployed infrastructure on AWS. A development team wants to create an AWS Lambda function that will retrieve data from an Amazon Aurora database. The Amazon Aurora database is in a private subnet in company's VPC. The VPC is named VPC1. The data is relational in nature. The Lambda function needs to access the data securely. Which solution will meet these requirements?
- A. Create the Lambda function. Configure VPC1 access for the function. Attach a security group named SG1 to both the Lambda function and the database. Configure the security group inbound and outbound rules to allow TCP traffic on Port 3306.
- B. Create and launch a Lambda function in a new public subnet that is in a new VPC named VPC2. Create a peering connection between VPC1 and VPC2.
- C. Create the Lambda function. Configure VPC1 access for the function. Assign a security group named SG1 to the Lambda function. Assign a second security group named SG2 to the database. Add an inbound rule to SG1 to allow TCP traffic from Port 3306.
- D. Export the data from the Aurora database to Amazon S3. Create and launch a Lambda function in VPC1. Configure the Lambda function query the data from Amazon S3.
Show answer and explanation ▾
Correct answer: A
Option A correctly configures secure database access: the Lambda function is configured with VPC1 access, both Lambda and database share security group SG1, and the security group rules allow TCP traffic on port 3306 (MySQL/Aurora). Using a shared security group simplifies management and ensures proper network isolation while allowing the Lambda function to communicate with the database.
Why the other options are wrong:
- B. Creating a new VPC with peering adds unnecessary complexity and cost; the Lambda function should be in the same VPC as the database.
- C. Having separate security groups (SG1 and SG2) requires the inbound rule to reference the security group that the Lambda is attached to; the rule shown only specifies a port, not the source security group.
- D. Exporting data to S3 defeats the purpose of using a relational database and introduces unnecessary delays and complexity for real-time data access.
Question 38
A development team wants to build a continuous integration/continuous delivery (CI/CD) pipeline. The team is using AWS CodePipeline to automate the code build and deployment. The team wants to store the program code to prepare for the CI/CD pipeline. Which AWS service should the team use to store the program code?
- A. AWS CodeDeploy
- B. AWS CodeArtifact
- C. AWS CodeCommit
- D. Amazon CodeGuru
Show answer and explanation ▾
Correct answer: C
AWS CodeCommit is a fully managed source control service that stores and manages code repositories. It is the appropriate service for storing program code before it enters the CI/CD pipeline. CodeCommit integrates seamlessly with CodePipeline to trigger builds when code is committed, making it the correct choice for this scenario.
Why the other options are wrong:
- A. CodeDeploy is for deploying code to instances, not storing source code.
- B. CodeArtifact is for storing and managing software packages and dependencies, not source code.
- D. CodeGuru is a code review and profiling service, not a code repository.
Question 39
A developer is designing an AWS Lambda function that creates temporary files that are less than 10 MB during invocation. The temporary files will be accessed and modified multiple times during invocation. The developer has no need to save or retrieve these files in the future. Where should the temporary files be stored?
- A. the /tmp directory
- B. Amazon Elastic File System (Amazon EFS)
- C. Amazon Elastic Block Store (Amazon EBS)
- D. Amazon S3
Show answer and explanation ▾
Correct answer: A
The /tmp directory is the ephemeral storage provided by AWS Lambda with 10 GB of capacity per execution environment. It is designed specifically for temporary files that do not need to persist beyond the Lambda invocation. This is the most efficient and cost- effective solution for temporary files under 10 MB that are accessed and modified during execution.
Why the other options are wrong:
- B. Amazon EFS requires additional configuration and ongoing costs; it is unnecessary for temporary files that don't need persistence.
- C. Amazon EBS is block storage for EC2 instances and is not accessible to Lambda functions.
- D. Amazon S3 is for persistent storage and incurs unnecessary costs and latency for temporary files that are not needed after invocation.
Question 40
A developer is designing a serverless application with two AWS Lambda functions to process photos. One Lambda function stores objects in an Amazon S3 bucket and stores the associated metadata in an Amazon DynamoDB table. The other Lambda function fetches the objects from the S3 bucket by using the metadata from the DynamoDB table. Both Lambda functions use the same Python library to perform complex computations and are approaching the quota for the maximum size of zipped deployment packages. What should the developer do to reduce the size of the Lambda deployment packages with the LEAST operational overhead?
- A. Package each Python library in its own .zip file archive. Deploy each Lambda function with its own copy of the library.
- B. Create a Lambda layer with the required Python library. Use the Lambda layer in both Lambda functions.
- C. Combine the two Lambda functions into one Lambda function. Deploy the Lambda function as a single .zip file archive.
- D. Download the Python library to an S3 bucket. Program the Lambda functions to reference the object URLs.
Show answer and explanation ▾
Correct answer: B
Lambda layers allow developers to package libraries and code that can be used by multiple Lambda functions without duplicating the code in each deployment package. By creating a single Lambda layer with the shared Python library, both functions can reference it, reducing the size of each function's deployment package with minimal operational overhead and no code duplication.
Why the other options are wrong:
- A. Packaging the library separately for each function still requires duplication and does not reduce the overall package sizes.
- C. Combining two separate functions defeats the purpose of having distinct Lambda functions and reduces modularity.
- D. Storing the library in S3 and referencing it at runtime adds complexity and operational overhead compared to the built-in Lambda layers feature.
Question 41
A developer is writing an AWS Lambda function. The developer wants to log key events that occur while the Lambda function runs. The developer wants to include a unique identifier to associate the events with a specific function invocation. The developer adds the following code to the Lambda function: Which solution will meet this requirement?
- A. Obtain the request identifier from the AWS request ID field in the context object. Configure the application to write logs to standard output.
- B. Obtain the request identifier from the AWS request ID field in the event object. Configure the application to write logs to a file.
- C. Obtain the request identifier from the AWS request ID field in the event object. Configure the application to write logs to standard output.
- D. Obtain the request identifier from the AWS request ID field in the context object. Configure the application to write logs to a file.
Show answer and explanation ▾
Correct answer: A
In AWS Lambda, the unique request identifier for tracking a specific invocation is accessed via the context object's awsRequestId property, not the event object. AWS Lambda automatically logs to CloudWatch Logs when the function writes to standard output (stdout), which is the recommended approach for Lambda logging. The context object contains Lambda-specific metadata including the request ID, while the event object contains the invocation payload data.
Why the other options are wrong:
- B. The request ID is in the context object, not the event object, and Lambda logs to stdout by default rather than files.
- C. The request ID is in the context object, not the event object.
- D. Writing logs to a file in Lambda is not a reliable approach since the function's file system is temporary and not persisted; stdout is the standard practice for Lambda logging.
Question 42
A developer is working on a serverless application that needs to process any changes to an Amazon DynamoDB table with an AWS Lambda function. How should the developer configure the Lambda function to detect changes to the DynamoDB table?
- A. Create an Amazon Kinesis data stream, and attach it to the DynamoDB table. Create a trigger to connect the data stream to the Lambda function.
- B. Create an Amazon EventBridge rule to invoke the Lambda function on a regular schedule. Conned to the DynamoDB table from the Lambda function to detect changes.
- C. Enable DynamoDB Streams on the table. Create a trigger to connect the DynamoDB stream to the Lambda function.
- D. Create an Amazon Kinesis Data Firehose delivery stream, and attach it to the DynamoDB table. Configure the delivery stream destination as the Lambda function.
Show answer and explanation ▾
Correct answer: C
DynamoDB Streams capture time-ordered sequences of item-level modifications in any DynamoDB table and stores this information for up to 24 hours. By enabling DynamoDB Streams on the table and creating a trigger to connect the stream to a Lambda function, the function will automatically be invoked whenever changes occur in the table. This is the native and recommended approach for detecting DynamoDB table changes.
Why the other options are wrong:
- A. While Kinesis Data Streams can work with DynamoDB, they require additional configuration and are not the native mechanism for capturing DynamoDB changes.
- B. EventBridge with scheduled rules does not detect changes; it invokes functions on a schedule, which would miss real-time changes and require polling.
- D. Kinesis Data Firehose is designed for data delivery and transformation to destinations like S3 and Redshift, not for triggering Lambda functions on DynamoDB changes.
Question 43
A developer is creating an AWS Lambda function that needs credentials to connect to an Amazon RDS for MySQL database. An Amazon S3 bucket currently stores the credentials. The developer needs to improve the existing solution by implementing credential rotation and secure storage. The developer also needs to provide integration with the Lambda function. Which solution should the developer use to store and retrieve the credentials with the LEAST management overhead?
- A. Store the credentials in AWS Systems Manager Parameter Store. Select the database that the parameter will access. Use the default AWS Key Management Service (AWS KMS) key to encrypt the parameter. Enable automatic rotation for the parameter. Use the parameter from Parameter Store on the Lambda function to connect to the database.
- B. Encrypt the credentials with the default AWS Key Management Service (AWS KMS) key. Store the credentials as environment variables for the Lambda function. Create a second Lambda function to generate new credentials and to rotate the credentials by updating the environment variables of the first Lambda function. Invoke the second Lambda function by using an Amazon EventBridge rule that runs on a schedule. Update the database to use the new credentials. On the first Lambda function, retrieve the credentials from the environment variables. Decrypt the credentials by using AWS KMS, Connect to the database.
- C. Store the credentials in AWS Secrets Manager. Set the secret type to Credentials for Amazon RDS database. Select the database that the secret will access. Use the default AWS Key Management Service (AWS KMS) key to encrypt the secret. Enable automatic rotation for the secret. Use the secret from Secrets Manager on the Lambda function to connect to the database.
- D. Encrypt the credentials by using AWS Key Management Service (AWS KMS). Store the credentials in an Amazon DynamoDB table. Create a second Lambda function to rotate the credentials. Invoke the second Lambda function by using an Amazon EventBridge rule that runs on a schedule. Update the DynamoDB table. Update the database to use the generated credentials. Retrieve the credentials from DynamoDB with the first Lambda function. Connect to the database.
Show answer and explanation ▾
Correct answer: C
AWS Secrets Manager is purpose-built for storing and managing secrets like database credentials with built-in support for automatic rotation. When configured for RDS database credentials, Secrets Manager handles rotation automatically and seamlessly integrates with Lambda functions for retrieving credentials. This provides the least management overhead compared to other options, as rotation and secure storage are fully managed by AWS with minimal developer intervention.
Why the other options are wrong:
- A. Parameter Store does not natively support automatic rotation of database credentials like Secrets Manager does; rotation would require manual setup.
- B. Storing credentials in Lambda environment variables and creating a custom rotation function via EventBridge requires significant manual effort and operational overhead to manage rotation logic.
- D. Using DynamoDB to store credentials and building a custom rotation Lambda function requires extensive custom code and operational management compared to Secrets Manager's built-in capabilities.
Question 44
A developer has written the following IAM policy to provide access to an Amazon S3 bucket: Which access does the policy allow regarding the s3:GetObject and s3:PutObject actions?
- A. Access on all buckets except the "DOC-EXAMPLE-BUCKET" bucket
- B. Access on all buckets that start with "DOC-EXAMPLE-BUCKET" except the "DOC-EXAMPLE-BUCKET/secrets" bucket
- C. Access on all objects in the "DOC-EXAMPLE-BUCKET" bucket along with access to all S3 actions for objects in the "DOC-EXAMPLEBUCKET" bucket that start with "secrets"
- D. Access on all objects in the "DOC-EXAMPLE-BUCKET" bucket except on objects that start with "secrets"
Show answer and explanation ▾
Correct answer: D
Access on all objects in the "DOC-EXAMPLE- BUCKET" bucket except on objects that start with "secrets" The policy contains two statements: the first allows s3:GetObject and s3:PutObject on the resource "arn:aws:s3:::DOC-EXAMPLE-BUCKET/*" (all objects in that bucket), and the second denies all S3 actions (s3:*) on "arn:aws:s3:::DOC-EXAMPLE-BUCKET/secrets/*" (objects starting with 'secrets'). Since the Deny statement overrides the Allow statement, the net effect is that GetObject and PutObject are allowed on all objects in DOC- EXAMPLE-BUCKET except those in the secrets/ prefix, making option D correct.
Why the other options are wrong:
- A. The policy explicitly allows access to the DOC-EXAMPLE-BUCKET, not all buckets except it.
- B. The resource pattern uses a single bucket name (DOC-EXAMPLE-BUCKET) with wildcard for objects, not a pattern that starts with DOC-EXAMPLE-BUCKET.
- C. The policy denies S3 actions on the secrets prefix rather than allowing them, and it doesn't grant 'all S3 actions' on secrets objects.
Question 45
A developer is creating a mobile app that calls a backend service by using an Amazon API Gateway REST API. For integration testing during the development phase, the developer wants to simulate different backend responses without invoking the backend service. Which solution will meet these requirements with the LEAST operational overhead?
- A. Create an AWS Lambda function. Use API Gateway proxy integration to return constant HTTP responses.
- B. Create an Amazon EC2 instance that serves the backend REST API by using an AWS CloudFormation template.
- C. Customize the API Gateway stage to select a response type based on the request.
- D. Use a request mapping template to select the mock integration response.
Show answer and explanation ▾
Correct answer: D
API Gateway's mock integration feature uses request mapping templates to select and return mock responses without invoking backend services. This is the native API Gateway feature designed for exactly this use case-testing and development without backend invocation. It requires the least operational overhead as it is built-in functionality requiring only template configuration.
Why the other options are wrong:
- A. Creating a Lambda function adds unnecessary compute overhead and requires building logic to simulate responses when mock integration is already available.
- B. Provisioning an EC2 instance requires significant operational overhead including instance management, patching, and scaling-far more complex than mock integration.
- C. Customizing stage settings does not directly support simulating different backend responses based on request content; this approach is more limited than mock integration capabilities.
Question 46
A developer has a legacy application that is hosted on-premises. Other applications hosted on AWS depend on the on-premises application for proper functioning. In case of any application errors, the developer wants to be able to use Amazon CloudWatch to monitor and troubleshoot all applications from one place. How can the developer accomplish this?
- A. Install an AWS SDK on the on-premises server to automatically send logs to CloudWatch.
- B. Download the CloudWatch agent to the on-premises server. Configure the agent to use IAM user credentials with permissions for CloudWatch.
- C. Upload log files from the on-premises server to Amazon S3 and have CloudWatch read the files.
- D. Upload log files from the on-premises server to an Amazon EC2 instance and have the instance forward the logs to CloudWatch.
Show answer and explanation ▾
Correct answer: B
The CloudWatch agent is the standard AWS tool for collecting logs and metrics from on- premises servers and sending them to CloudWatch. By downloading the agent to the on- premises server and configuring it with IAM user credentials that have CloudWatch permissions, the developer can monitor both on-premises and AWS applications from a single CloudWatch console. This is the most straightforward and supported approach.
Why the other options are wrong:
- A. The AWS SDK is for programmatic access to AWS services, not for automatic log streaming; it would require custom code to send logs to CloudWatch.
- C. Uploading logs to S3 and having CloudWatch read them adds unnecessary complexity and latency; it is not a supported CloudWatch log ingestion method.
- D. Forwarding logs through an EC2 instance adds an unnecessary intermediary and operational overhead when the CloudWatch agent can connect directly from on- premises servers.
Question 47
An Amazon Kinesis Data Firehose delivery stream is receiving customer data that contains personally identifiable information. A developer needs to remove pattern-based customer identifiers from the data and store the modified data in an Amazon S3 bucket. What should the developer do to meet these requirements?
- A. Implement Kinesis Data Firehose data transformation as an AWS Lambda function. Configure the function to remove the customer identifiers. Set an Amazon S3 bucket as the destination of the delivery stream.
- B. Launch an Amazon EC2 instance. Set the EC2 instance as the destination of the delivery stream. Run an application on the EC2 instance to remove the customer identifiers. Store the transformed data in an Amazon S3 bucket.
- C. Create an Amazon OpenSearch Service instance. Set the OpenSearch Service instance as the destination of the delivery stream. Use search and replace to remove the customer identifiers. Export the data to an Amazon S3 bucket.
- D. Create an AWS Step Functions workflow to remove the customer identifiers. As the last step in the workflow, store the transformed data in an Amazon S3 bucket. Set the workflow as the destination of the delivery stream.
Show answer and explanation ▾
Correct answer: A
AWS Lambda is the native, purpose-built mechanism for transforming data in Kinesis Data Firehose delivery streams. Lambda functions can process records before they reach the destination and return transformed data in the required format. This approach requires minimal infrastructure management and integrates seamlessly with Firehose's built-in transformation capability, making it the most efficient solution for pattern-based data redaction.
Why the other options are wrong:
- B. Using an EC2 instance as a Firehose destination introduces unnecessary operational overhead and doesn't leverage Firehose's native transformation features.
- C. OpenSearch Service is a search and analytics platform, not designed for real-time data transformation in a Firehose pipeline and adds unnecessary complexity.
- D. Step Functions workflows cannot be directly set as Firehose destinations; this approach adds extra complexity without addressing the transformation requirement elegantly.
Question 48
A developer is using an AWS Lambda function to generate avatars for profile pictures that are uploaded to an Amazon S3 bucket. The Lambda function is automatically invoked for profile pictures that are saved under the /original/ S3 prefix. The developer notices that some pictures cause the Lambda function to time out. The developer wants to implement a fallback mechanism by using another Lambda function that resizes the profile picture. Which solution will meet these requirements with the LEAST development effort?
- A. Set the image resize Lambda function as a destination of the avatar generator Lambda function for the events that fail processing.
- B. Create an Amazon Simple Queue Service (Amazon SQS) queue. Set the SQS queue as a destination with an on failure condition for the avatar generator Lambda function. Configure the image resize Lambda function to poll from the SQS queue.
- C. Create an AWS Step Functions state machine that invokes the avatar generator Lambda function and uses the image resize Lambda function as a fallback. Create an Amazon EventBridge rule that matches events from the S3 bucket to invoke the state machine.
- D. Create an Amazon Simple Notification Service (Amazon SNS) topic. Set the SNS topic as a destination with an on failure condition for the avatar generator Lambda function. Subscribe the image resize Lambda function to the SNS topic.
Show answer and explanation ▾
Correct answer: A
Lambda destinations with on-failure conditions is the simplest and most direct solution. When the avatar generator Lambda times out, the destination automatically invokes the resize Lambda function as a fallback. This requires minimal setup-just configuring the destination on the avatar generator function-with no additional services or polling logic needed, making it the least development effort.
Why the other options are wrong:
- B. Using SQS requires creating a queue, configuring the function to poll it, and managing the polling logic, adding unnecessary complexity compared to automatic Lambda destinations.
- C. Step Functions requires defining a state machine and EventBridge rules, which is significantly more development effort than using built-in Lambda destinations.
- D. SNS requires creating a topic, managing subscriptions, and handling asynchronous processing, which is more complex than the direct destination approach.
Question 49
A developer needs to migrate an online retail application to AWS to handle an anticipated increase in traffic. The application currently runs on two servers: one server for the web application and another server for the database. The web server renders webpages and manages session state in memory. The database server hosts a MySQL database that contains order details. When traffic to the application is heavy, the memory usage for the web server approaches 100% and the application slows down considerably. The developer has found that most of the memory increase and performance decrease is related to the load of managing additional user sessions. For the web server migration, the developer will use Amazon EC2 instances with an Auto Scaling group behind an Application Load Balancer. Which additional set of changes should the developer make to the application to improve the application's performance?
- A. Use an EC2 instance to host the MySQL database. Store the session data and the application data in the MySQL database.
- B. Use Amazon ElastiCache for Memcached to store and manage the session data. Use an Amazon RDS for MySQL DB instance to store the application data.
- C. Use Amazon ElastiCache for Memcached to store and manage the session data and the application data.
- D. Use the EC2 instance store to manage the session data. Use an Amazon RDS for MySQL DB instance to store the application data.
Show answer and explanation ▾
Correct answer: B
ElastiCache for Memcached is purpose-built for fast, in-memory session storage and perfectly addresses the identified bottleneck of session management consuming memory. RDS for MySQL provides a managed, scalable database solution for application data. This separation allows the web tier (via Auto Scaling) to remain stateless while offloading session overhead to a dedicated service, directly solving the 100% memory usage issue.
Why the other options are wrong:
- A. Storing session data in MySQL defeats the purpose of scaling horizontally; sessions would still consume significant memory and database I/O, replicating the original performance problem.
- C. ElastiCache for Memcached is optimized for session management but not ideal for storing structured application data; RDS is the appropriate service for order details.
- D. EC2 instance store is ephemeral and lost on instance termination, making it unreliable for session data; it also doesn't solve the memory pressure issue on the web tier.
Question 50
An application uses Lambda functions to extract metadata from files uploaded to an S3 bucket; the metadata is stored in Amazon DynamoDB. The application starts behaving unexpectedly, and the developer wants to examine the logs of the Lambda function code for errors. Based on this system configuration, where would the developer find the logs?
- A. Amazon S3
- B. AWS CloudTrail
- C. Amazon CloudWatch
- D. Amazon DynamoDB
Show answer and explanation ▾
Correct answer: C
AWS CloudWatch is the standard and native destination for Lambda function logs. CloudWatch Logs automatically captures all standard output and error streams from Lambda function execution, making it the primary location for examining function errors and debugging application behavior.
Why the other options are wrong:
- A. S3 is a storage service and not the default logging destination for Lambda functions; logs would need manual export.
- B. CloudTrail logs API calls and management events, not application-level Lambda function output and errors.
- D. DynamoDB is a database service for storing application data, not Lambda function logs.
Get the complete DVA-C02 bank
These 50 questions are roughly 10% of the bank. The full pack has 557 real DVA-C02 questions, each with the same depth of explanation, plus a questions-only PDF for timed practice and free updates forever.
View the full AWS DVA-C02 question bank →