Scenarios Flashcards
Scenario:
An application running in a local server is converted to
a Lambda function. When the function was tested, an
Unable to import module error showed.
Solution:
Install the missing modules in your application’s folder
and package them into a ZIP file before uploading to
AWS Lambda
Scenario:
A Developer is writing a Lambda function that will be
used to send a request to an API in different
environments (Prod, Dev, Test). The function needs to
automatically invoke the correct API call based on the
environment.
Solution:
Use Environment Variables
Scenario:
A Lambda function needs temporary storage to store
files while executing.
Solution:
Store the files in the /tmp directory
Scenario:
Lambda function is writing data into an RDS database.
The function needs to reuse the database connection
to reduce execution time.
Solution:
Use execution context by placing the database
connection logic outside of the event handler.
Scenario:
A Developer needs to increase the CPU available to a
Lambda function to process data more efficiently.
Solution:
Increase the allocated memory of the function.
Scenario:
A Developer has an application that uses a RESTful API
hosted in API Gateway. The API requests are failing
with a “No ‘Access-Control-Allow-Origin’
header is present on the requested
resource” error message.
Solution:
Enable CORS in the API Gateway Console.
Scenario:
A website integrated with API Gateway requires user
requests to reach the backend server without
intervention from the API Gateway. Which integration
type should be used?
Solution:
HTTP_PROXY
Scenario:
A serverless application is composed of AWS Lambda,
DynamoDB, and API Gateway. Users are complaining
about getting HTTP 504 errors.
Solution:
The API requests are reaching the maximum integration
timeout for API Gateway (29 seconds).
Scenario:
How to invalidate API Gateway cache?
Solution:
- Send a request with a Cache-Control:
max-age header. - Enable the Require Authorization option
on your API cache settings.
Scenario:
A developer needs to deploy different API versions in
API Gateway
Solution:
Use stage variables
Scenario:
A Developer needs a cost-effective solution to delete
session data in a DynamoDB table.
Solution:
Expire session data with DynamoDB TTL
Scenario:
New changes to a DynamoDB table should be recorded
in another DynamoDB table.
Solution:
Use DynamoDB Streams
Scenario:
Reduce the DynamoDB database response time.
Solution:
Use DynamoDB Accelerator (DAX)
Scenario:
Choosing the best partition key for the DynamDB table, involves
Solution:
Using the partition key with the highest cardinality (e.g.
student ID, employee ID)
Scenario:
An application uses a DynamoDB database with Global
Secondary Index. DynamoDB requests are returning a
ProvisionedThroughputExceededException error. Why is
this happening?
Solution:
The write capacity of the GSI is less than the base
table.
Scenario:
What section must be added to a CloudFormation
template to include resources defined by AWS SAM?
Solution:
Transform
Scenario:
A developer needs a reliable framework for building
serverless applications in AWS
Solution:
AWS SAM
Scenario:
A CloudFormation stack creation process failed
unexpectedly.
What happens next?
Solution:
CloudFormation will roll back by deleting resources that
it has already created.
Scenario:
A CloudFormation template will be used across
multiple AWS accounts
Solution:
Use CloudFormation StackSets
Scenario:
It is required that incoming traffic is shifted in two
increments. 10% of the traffic must be shifted in the
first increment, and the remaining 90% should be
deployed after some minutes.
Solution:
Canary
Scenario:
You need to authenticate users of a website using
social media identity profiles.
Solution:
Amazon Cognito Identity Pools
Scenario:
A company has two accounts. The developers from
Account A need to access resources on Account B.
Solution:
Use cross-account access role
Scenario:
Multiple developers need to make incremental code
updates to a single project and then deploy the new
changes.
Describe simplest way to achieve this.
Solution:
Use AWS CodeCommit as the code repository and
directly deploy the new package using AWS
CodeDeploy.
Scenario:
A development team is using CodePipeline to automate
their deployment process. The code changes must be
reviewed by a person before releasing to production
Solution:
Add a manual approval action stage