Developer - Associate Practice Questions
Prepare for DVA-C02 with more than an answer.
Unlock the full exam and previous versions
- v1Version 1 212 questions Current
- DVA-C01Legacy AWS Certified Developer - Associate 350 questions Locked
- Exam fee
- $150 USD
- Level
- Associate
Domains covered on the exam 4
- Development with AWS Services32%
- Security26%
- Deployment24%
- Troubleshooting and Optimization18%
- 1
A developer needs to configure an Amazon Cognito user pool. After a user signs up, a welcome email must be sent. Additionally, when a user signs in, the event must be logged to a custom analytics service via an API call. Which Amazon Cognito features should be used to meet these requirements with the LEAST amount of custom infrastructure? (Select TWO)
Show answer details
Correct answer: A, B
Amazon Cognito User Pools have built-in functionality to send emails for various events, including user sign-up and verification. A developer can customize the message templates directly in the Cognito console or via the API, which is the simplest way to send a welcome email.
Cognito Lambda triggers allow developers to run custom logic in response to specific lifecycle events. The Post Authentication trigger is invoked after a user successfully signs in. A developer can write a Lambda function that receives user data from the event and makes an API call to the custom analytics service.
- 2
A developer is writing an AWS Lambda function that will be part of a CI/CD pipeline. The function code has several external library dependencies listed in a
requirements.txtfile. The developer wants to ensure that the deployment package created by the pipeline includes these dependencies. The pipeline uses AWS CodeBuild for the build stage. What is the standard way to package the Lambda function with its dependencies in this scenario?Show answer details
Correct answer: B
The standard method for packaging a Lambda function with its dependencies is to install the dependencies into the root directory of the project alongside the function code. In an AWS CodeBuild environment, this is achieved by adding a command to the
buildspec.ymlfile. For Python,pip install -r requirements.txt -t .installs the libraries listed inrequirements.txtinto the current directory (.). The subsequent build step would then create a zip archive of the entire directory, which becomes the deployment package. - 3
An application is experiencing intermittent performance issues. A developer suspects that a downstream microservice, called via an HTTP API, is the source of the latency. To confirm this, the developer wants to trace the entire lifecycle of a request as it flows through the application's components, including the call to the external microservice. The application is deployed on Amazon EC2 instances. Which service should the developer use to get a detailed visualization of the request flow and identify performance bottlenecks?
Show answer details
Correct answer: B
AWS X-Ray is a distributed tracing service that helps developers analyze and debug production, distributed applications. It provides an end-to-end view of requests as they travel through an application, showing a map of the application's underlying components. By instrumenting the application with the X-Ray SDK, the developer can generate trace data, view a service map to identify bottlenecks, and drill down into specific traces to see the latency of each downstream call.
- 4
A developer is implementing envelope encryption to protect sensitive data before storing it in a database. The application must use AWS Key Management Service (AWS KMS) for key management. The developer needs to understand the correct sequence of API calls to perform this operation.
Arrange the following steps in the correct order to implement envelope encryption.
Show answer details
Correct answer: A
The correct sequence for envelope encryption is: 1. Request a data key from KMS. The
GenerateDataKeyoperation returns both a plaintext version of the key and a version encrypted under the specified KMS Customer Master Key (CMK). 2. Use the plaintext key to perform encryption locally within your application. 3. Store the resulting ciphertext along with the encrypted data key. You need the encrypted data key to decrypt the data later. 4. Erase the plaintext data key from memory as soon as possible to minimize its exposure. - 5
A developer has written an AWS CloudFormation template to provision a serverless application consisting of an AWS Lambda function, an Amazon API Gateway, and an Amazon DynamoDB table. The developer wants to use the AWS Serverless Application Model (SAM) CLI to test the Lambda function locally before deploying it. Which SAM CLI command should the developer use to invoke the function locally with a test event?
Show answer details
Correct answer: C
The
sam local invokecommand allows a developer to run a single invocation of a Lambda function locally. It runs the function code in a Docker container that simulates the Lambda runtime environment. The developer can pass an event payload to the function using the-eor--eventflag, making it ideal for unit and integration testing before deployment. - 6
A developer is building a serverless application that uses an AWS Lambda function to process images uploaded to an Amazon S3 bucket. The function is written in Python and uses the Boto3 library. During testing, the developer notices that the function works correctly for small images but fails with a timeout error for larger images (over 100 MB). The current Lambda configuration has a memory of 128 MB and a timeout of 15 seconds. What is the MOST effective first step to resolve the timeout issue while adhering to the principle of least privilege for resource allocation?
Show answer details
Correct answer: B
In AWS Lambda, CPU power is allocated proportionally to the amount of memory configured. Image processing is a CPU-intensive task. By increasing the memory, the developer also increases the available vCPU, which will speed up the processing of larger images and likely resolve the timeout issue. This is more effective than just increasing the timeout, as it addresses the root cause of the slow performance. AWS Lambda Power Tuning is a tool that can help find the optimal memory setting.
- 7
A developer is creating a CI/CD pipeline using AWS CodePipeline for a serverless application defined in an AWS SAM template. The pipeline needs to deploy to a staging environment for testing and then, after manual approval, deploy to a production environment. The application uses an Amazon API Gateway and an AWS Lambda function. How should the developer configure the pipeline to manage the different API Gateway endpoints for staging and production?
Show answer details
Correct answer: B
The best practice is to use a single Infrastructure as Code (IaC) template and manage environment-specific configurations separately. AWS CodePipeline's AWS CloudFormation deploy action allows specifying a parameter override file. The developer can create
staging-params.jsonandproduction-params.jsonfiles to define stage-specific variables (like Lambda function names, memory sizes, or environment variables) and reference them in the respective deployment stages of the pipeline. - 8
A developer is writing an application that runs on an Amazon EC2 instance. The application needs to make calls to the Amazon DynamoDB API. According to security best practices, the developer must not store AWS credentials in the application code or configuration files. What is the MOST secure and recommended way for the application to obtain AWS credentials?
Show answer details
Correct answer: C
Using IAM roles for EC2 instances is the most secure and recommended method. The application running on the EC2 instance can automatically retrieve temporary credentials from the EC2 metadata service. The AWS SDKs are designed to automatically look for these credentials. This avoids the need to store any long-term credentials on the instance, simplifying credential management and enhancing security.
- 9
A developer needs to design a system that processes a continuous stream of clickstream data. The system must be able to handle unpredictable traffic spikes and process events in near real-time. A key requirement is that the order of events for each user session must be strictly maintained. Which combination of AWS services should be used to meet these requirements? (Select TWO)
Show answer details
Correct answer: B, C
Amazon Kinesis Data Streams is designed for real-time processing of streaming data at scale. To maintain the order of events for each user session, the developer can use the user's session ID as the partition key. All events with the same partition key will be sent to the same shard, ensuring in-order processing within that shard.
AWS Lambda integrates natively with Kinesis Data Streams. It can be configured as a consumer to process records from the stream in micro-batches. Lambda scales automatically with the number of shards and the volume of data, making it ideal for handling traffic spikes without manual intervention.
- 10
A developer has deployed a REST API using Amazon API Gateway, which is integrated with an AWS Lambda function. The API is publicly accessible. The developer wants to prevent abuse by limiting the number of requests a client can make to the API. Specifically, each client should be limited to 10 requests per second with a burst capacity of 20 requests. How can the developer implement this requirement?
Show answer details
Correct answer: B
Amazon API Gateway usage plans are the standard way to manage throttling and quotas for your APIs. A developer can create a usage plan, define the rate (requests per second) and burst limits, and then associate this plan with one or more API stages. If the API requires client-specific keys, the plan can be associated with API keys.
