AWS Certified Developer Associate (DVA-C02)

The AWS Certified Developer Associate (DVA-C02) were last updated on today.
  • Viewing page 2 out of 215 pages.
  • Viewing questions 6-10 out of 1,075 questions
Disclaimers:
  • - ExamTopics website is not related to, affiliated with, endorsed or authorized by Amazon.and Azure
  • - Trademarks, certification & product names are used for reference only and belong to Amazon.and Azure

Topic 1 - Exam A

Question #6 Topic 1

A developer creates a VPC named VPC-A that has public and private subnets. The developer also creates an Amazon RDS database inside the private subnet of VPC-A. To perform some queries, the developer creates an AWS Lambda function in the default VPC. The Lambda function has code to access the RDS database. When the Lambda function runs, an error message indicates that the function cannot connect to the RDS database. How can the developer solve this problem?

  • A Modify the RDS security group. Add a rule to allow traffic from all the ports from the VPC CIDR block.
  • B Redeploy the Lambda function in the same subnet as the RDS instance. Ensure that the RDS security group allows traffic from the Lambda function.
  • C Create a security group for the Lambda function. Add a new rule in the RDS security group to allow traffic from the new Lambda security group.
  • D Create an IAM role. Attach a policy that allows access to the RDS database. Attach the role to the Lambda function.
Suggested Answer: B
NOTE: Answer is :B
Explanation :The Lambda function cannot access the RDS instance because it is not in the same network. By redeploying the Lambda function in the same subnet as the RDS instance and ensuring that the RDS security group allows traffic from the Lambda function, the Lambda function will gain access.
Question #7 Topic 1

An application under development is required to store hundreds of video files. The data must be encrypted within the application prior to storage, with a unique key for each video file. How should the developer code the application?

  • A Use the KMS Encrypt API to encrypt the data. Store the encrypted data key and data.
  • B Use a cryptography library to generate an encryption key for the application. Use the encryption key to encrypt the data. Store the encrypted data.
  • C Use the KMS GenerateDataKey API to get a data key. Encrypt the data with the data key. Store the encrypted data key and data.
  • D Upload the data to an S3 bucket using server side-encryption with an AWS KMS key.
Suggested Answer: C
NOTE: Answer is :C
Explanation :The KMS GenerateDataKey API will provide a unique key for each video file which satisfies the requirement. The data key is then used to encrypt the data. The encrypted data key and the encrypted data is then stored.
Question #8 Topic 1

A developer created an AWS Lambda function that accesses resources in a VPC. The Lambda function polls an Amazon Simple Queue Service (Amazon SQS) queue for new messages through a VPC endpoint. Then the function calculates a rolling average of the numeric values that are contained in the messages. After initial tests of the Lambda function, the developer found that the value of the rolling average that the function returned was not accurate. How can the developer ensure that the function calculates an accurate rolling average?

  • A Set the function's reserved concurrency to 1. Calculate the rolling average in the function. Store the calculated rolling average in Amazon ElastiCache.
  • B Modify the function to store the values in Amazon ElastiCache. When the function initializes, use the previous values from the cache to calculate the rolling average.
  • C Set the function's provisioned concurrency to 1. Calculate the rolling average in the function. Store the calculated rolling average in Amazon ElastiCache.
  • D Modify the function to store the values in the function's layers. When the function initializes, use the previously stored values to calculate the rolling average.
Suggested Answer: B
NOTE: Answer is :B
Explanation :Storing the raw values in ElastiCache is a good way for the lambda function to retrieve previous values and correctly compute the rolling average. Also, it allows to processe multiple records and calculate correct aggregations.
Question #9 Topic 1

A social media application uses the AWS SDK for JavaScript on the frontend to get user credentials from AWS Security Token Service (AWS STS). The application stores its assets in an Amazon S3 bucket. The application serves its content by using an Amazon CloudFront distribution with the origin set to the S3 bucket. The credentials for the role that the application assumes to make the SDK calls are stored in plaintext in a JSON file within the application code. The developer needs to implement a solution that will allow the application to get user credentials without having any credentials hardcoded in the application code. Which solution will meet these requirements?

  • A Add a [email protected] function to the distribution. Invoke the function on viewer request. Add permissions to the function's execution role to allow the function to access AWS STS. Move all SDK calls from the frontend into the function.
  • B Add a CloudFront function to the distribution. Invoke the function on viewer request. Add permissions to the function's execution role to allow the function to access AWS STS. Move all SDK calls from the frontend into the function.
  • C Add a [email protected] function to the distribution. Invoke the function on viewer request. Move the credentials from the JSON file into the function. Move all SDK calls from the frontend into the function.
  • D Add a CloudFront function to the distribution. Invoke the function on viewer request. Move the credentials from the JSON file into the function. Move all SDK calls from the frontend into the function.
Suggested Answer: B
NOTE: Answer is :B
Explanation :Option B allows the developer to add a CloudFront function to the distribution and invoke it upon viewer request. By adding permissions to the execution role of this function it is able to access AWS STS, which can generate temporary, limited-privilege credentials for the application. This approach eliminates the need for storing credentials in the application code.
Question #10 Topic 1

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.
Suggested Answer: B
NOTE: Answer is :B
Explanation :AWS Lambda's CPU power is proportionally tied to the amount of memory, so by increasing the function's memory, the AWS Lambda function's CPU power will also increase. This makes it more powerful and capable of returning responses more quickly.