exam questions

Exam AWS Certified Developer - Associate DVA-C02 All Questions

View all questions & answers for the AWS Certified Developer - Associate DVA-C02 exam

Exam AWS Certified Developer - Associate DVA-C02 topic 1 question 40 discussion

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 Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
[Removed]
Highly Voted 1 year, 4 months ago
ooooh this one was rough. I am going with A --> https://repost.aws/knowledge-center/connect-lambda-to-an-rds-instance I was between A and C... wording for both tricky. But the only way C would work is if the last portion of the sentence the read "Add an inbound rule to SG2 to allow TCP traffic from port 3306" or "Add an outbound rule to SG1 to allow TCP traffic... "
upvoted 10 times
9d8dd9c
6 months, 1 week ago
But aren't the routing on SGs state-full so allowing inbound allows outbound too? or am I confusing that with something else?
upvoted 1 times
Yuri_024
4 months, 1 week ago
SG1 is for the lambda, SG2 is for the database. In option C it says setting inbound traffic for the SG1 on TCP port 3306. But it should be setting inbound traffic for SG2 on TCP port 3306.
upvoted 3 times
...
...
...
shahs10
Highly Voted 2 years, 1 month ago
Selected Answer: A
Correct Answer is Answer A For B creating new VPC for lambda does not seems a suitable solution For C Assigning differrent security groups to both will not work Option D will not be suitable for relational data and involve S3 in solution
upvoted 7 times
...
sumanshu
Most Recent 4 months, 1 week ago
Selected Answer: A
B) Eliminated - Placing the Lambda function in a public subnet compromises security C) Eliminated - The rule should allow traffic to SG2 (the database’s security group) from SG1 (the Lambda function’s security group), not the other way around. D) Eliminated - Adds significant operational complexity
upvoted 1 times
...
wh1t4k3r
8 months, 2 weeks ago
this one is badly written hehe I would say A, but they missed to mention that this only works securely if the secgroup is listed as destination of the rules. B would also work, but you need to properly configure it....
upvoted 2 times
...
Saurabh04
8 months, 3 weeks ago
Correction answer should be option C. Lambda function, configure VPC1 access, and assign separate security groups: Lambda Function: Associate the Lambda function with VPC1. Security Group (SG1): Assign SG1 to the Lambda function. Security Group (SG2): Assign a second security group (SG2) to the Aurora database. Inbound Rule: Add an inbound rule to SG1 to allow TCP traffic from Port 3306 (Aurora database port). This approach ensures proper separation of concerns and simplifies security group management.
upvoted 1 times
...
tsangckl
10 months, 2 weeks ago
This appear at 17 Jun exam
upvoted 4 times
...
65703c1
11 months, 1 week ago
Selected Answer: A
A is the correct answer.
upvoted 2 times
...
ibratoev
1 year, 1 month ago
A seems the answer, although a single SG for both the DB and Lambda is not a great practice. I would go with 2 SGs.
upvoted 3 times
...
TheFivePips
1 year, 1 month ago
Selected Answer: A
Security groups are statefull so you dont need to specify both inbound and outbound rules. However, you should have security groups on both resources as a best practice, and I dont think it is enough to have an inbound rule just on the lambda security group in this case. This would essentially give the DB access to send traffic to the lambda function, rather than the lambda function accessing data from the DB like we want. If the lambda function doesnt have a permission on its security group letting it access the DB, then it will never communicate with it unless the DB contacts it first. If C had placed the inbound permission on the DB, or if it had placed the outbound permission on the lambda then I think it would be right. So while the wording is a little confusing, I think A is correct
upvoted 3 times
...
quanghao
1 year, 6 months ago
Selected Answer: B
A Lambda function and RDS instance in different VPCs First, use VPC peering to connect the two VPCs. Then, use the networking configurations to connect the Lambda function in one VPC to the RDS instance in the other:
upvoted 2 times
...
hcsaba1982
1 year, 6 months ago
Selected Answer: B
This is the only one where lambda can reach the Database anyway, seems to me a prerequisite if the VPC was mentioned. Lambda by default, launched outside your VPC (in an AWS-owned VPC) so it cannot access resources.
upvoted 1 times
[Removed]
1 year, 4 months ago
if it were private maybe... but public so this answer definitely wrong
upvoted 1 times
...
...
dexdinh91
1 year, 6 months ago
Selected Answer: B
B is correct?
upvoted 1 times
...
quanbui
1 year, 6 months ago
Selected Answer: C
C, need 2 SG
upvoted 2 times
[Removed]
1 year, 4 months ago
C the wording throws me off... Because the inbound rule in the end of the statement should be to the database not SG1. so we want to allow lambda access to the DB... The way this option is worded is not really giving lambda access to the db... it's giving DB access to lambda but not the other way around which we need. So leaning with A
upvoted 1 times
...
...
sofiatian
1 year, 7 months ago
Selected Answer: C
Need two security groups. One is for Lambda function. The other one is for DB
upvoted 1 times
konieczny69
1 year, 2 months ago
nonsense why would anyone want sql application port access to lambda?? A is the only naswer
upvoted 2 times
...
...
hsinchang
1 year, 7 months ago
A. right B. public, unsecure C. excessive connections D. additional cost and complexity
upvoted 3 times
...
love777
1 year, 8 months ago
Selected Answer: A
VPC Configuration: Ensure that your Lambda function is configured to run within the same VPC where your Amazon Aurora database resides (VPC1 in this case). Configure the Lambda function to use the appropriate subnets within VPC1, which are associated with the private subnet where your Amazon Aurora database is located. Security Groups: Attach a security group (SG1) to both the Lambda function and the Amazon Aurora database. Configure the security group inbound rules for SG1 to allow incoming TCP traffic on Port 3306, which is the default port for MySQL (used by Aurora). This will allow communication between the Lambda function and the database. Outbound rules should be allowed by default, so you don't need to make any changes there.
upvoted 2 times
...
ninomfr64
1 year, 8 months ago
Selected Answer: A
There isn't the ideal solution to the use case among the options. B) no need to create a new VPC and also you need to add route tables and configure SGs to make it works C) this could work if the rule on SG1 was outbound instead of inbound (the connection is initiated from Lambda to Aurora) D) export data to S3 is overkill and if you do that you no longer need to deploy the lambda in the VPC A) works, as SG1 is attached to both Lambda and Aurora we need outbound rule to 3306 (Lambda initiate communication to Aurora) and also inbound rule from 3306 (to allow Aurora accept connection from Lambda). I don't like to have the same SG1 for both the Lambda and the Aurora
upvoted 5 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago