Question 1 · choose 1
An AWS Lambda function is invoked by Amazon S3 event notifications and writes each new file's rows to an Amazon RDS for MySQL database. When thousands of files arrive at once, the database runs out of connections. The function must never run more than 20 instances at the same time, and other functions in the account must not be affected. What should a data engineer do?
- ASet the function's provisioned concurrency to 20
- BRaise the function's memory
- CRaise the function's timeout to 15 minutes so that fewer retries happen
- DSet the function's reserved concurrency to 20
Show the answer and why
ASet the function's provisioned concurrency to 20
Incorrect
Provisioned concurrency keeps instances initialized to cut cold starts. It does not stop the function from scaling beyond that number.
BRaise the function's memory
Incorrect
More memory brings more CPU and shorter runs, but a burst of files still starts many instances at once.
CRaise the function's timeout to 15 minutes so that fewer retries happen
Incorrect
The timeout limits how long one invocation runs. It does not limit how many instances run at the same time.
DSet the function's reserved concurrency to 20
Correct
Reserved concurrency is the maximum number of concurrent instances for the function, and it is set aside for that function alone. AWS suggests it to protect downstream resources such as database connections.
To protect a database, cap the writer. Reserved concurrency is both the upper limit and a guaranteed share for one function, while provisioned concurrency is about start-up latency.
AWS documentation