You are a developer that is getting started on a new serverless application in AWS. As you research AWS capabilities supporting development activity, you learn about CodeBuild, CodeDeploy, CodePipeline, and the Serverless Application Model.
Starting from existing code, which AWS feature will help your team automate the creation of an initial CI/CD environment?
AWS SAM Pipelines
AWS CodeDeploy
AWS CodePipeline
AWS CodeBuild
Assistant
The AWS feature that will help your team automate the creation of an initial CI/CD environment is:
AWS SAM Pipelines
Explanation:
AWS SAM Pipelines: This enables developers to set up and configure CI/CD pipelines quickly for serverless applications. Starting from existing code, SAM Pipelines can automatically create the infrastructure required to automate your CI/CD process, making it highly targeted for serverless applications.
AWS CodeDeploy: This service automates the deployment of applications to various compute services (e.g., EC2, Lambda, ECS, etc.), but it doesn't create CI/CD pipelines for you.
AWS CodePipeline: This orchestrates the CI/CD workflow, but it doesn't automate the initial creation of an environment for your pipelines.
AWS CodeBuild: This is a build service for compiling code and creating deployable artifacts, but it is not used to create a CI/CD environment.
So, the correct feature for automating the creation of an initial CI/CD environment for serverless applications is AWS SAM Pipelines.
User
As a Solutions Architect for an e-commerce company, you are asked to improve the overall performance of an application that is behind Amazon API Gateway. You also need to protect the backend system and the application from traffic spikes.
What is the optimal solution that you would recommend?
Enable API Gateway to automatically scale and set throttling limits
Enable caching and WAF (Web Application Firewall)
Enable caching and set throttling limits.
Enable caching and scale API gateway services.
Assistant
The optimal solution in this case is:
Enable caching and set throttling limits.
Explanation:
Throttling Limits
Setting throttling limits in Amazon API Gateway helps protect backend systems by controlling the rate of requests users can send to your API. This is critical to prevent traffic spikes from overwhelming your backend resources.
You can configure throttling at the stage or method level, defining the allowed "requests per second" and burst rates.
Caching
Enabling API Gateway caching reduces the load on your backend system, which can significantly improve performance. Cached responses mean fewer requests hit the backend server, lowering the latency and improving the overall performance of the application.
Additional Details on the Alternatives:
Enable API Gateway to automatically scale and set throttling limits: While API Gateway can scale automatically to handle traffic, it's important to combine this with caching and throttling limits to protect your backend and reduce costs. Scalability alone won't address performance improvements for repetitive requests.
Enable caching and WAF (Web Application Firewall): WAF can help protect the application from malicious traffic, but it does not directly address performance improvement or protect the backend from traffic spikes.
Enable caching and scale API Gateway services: Similar to the earlier point, Amazon API Gateway is already designed with automatic scaling capabilities. Caching is indeed important, but adding throttling limits is more critical for protecting the backend from spikes.
Final Recommendation:
Enable caching and set throttling limits: This solution will ensure:
Improved application performance via caching.
Protection against unexpected traffic spikes with throttling, which safeguards backend systems from being overwhelmed.
User
As a senior developer in your team, you were asked by your manager to review deployment options that may be applicable to the serverless application your team is currently working on. Since the application will be under constant heavy load, when it is pushed to production, the deployment process needs to be capable of monitoring the application during the deployment while the traffic is being shifted into the new version in 10 minute increments. Your application predominantly consists of Lambda functions, which process the business logic.
Which of the following options would be most suitable deployment option for your Lambda functions considering the above criteria?
BlueGreen10Percent10Minutes
AllAtOnce
Canary10Percent10Minutes
Linear10PercentEvery10Minutes
Assistant
The most suitable deployment option for your Lambda functions, given the scenario, is:
Canary10Percent10Minutes
Explanation:
The requirements specify that the deployment must:
Be capable of monitoring the application during the deployment.
Shift traffic gradually to the new version in 10-minute increments.
Handle the heavy production load without disruption.
Deployment Options Details:
BlueGreen10Percent10Minutes: The blue/green method deploys the new version to a completely separate environment and redirects all traffic at once or gradually to the new environment, but this is not called "10Percent10Minutes" in any configuration. This term suggests Canary-like behavior instead.
AllAtOnce: Deploys the new version instantly to 100% of traffic. It is fastest but doesn't allow for gradual traffic shifting or monitoring before full deployment, which doesn't meet the criteria.
Canary10Percent10Minutes: This deployment shifts 10% of traffic to the new version for the first 10 minutes, allowing you to monitor the new version in production under partial load. After 10 minutes, if no issues are detected, the remaining 90% of traffic is shifted to the new version. This option is ideal for gradual, monitored deployment in a heavy-load environment.
Linear10PercentEvery10Minutes: This deployment increases the traffic to the new version in 10% increments every 10 minutes, providing more gradual traffic shifting than Canary. However, this approach takes longer to complete the entire rollout, which may delay full availability in a fast-paced e-commerce or production environment.
Why Canary10Percent10Minutes is the Best Choice:
The Canary deployment strategy offers a middle ground between speed (faster than Linear) and safety (monitored and gradual, unlike AllAtOnce). It fits your criteria because it:
Shifts traffic only partially at the start (10%) to monitor the new version under load.
Completes the deployment in just two increments (10 minutes for 10% + 10 minutes for 90%), which is faster than Linear.
Reduces risk compared to BlueGreen or AllAtOnce options.
Final Answer:
The optimal deployment option for your Lambda functions is Canary10Percent10Minutes.
User
You have enabled several of your AWS Lambda functions for an Amazon VPC connection. You defined security groups that allow inbound and outbound access to resources in private subnets of the VPC. An Amazon EC2 instance in one of the defined subnets is running an application that needs to invoke one of your VPC enabled functions.
What options would allow access from a private subnet to your VPC enabled Lambda function? (Select TWO)
Utilize VPC enabled Lambda functions which can be invoked privately from resources in the VPC.Create a Network Load Balancer (NLB), set the Lambda function as its target and invoke the Lambda function from the EC2 instance by sending request to the NLB.Create a NAT Gateway in the public subnet of the VPC and route private traffic through it to the public internet to invoke the Lambda function.Create a Gateway VPC endpoint for the Lambda service and access the Lambda function through AWS network.Create an interface VPC endpoint for the Lambda service.
Assistant
To enable access from a private subnet to your VPC-enabled Lambda functions, the correct options are:
Utilize VPC-enabled Lambda functions which can be invoked privately from resources in the VPC.
Create an interface VPC endpoint for the Lambda service.
Explanation of Each Option:
Utilize VPC-enabled Lambda functions which can be invoked privately from resources in the VPC
Lambda functions that are enabled within an Amazon VPC can automatically communicate with resources in the same VPC, such as EC2 instances in private subnets, without requiring additional network configurations for internet access.
This option allows the EC2 instance within the same VPC to invoke the Lambda function directly, as both are within the private network.
Create an interface VPC endpoint for the Lambda service
An interface VPC endpoint creates a private connection between your Amazon VPC and the Lambda service using AWS PrivateLink.
This allows EC2 instances in private subnets to invoke Lambda functions without requiring access to the public internet or a NAT gateway, ensuring low-latency and secure communication.
For Lambda specifically, interface endpoints are the recommended way to access the service privately.
Incorrect Options:
Create a Network Load Balancer (NLB), set the Lambda function as its target and invoke the Lambda function from the EC2 instance by sending requests to the NLB
While this option is valid for publicly accessible Lambda functions, it is not necessary for VPC-enabled Lambda functions invoked from private resources in the same VPC. It introduces additional complexity and is not relevant in this case.
Create a NAT Gateway in the public subnet of the VPC and route private traffic through it to the public internet to invoke the Lambda function
A NAT Gateway allows private subnets to access the internet, but in this case, the Lambda function is within the same VPC, so invoking it does not require routing public traffic to the internet through a NAT gateway. This option is unnecessary and inefficient.
Create a Gateway VPC endpoint for the Lambda service and access the Lambda function through the AWS network
Gateway VPC endpoints are used for AWS services backed by S3 and DynamoDB. Lambda, on the other hand, requires an since it is not a gateway service. Hence, this option is not applicable.
User
An architect is designing a real-time chat module for a new online game platform and wants to use the WebSocket API capabilities within Amazon API Gateway. An important requirement for this chat system is the ability to track the current number of active users on the platform.
Which of the options below could help implement this functionality?
Use the predefined $active route when a connection is activated to trigger a Lambda function that updates an active users counter stored in a DynamoDB table.
Use the connectanddisconnect predefined routes to trigger a Lambda Function which increments and decrements an active user counter in DynamoDB respectively.
Use the active-connections command on the @connections API to periodically retrieve the total number of active connections and store this as a count in a DynamoDB table.
Use the $default route to trigger a Lambda function that increments an active user count in DynamoDB.
Assistant
The correct option is:
Use the connectanddisconnect predefined routes to trigger a Lambda Function which increments and decrements an active user counter in DynamoDB respectively.
Explanation:
When using Amazon API Gateway's WebSocket API, specific predefined routes are available to handle connection lifecycle events like connection creation and termination. These play an essential role in tracking the number of active users, as follows:
$connect: This predefined route is invoked when a new WebSocket connection is established. A Lambda function associated with this route can be used to increment the active users counter in Amazon DynamoDB.
$disconnect: This predefined route is triggered when a WebSocket connection is closed (either because the user disconnects or the connection times out). A Lambda function associated with this route can be used to decrement the active users counter in Amazon DynamoDB.
By leveraging these two predefined routes, you can accurately track the number of real-time active users on the platform. This process ensures that every connection to the system is accounted for, and connections are also cleared when users disconnect.
Why the other options are incorrect:
"Use the predefined $active route when a connection is activated to trigger a Lambda function that updates an active users counter stored in a DynamoDB table."
There is **no connectdefault`. Therefore, this option is invalid.
User
Single choice
6)
Your company wants to expose their services to external developers as public APIs. They want to do this for monetization, visibility and engagement that results in growth. They also want to throttle requests to those APIs based on defined limits and quotas.
What service would you suggest to meet the requirements?
Application Load Balancer
Lambda Function URL
Amazon API Gateway
AWS AppSync
Assistant
The best service to meet the requirements is:
Amazon API Gateway
Explanation:
Amazon API Gateway:
API Gateway is designed for creating, publishing, maintaining, and securing APIs at scale.
It provides public API endpoints, which makes it ideal for exposing services to external developers.
It allows for monetization through API usage plans, enabling you to create throttling limits and quotas for different API consumers.
API Gateway handles request throttling and quotas natively, so you can control the rate of requests and provide different usage plans for external developers.
Built-in features include caching, analytics, and authentication, allowing for greater flexibility and control.
Why not the other options?
Application Load Balancer:
An Application Load Balancer (ALB) is designed for routing and distributing traffic to backend services (e.g., EC2 instances or containers). It does not manage APIs and has no built-in capabilities for external API publication, quotas, or request throttling.
Lambda Function URL:
Lambda function URLs provide simple HTTP endpoints directly to invoke specific Lambda functions. While they expose services over HTTP, they lack the comprehensive API management, monetization, and throttling features needed for your use case.
AWS AppSync:
AppSync is a fully managed GraphQL API service. It is ideal for creating GraphQL APIs but does not meet the requirements for throttling requests, quotas, or monetization for public APIs.
Final Recommendation:
Amazon API Gateway is the most appropriate service for exposing your company's public APIs while also meeting the requirements for throttling, quotas, and monetization.
User
Single choice
7)
You are a senior application developer working on a serverless application that uses a REST API in Amazon API gateway, Lambda functions, and Amazon DynamoDB. You have been informed by your security team that your serverless application is
vulnerable to parameter tampering attacks. You have been tasked to address this vulnerability before your application's go-live date.
What Amazon API gateway feature can you use to help address this vulnerability?
Configure a request parameter-based Lambda authorizer
Use a Private API with a VPC endpoint policy to control access to the endpoint
Configure a mapping template to reshape the incoming request payload
Configure an Amazon API Gateway model along with a request validator
Assistant
The most suitable option for addressing parameter tampering attacks in this scenario is:
Configure an Amazon API Gateway model along with a request validator.
Explanation:
Parameter tampering attacks involve malicious users manipulating the parameters of HTTP requests (e.g., query string, headers, body, path parameters) to exploit vulnerabilities in the application. To mitigate this, you want to ensure request validation and schema enforcement so that only valid data is passed to your backend system.
Amazon API Gateway models and request validators:
API Gateway allows you to define models that set a schema for the expected request payloads, describing the structure, data types, and constraints for incoming parameters.
Request validators in API Gateway ensure that the incoming requests conform to the models you defined. They verify:
Required parameters are present.
Parameters match the correct data type and format.
The payload structure complies with the model.
With this feature, any malicious requests or payloads that attempt to tamper with parameters will be rejected before they reach your backend Lambda function.
Why not the other options?
Configure a request parameter-based Lambda authorizer:
A Lambda authorizer is used to control access based on authentication and authorization logic (e.g., verifying tokens or user claims). While it can inspect parameters, it won't directly address parameter tampering in terms of enforcing schema validation for the API payloads. This makes models and validators a better fit.
Use a Private API with a VPC endpoint policy to control access to the endpoint:
A private API can limit who has network access to your API, but it does nothing to validate or sanitize the input parameters. This addresses network restrictions, not parameter tampering.
Configure a mapping template to reshape the incoming request payload:
Mapping templates are useful for transforming the request payload before it reaches the backend, but they cannot enforce a strict schema. They process the input as-is, and tampered data could still pass through unless explicitly handled in the transformation logic.
Final Recommendation:
User
Single choice
8)
You are a developer and you are starting to work on a new project. It is your employer's policy to include automated deployment strategy with every new application to follow DevOps best practices. Based on your research, you found out that AWS Serverless Application Model (AWS SAM) is capable of creating CI/CD pipelines from scratch using SAM CLI.
Which sequence of SAM CLI commands will allow you to initialize and deploy your pipeline?
sam pipeline init --bootstrap, sam deploy
sam pipeline bootstrap, sam pipeline build, sam pipeline deploy
sam pipeline init, sam build, sam deploy
sam pipeline init, sam deploy
Assistant
Correct Answer:
sam pipeline init --bootstrap, sam deploy
Explanation:
The AWS Serverless Application Model (AWS SAM) supports creating CI/CD pipelines for serverless applications quickly using the SAM CLI pipeline commands. Based on the scenario, you are tasked with initializing and deploying a pipeline, and the correct sequence is:
sam pipeline init --bootstrap
This command initializes the pipeline configuration and sets up the required CI/CD resources (e.g., CodePipeline, CodeBuild, etc.) for your pipeline.
The --bootstrap flag ensures that AWS SAM automatically creates the required infrastructure resources in your AWS environment for your pipeline's proper functioning. These resources include:
S3 bucket for artifacts.
AWS Identity and Access Management (IAM) roles for permissions.
Any other associated AWS resources for the CI/CD pipeline.
sam deploy
Once the pipeline setup is initialized, sam deploy is used to deploy the pipeline configuration and associated resources. This ensures your pipeline becomes operational and can automatically handle deployments for your serverless application.
Why Not the Other Options?
sam pipeline bootstrap, sam pipeline build, sam pipeline deploy:
This is incorrect because:
The sam pipeline bootstrap command must be preceded by sam pipeline init to configure the pipeline before bootstrapping.
The sam pipeline build command does not exist; the correct command is simply sam build, which is used to build the AWS SAM application, not the pipeline.
The sequence is not valid for creating a pipeline.
sam pipeline init, sam build, sam deploy:
This sequence is used to initialize and deploy a serverless application, not a CI/CD pipeline.
sam build builds the SAM application package but is unrelated to configuring or deploying a pipeline.
sam pipeline init, sam deploy:
This command sequence is close but not entirely correct because it misses the --bootstrap flag during the sam pipeline init command.
Without --bootstrap, the necessary CI/CD infrastructure resources won't be automatically created, which would result in a partial or non-functional pipeline deployment.
Final Answer:
The correct sequence of SAM CLI commands to initialize and deploy a pipeline is:
sam pipeline init --bootstrap, sam deploy
User
Single choice
8)
You are a developer and you are starting to work on a new project. It is your employer's policy to include automated deployment strategy with every new application to follow DevOps best practices. Based on your research, you found out that AWS Serverless Application Model (AWS SAM) is capable of creating CI/CD pipelines from scratch using SAM CLI.
Which sequence of SAM CLI commands will allow you to initialize and deploy your pipeline?
sam pipeline init --bootstrap, sam deploy
sam pipeline bootstrap, sam pipeline build, sam pipeline deploy
sam pipeline init, sam build, sam deploy
sam pipeline init, sam deploy
Assistant
The correct answer is:
sam pipeline init, sam deploy
Explanation:
When working with AWS SAM to set up a CI/CD pipeline for your serverless application, the following steps are relevant:
sam pipeline init:
This command initializes the pipeline configuration for your serverless application.
It helps you define the CI/CD pipeline stages (e.g., source, build, deploy) and creates the necessary configuration files (pipelineconfig.toml).
This is the starting point for setting up an automated deployment strategy.
sam deploy:
Once the pipeline configuration is initialized with sam pipeline init, the sam deploy command is used to deploy the pipeline infrastructure or application itself.
sam deploy ensures that all the pipeline's defined infrastructure, stages, and integrations are created and deployed.
Why Not the Other Options?
sam pipeline init --bootstrap, sam deploy:
This syntax is incorrect because the --bootstrap flag is not used with sam pipeline init. Bootstrapping the pipeline's resources is handled seamlessly within sam pipeline init itself when needed.
sam pipeline bootstrap, sam pipeline build, sam pipeline deploy:
sam pipeline bootstrap: While it is a valid command used to provision resources (like S3 buckets, roles) for a pipeline environment, it would need to be backed by sam pipeline init first.
sam pipeline build: This command does not exist in SAM CLI. SAM uses sam build for preparing application artifacts, but this is unrelated to pipelines.
This sequence is invalid.
sam pipeline init, sam build, sam deploy:
This sequence is relevant for building and deploying a serverless application, not a CI/CD pipeline.
The sam build step is unnecessary in the context of CI/CD pipeline setup since you're deploying pipeline infrastructure and not just application artifacts.
Final Answer:
sam pipeline init, sam deploy
This sequence correctly initializes the pipeline configuration and deploys the pipeline infrastructure, fulfilling the requirement for an automated deployment strategy.
User
Single choice
9)
Your company wants to offer an audio service to the customer uploaded documents. Your application writes the data to Amazon S3 and the S3 put events are stored in Amazon Simple Queue Service (SQS) queue for further processing. A document goes through various stages of processing to extract the text and convert the text file to audio. As the amount of time for each operation is dependent up on the size of the uploaded document, your architect recommended to use a meta data store that will support key-value format.
Which one of the following AWS managed services support the recommended data store?
Amazon Simple Storage Service (Amazon S3). It is a managed Object storage service and supports persistent data store.
Amazon Aurora database. It is a managed Amazon Relational Database Service (Amazon RDS) database service and supports persistent data store.
Amazon Neptune. It is a managed Graph DB service and supports persistent data store.
Amazon DynamoDB. It is a managed No SQL DB service and supports persistent data store.
Assistant
The correct answer is:
Amazon DynamoDB. It is a managed No SQL DB service and supports persistent data store.
Explanation:
Based on the requirements:
You need a key-value datastore to work as a meta data store for keeping track of document processing.
The data includes details like document stages, status, and possibly timings, which fit well in a key-value or NoSQL data model.
The AWS managed services to consider must support:
Key-value format.
Serverless scalability to handle varying loads due to document sizes.
Persistent data storage.
Why Amazon DynamoDB is the correct choice:
DynamoDB is a managed NoSQL key-value database and is built to handle such use cases effectively.
It supports key-value data models and document-style storage, making it the most suitable service for metadata management (stage, status, etc.).
It is fully managed, highly scalable, and offers consistent low-latency performance for reads and writes, making it ideal for high-throughput workloads like audio processing metadata.
Why not other options?
Amazon Simple Storage Service (Amazon S3):
S3 is an object storage service, not a key-value database.
While S3 can store data, it's not optimized for metadata that requires frequent read/write operations or key-value lookups.
S3 is more suitable for storing the documents and audio files, not the metadata.
Amazon Aurora (Relational Database Service - RDS):
Aurora is a relational database suited for structured data with SQL querying.
While it can handle key-value pairs, it introduces unnecessary complexity for a NoSQL use case like metadata storage. Relational databases require schemas and are not as efficient for simple key-value-based queries.
Amazon Neptune (Graph Database Service):
Neptune is a graph database, designed for data that is interconnected and needs query patterns such as traversing relationships.
It would be overkill and unsuitable for simple key-value metadata requirements.
Final Answer:
Amazon DynamoDB is the best choice for a key-value, metadata store.
User
Single choice
10)
Which of the following invocation methods does AWS Lambda support?
Poll, Stream, Synchronous based Invocations
Poll, Batch, Asynchronous based Invocations
Poll, Synchronous, Asynchronous based Invocations
Poll, Batch, Synchronous based Invocations
Assistant
The correct answer is:
Poll, Synchronous, Asynchronous based Invocations
Explanation:
AWS Lambda supports various invocation methods depending on how events are processed and triggered. The invocation methods are:
Poll-based Invocations:
Services like Amazon Kinesis or Amazon SQS can poll events continuously and invoke AWS Lambda functions when new records/messages are available.
AWS Lambda acts as an event processor for these services by automatically polling these event sources.
Synchronous Invocations:
The caller invokes the Lambda function synchronously and waits for the function to finish processing and return a response.
Examples include direct calls to Lambda from services like Amazon API Gateway, AWS SDKs, or other applications.
Asynchronous Invocations:
The caller invokes the Lambda function and immediately receives a success/failure acknowledgment, without waiting for the function to complete its processing.
Examples include event triggers from Amazon S3, Amazon SNS, or AWS CloudWatch Events.
Why Not the Other Options?
Poll, Stream, Synchronous based Invocations:
The term "Stream-based invocation" is not distinct from poll-based invocation (e.g., Lambda polls streams like Amazon Kinesis or DynamoDB Streams), but "Stream-based invocations" is not explicitly recognized as its own category.
Poll, Batch, Asynchronous based Invocations:
Batch invocations do not apply to AWS Lambda. Batch processing typically refers to a concept where a system processes tasks in batches, but Lambda processes single or streaming messages in near-real-time.
Poll, Batch, Synchronous based Invocations:
Similar to the previous, "Batch" is incorrect terminology in the context of AWS Lambda invocation methods.
Summary:
AWS Lambda supports three main invocation methods:
Poll-based (e.g., SQS, Kinesis).
Synchronous (e.g., API Gateway directly calling the Lambda function).
Asynchronous (e.g., S3 event triggers or SNS messages).
Correct Answer: Poll, Synchronous, Asynchronous based Invocations
User
Single choice
11)
As a Solution Architect working for an online gaming company, you have been informed the player feedback system is slow to respond during peak periods. The feedback is reviewed weekly by the game developers. The current system submits the feedback to an Amazon API Gateway which invokes a Lambda function to first validate and then store the review in a Amazon DynamoDB table. This table has been configured with provisioned capacity.
What suggestion would you offer to remove the players wait time?
Increase the Lambda functions memory configuration so that it can process each client request faster.
Change Amazon DynamoDB from provisioned capacity to on-demand allowing the table to scale up to handle any increases in demand.
Insert an Amazon Simple Queue Service queue between the API Gateway and Lambda function. Use Lambda's native SQS poller to read off the queue. Refactor the Lambda function to handle the new event object.
Enable API caching and payload compression in Amazon API Gateway
Assistant
The correct suggestion is:
Insert an Amazon Simple Queue Service (SQS) queue between the API Gateway and Lambda function. Use Lambda's native SQS poller to read off the queue. Refactor the Lambda function to handle the new event object.
Explanation:
The main problem in this scenario is the player feedback system being slow to respond during peak periods, which indicates high latency due to traffic spikes that exceed the system’s current capacity. The player feedback system does not require immediate processing as the feedback is only reviewed weekly, making asynchronous processing a better-fit solution to remove wait times for users.
By introducing an Amazon SQS queue between API Gateway and the Lambda function:
Asynchronous Communication:
API Gateway simply pushes messages (feedback) into the queue, ensuring the user does not have to wait for the Lambda function to process the request.
The SQS queue acts as a buffer, decoupling the clients from the processing Lambda function.
Lambda's Native Polling for SQS:
Lambda's native integration with SQS allows it to automatically poll messages from the queue whenever it has capacity, enabling scalable and distributed processing of requests.
Refactoring Lambda:
Since requests are now fetched from an SQS message, the Lambda function would need to be slightly refactored to process these event objects accordingly.
This architecture allows:
Immediate response to users (the feedback is submitted into the queue quickly).
Controlled backend traffic as Lambda processes requests at a steady rate from the SQS queue, avoiding issues caused by sudden peak loads.
Why Not the Other Options?
Increase the Lambda function's memory configuration so that it can process each client request faster:
Increasing Lambda memory might slightly improve function performance, but it does not address the root issue—high request volume during peak periods. The bottleneck is likely DynamoDB's provisioned capacity or a scaling issue, not the Lambda execution time.
Change Amazon DynamoDB from provisioned capacity to on-demand allowing the table to scale up to handle any increases in demand:
While switching DynamoDB to would allow it to scale automatically with increased workloads, it won't solve . Players would still experience delays as the Lambda directly interacts with DynamoDB for request processing. Moreover, DynamoDB on-demand may increase costs unnecessarily.
User
Single choice
12)
You are a lead engineer at an e-commerce company. You've designed a new architecture for your flagship product using Amazon API Gateway, Amazon DynamoDB, and AWS Lambda. After presenting the solution to your team, they express concern about how they would develop, test, and iterate the application quickly and safely when they have traditionally run applications locally on their machines. Which of the following tool would alleviate their concerns by allowing them to run the application locally, use Infrastructure as Code, quickly package and deploy the application, as well as roll back bad deployments?
AWS Console
AWS Serverless Application Model (SAM)
AWS Lambda UpdateFunctionCode API
AWS CloudFormation
Assistant
The correct answer is:
AWS Serverless Application Model (SAM)
Explanation:
The AWS Serverless Application Model (AWS SAM) is specifically designed to simplify development, testing, packaging, deploying, and managing serverless applications (like your architecture involving API Gateway, DynamoDB, and Lambda). It allows developers to implement Infrastructure as Code (IaC) to define the application's architecture using a YAML or JSON template and provides tools for running applications locally as well as safely deploying changes.
Features of AWS SAM that alleviate your team's concerns:
Local Development and Testing:
AWS SAM CLI allows developers to run and test serverless applications locally on their machines.
Developers can simulate how the application will run in the cloud, including support for API Gateway, Lambda, and DynamoDB interactions.
Infrastructure as Code:
AWS SAM templates allow you to define the entire serverless application architecture (API Gateway, Lambda, DynamoDB, etc.) in code, making it easy to test and iterate changes in a controlled way.
Quick Packaging and Deployment:
The sam deploy command automatically packages and deploys serverless applications to AWS.
SAM performs validations and includes rollback capabilities for flawed deployments to ensure safe iteration.
Safe Deployments and Rollbacks:
AWS SAM integrates with AWS CloudFormation to manage application lifecycle and deployments. If a deployment introduces an issue, AWS SAM supports rollback mechanisms to return your application to the stable previous state.
Why Not the Other Options?
AWS Console:
While the AWS Management Console allows some manual configuration and deployment of API Gateway, Lambda, and DynamoDB, it is not suitable for local development, testing, IaC, or automating CI/CD pipelines. It lacks rollback capabilities for mistakes.
AWS Lambda UpdateFunctionCode API:
The AWS Lambda UpdateFunctionCode API is used to update code of a Lambda function directly, but it does not provide tools for . It's useful only for directly updating Lambda, not managing an entire serverless stack.
User
Single choice
13)
Your team is getting ready to build a new serverless application using AWS Lambda, Amazon DynamoDB, and Amazon API Gateway. You have been tasked with selecting the tool the team will use to build the serverless application. The developers need to be able to locally invoke and test functions and deploy resources in production and non-production environments in a consistent manner.
AWS Serverless Application Model (AWS SAM)
AWS Cloud Development Kit (AWS CDK)
AWS Cloud9
AWS CloudFormation
Assistant
The correct answer is:
AWS Serverless Application Model (AWS SAM)
Explanation:
The AWS Serverless Application Model (AWS SAM) is the best tool for teams building a serverless application using AWS Lambda, Amazon DynamoDB, and Amazon API Gateway. It is specifically designed for serverless applications and provides features tailored to their unique needs, including tools for local testing, development, and consistent deployments across environments.
Why AWS SAM is the Best Choice:
Local Development and Testing:
AWS SAM CLI allows developers to locally invoke and test Lambda functions.
Simulates components like API Gateway and integrates with DynamoDB locally.
Provides a "real-world" testing environment on the developer's local machine for quick debugging and iteration.
Infrastructure as Code (IaC):
AWS SAM allows you to define your application's stack (e.g., Lambda, DynamoDB, API Gateway) in a YAML or JSON template. This makes deployments consistent across production and non-production environments.
Deployment and Resource Management:
Using the sam deploy command, teams can easily deploy the application to AWS environments.
Ensures consistency across different environments by using the same SAM template.
Optimized for Serverless:
SAM extends CloudFormation, optimizing for serverless use cases.
Developers can define serverless-specific resources like AWS::Serverless::Function (for Lambda) with minimal configuration.
Why Not the Other Options?
AWS Cloud Development Kit (AWS CDK):
AWS CDK allows writing Infrastructure as Code in programming languages (e.g., Python, JavaScript, etc.), but it is more suited for general-purpose infrastructure rather than being optimized for serverless applications.
While AWS CDK does support serverless components, it doesn't offer robust local testing capabilities like AWS SAM.
:
User
Single choice
14)
You're working on an existing application that writes its state data to an Amazon DynamoDB Table using the PutItem API. You want to build an asynchronous, event-driven observer mechanism that watches for item-level changes happening in this existing DynamoDB Table and invoke a Lambda function to publish a message to an Amazon Simple Notification Service (SNS) Topic of the change. What is the lowest cost solution while still using DynamoDB?
Update the existing application's implementation to write its state data to Amazon DynamoDB Table, then conditionally wait for a '200 OK' response from the PutItem API before invoking the Lambda function to publish a message to an Amazon Simple Notification Service SNS Topic.
Creating an Amazon EventBridge rule that runs on a regular schedule which invokes a Lambda function. This Lambda function performs a scan operation of the Amazon DynamoDB Table, and performs a diff against its last invocation. If there's a difference, a message is published to an Amazon Simple Notification Service (SNS) Topic.
Use Amazon DynamoDB Streams: as an item is written to the Amazon DynamoDB Table, a new stream record is written to reflect the item-level change that has happened to the table. This new stream record invokes a Lambda function, reading the data from the stream record, and publishes a message to an Amazon Simple Notification Service (SNS) Topic.
Use Amazon Kinesis Firehose: as an item is written to the Amazon DynamoDB Table, Amazon Kinesis Firehose writes the data to Amazon S3 bucket. The Amazon S3 bucket is configured with an onCreate event to invoke a Lambda function that publishes a message to an Amazon SNS Topic.
Assistant
The correct answer is:
Use Amazon DynamoDB Streams: as an item is written to the Amazon DynamoDB Table, a new stream record is written to reflect the item-level change that has happened to the table. This new stream record invokes a Lambda function, reading the data from the stream record, and publishes a message to an Amazon Simple Notification Service (SNS) Topic.
Explanation:
The requirement involves building an asynchronous, event-driven mechanism that observes item-level changes in Amazon DynamoDB and triggers a Lambda function to publish a message to Amazon SNS. The lowest-cost solution leverages built-in AWS capabilities for handling this type of event-driven architecture.
Why Amazon DynamoDB Streams is the Best Solution:
DynamoDB Streams:
DynamoDB Streams is a native feature of DynamoDB that captures item-level changes (e.g., inserts, updates, deletes) happening in the table.
A stream record is created automatically for each change in the table.
You can enable a Lambda trigger for DynamoDB Streams, allowing the Lambda function to process the stream event data and subsequently publish a message to SNS.
Event-driven and Asynchronous:
DynamoDB Streams triggers Lambda asynchronously when data is written to the table, avoiding the need for polling or manual checks.
Lowest Cost:
DynamoDB Streams has a low cost, and Lambda is triggered only on new stream records. Additionally, there is no need for continuous scans or additional services like Kinesis Firehose.
This makes it the lowest-cost and most efficient solution for this scenario.
Real-time Processing:
Using DynamoDB Streams ensures real-time event processing since the stream records are processed as soon as DynamoDB table changes occur.
Why Not the Other Options?
"Update the existing application's implementation to wait for a '200 OK' response from the PutItem API":
Modifying the existing application to include logic for invoking the Lambda function is not ideal for event-driven architectures. This approach with the observer mechanism and adds complexity.
User
Single choice
15)
A company will be modernizing their application which is currently running on Amazon Elastic Cloud Compute (EC2) instances. They have experience with scaling this infrastructure using Amazon EC2 Autoscaling. They want to move to serverless infrastructure consisting of an Amazon API Gateway that triggers Lambda functions. They are consulting you about scaling this new infrastructure.
What should the company consider in order to make sure the serverless infrastructure scales to their needs?
Do nothing. API Gateway and AWS Lambda are managed services that have built-in horizontal scaling, security, and high availability to handle unlimited amount of requests
Throttle Lambda functions by configuring reserved concurrency, sending the excess traffic to Dead Letter Queues (DLQ) that will be handled when the request volume reduces.
Enable Auto Scaling Groups for AWS Lambda to ensure that enough Lambda functions are ready to handle the incoming requests
Look at service limits for Amazon API Gateway and Lambda functions used in order to identify potential bottlenecks and balance performance requirements, costs, and business impact
Assistant
Correct Answer:
Look at service limits for Amazon API Gateway and Lambda functions used in order to identify potential bottlenecks and balance performance requirements, costs, and business impact.
Explanation:
While API Gateway and AWS Lambda are managed services that automatically handle scaling, security, and high availability, they are not unlimited in their capacity or usage. To ensure that the new serverless infrastructure scales to their needs and doesn't exceed service limits, developers must consider service limits and quotas for both API Gateway and Lambda.
Things to Consider for Scaling API Gateway and Lambda:
Service Limits and Quotas:
Both Lambda and API Gateway come with default quotas (soft limits) that can be adjusted by requesting limit increases. For example:
For Lambda functions, the default concurrency limit in most regions is 1,000 concurrent executions (shared across all functions in an account).
For API Gateway, the default regional request rate is 10,000 requests per second (RPS) with a burst limit of 5,000 requests.
Concurrency Impact:
If Lambda concurrency hits its default limit, API Gateway requests may experience increased latency or throttling unless properly managed.
Use Reserved Concurrency to set limits for individual Lambda functions and Provisioned Concurrency to ensure specific functions always have instances "warm" and ready to handle requests.
Monitoring and Balancing Performance:
Employ tools like Amazon CloudWatch Metrics to monitor the infrastructure's performance.
Balance scaling with costs: uncontrolled Lambda scaling may result in a high number of executions, increasing costs.
Potential Bottlenecks:
Consider potential bottlenecks in downstream services such as databases (e.g., DynamoDB, RDS) or external APIs that Lambda may call. These must also be designed to handle the same level of traffic as the serverless infrastructure.
Why Not the Other Options?
"Do nothing. API Gateway and AWS Lambda handle unlimited requests":
User
Single choice
16)
You are consulting for a company that promotes large musical events. They are going to announce a concert of a well known artist and expect a 10 fold increase in requests to their service. The service is based on API Gateway triggering a series of Lambda functions and an Amazon Relational Database Service (Amazon RDS) Database for persistent storage.
What suggestions would you make for cost effective scaling?
Set Lambda provisioned concurrency to a value that meets your cost target
Enable API Gateway caching to reduce backend invocations
Scale the Amazon RDS instance up during the peak request period
Use API Keys to rate limit incoming user requests
Assistant
The correct answer is:
Enable API Gateway caching to reduce backend invocations.
Explanation:
Given the scenario, a 10-fold increase in traffic is expected. To handle this flash traffic without overloading the backend infrastructure (API Gateway, Lambda functions, and Amazon RDS), enabling API Gateway caching is the most cost-effective scaling solution. Here's why:
API Gateway Caching:
Enabling caching in API Gateway stores the responses for pre-defined durations (TTL – time-to-live). Instead of triggering Lambda and querying the RDS database for duplicate requests, API Gateway serves cached responses for repeated requests.
This reduces the number of backend invocations (Lambda and RDS queries), significantly lowering costs while boosting performance.
Since users are likely to request the same or similar data for an upcoming concert (such as event details, ticket availability, etc.), caching is particularly effective during peak traffic.
Why it's cost-effective:
API Gateway caching reduces the number of times Lambda and RDS are called.
Fewer Lambda invocations and RDS queries mean lower costs because Lambda is charged per invocation plus execution time, and RDS has operational and storage costs.
Why Not the Other Options?
Set Lambda provisioned concurrency to a value that meets your cost target:
While provisioned concurrency ensures that Lambda instances are "warm" and ready to handle sudden spikes, it can increase costs significantly since you're reserving capacity even during idle times.
This may improve performance but doesn’t address backend bottlenecks like RDS scaling, and it’s not the most cost-effective strategy for temporary traffic spikes.
Scale the Amazon RDS instance up during the peak request period:
Scaling an RDS instance vertically (e.g., to larger instance types) increases its capacity to handle more queries, but this is expensive and only resolves database-level bottlenecks.
With a 10-fold traffic spike, the scaling needs of both Lambda and RDS are significant. Using API Gateway caching reduces the load on RDS altogether, avoiding the high costs associated with larger database instances.
User
Single choice
17)
You are a solutions architect designing a new music ticketing application. The application will access an Amazon API Gateway, which in turn invokes various Lambda functions to handle ticket purchases, customer signups, and account management. All customer information will be stored in Amazon DynamoDB.
Which of the following security task are you responsible for in accordance with the shared responsibility model?
Routinely updating all Lambda functions with the latest runtime versions to ensure the latest maintenance and security updates are deployed.
Enable and schedule automated patching of the Lambda service within your AWS account.
Enable HTTPS for your Amazon API Gateway to ensure all customer, and payment details sent from the application are encrypted in transit.
Enabling encryption at rest for your Amazon DynamoDB table.
Assistant
The correct answer is:
Enabling encryption at rest for your Amazon DynamoDB table.
Explanation:
AWS Shared Responsibility Model defines responsibilities as follows:
AWS is responsible for "Security of the Cloud": AWS manages the infrastructure (data centers, hardware, AWS-managed services like Lambda and API Gateway, etc.) and ensures these services are secure.
You (the customer) are responsible for "Security in the Cloud": This includes securing your data, configuring services properly, and maintaining secure interaction between resources.
For this specific application:
You, as the customer, are responsible for enabling encryption at rest for your Amazon DynamoDB table. This ensures sensitive customer data like account information and purchases are encrypted while stored.
Why Not the Other Options?
"Routinely updating all Lambda functions with the latest runtime versions to ensure the latest maintenance and security updates are deployed":
AWS is responsible for managing and patching the underlying runtime environments for AWS Lambda.
However, you are responsible for updating your application code to stay compatible with runtime changes. Manually updating runtime versions is not your responsibility as part of the shared responsibility model.
"Enable and schedule automated patching of the Lambda service within your AWS account":
AWS takes care of patching the Lambda service infrastructure and runtime environments, so this is managed by AWS and not your responsibility.
"Enable HTTPS for your Amazon API Gateway to ensure all customer, and payment details sent from the application are encrypted in transit":
By default, Amazon API Gateway endpoints already use HTTPS, so no additional configuration is needed to enable encryption in transit for your traffic. This is also managed as part of AWS's responsibility for "Security of the Cloud".
Key Takeaway:
The encryption of data at rest in DynamoDB is your responsibility. While AWS ensures the underlying encryption mechanisms are implemented securely, you must explicitly enable the feature for your DynamoDB tables to secure your application's customer data.
Final Answer: Enabling encryption at rest for your Amazon DynamoDB table.
User
Single choice
18)
You are an application developer that is tasked to extend an existing backend application with a serverless API behind an Amazon API Gateway. Frontend clients will interact with the API of the existing application and the new serverless API via REST calls. Requests to both APIs are authenticated using a token in the HTTP header verified by the existing IAM solution.
How can you use the existing auth mechanism to secure access to the API Gateway with the least amount of work?
Create an Amazon Cognito User Pool and established a managed synchronization between your existing IAM solution and Cognito. Use the native integration of Cognito with Amazon API Gateway for authentication
Use a Lambda Extension to augment your Lambda functions with functionality to interact with your existing IAM solution. Configure the function to run for every Lambda and cancel code executions when auth fails
Create an Amazon Cognito Identity Pool and add your custom solutions as a federated identity provider. Use the native integration of Cognito with API Gateway for authentication
Use a AWS Lambda authorizer to validate tokens at the existing IAM solution. Connect the Lambda function that serves as your authorizer to a VPC to allow private connectivity to the existing IAM solution
Assistant
The correct answer is:
Use an AWS Lambda authorizer to validate tokens at the existing IAM solution. Connect the Lambda function that serves as your authorizer to a VPC to allow private connectivity to the existing IAM solution.
Explanation:
Since the existing backend application already uses a custom IAM solution to authenticate requests via a token in the HTTP header, the best way to secure access to the Amazon API Gateway while leveraging the existing authentication mechanism with minimal work is to use an AWS Lambda authorizer.
Why Use an AWS Lambda Authorizer:
Custom Authentication Logic:
A Lambda authorizer can implement custom logic to validate tokens with the existing IAM solution. This is especially useful if you already have an established IAM solution managing tokens.
You can reuse the IAM solution without migrating to another authentication system (e.g., Amazon Cognito).
Flexible Integration:
Lambda authorizers can connect to private resources (like the existing IAM solution) via a VPC, ensuring secure and seamless token validation.
Minimal Effort:
You don't need to rewrite or migrate your backend IAM token logic into a new system. Instead, the Lambda authorizer validates the token before the request is passed to the API Gateway.
Efficient Workflow:
Once authenticated, the Lambda authorizer sets the appropriate context for the request (e.g., user permissions) and passes validated requests to the API Gateway or the backend resources.
Why Not the Other Options?
"Create an Amazon Cognito User Pool and establish a managed synchronization between your existing IAM solution and Cognito."
While Cognito integration with API Gateway is native, synchronizing an existing IAM solution with Cognito requires significant work, such as user data migration or managing synchronization complexity.
This option is more suited for building entirely new authentication systems or replacing existing solutions, which is not the goal here.
"Use a Lambda Extension to augment your Lambda functions with functionality to interact with your existing IAM solution."
Lambda extensions are used to add custom functionality outside the function execution time, like logging or monitoring, but requiring each Lambda function to validate tokens adds complexity.
User
Single choice
19)
Your customer, who runs an online shopping platform with consistent and predictable traffic, is planning to incrementally migrate to serverless. They are looking to start with a microservice that returns available quantity for a product. This microservice is currently running as a container on premise and is continuously invoked. The development team is looking to lift and shift this service into serverless.
Which of the following will be simplest option to lift and shift this container based microservice to serverless without making changes to the microservice?
Create a Lambda function to fetch the quantity. Use API Gateway to direct traffic for inventory check to this Lambda Function.
Deploy the microservice as a container based app on Amazon Elastic Container Service (ECS). Use Application Load Balancer to direct traffic for inventory check to this microservice
Deploy the microservice as a container based app on AWS Fargate. Use Amazon API Gateway to direct traffic for inventory check to this microservice
Create a Lambda function to fetch the quantity. Use Application Load Balancer to direct traffic for inventory check to this Lambda Function
Assistant
The correct answer is:
Deploy the microservice as a container-based app on AWS Fargate. Use Amazon API Gateway to direct traffic for inventory check to this microservice.
Explanation:
This question discusses a "lift-and-shift" strategy for migrating an existing on-premises container-based microservice to a serverless architecture. The simplest option to lift and shift without making significant changes to the microservice is to use AWS Fargate, which supports running containerized applications serverlessly.
Why AWS Fargate with API Gateway?
Lift-and-Shift Simplicity:
AWS Fargate allows you to run containers without managing servers. Since the microservice is already a container-based app, Fargate provides a seamless way to deploy it without modifying the codebase.
No need to rework the application to fit AWS Lambda's architecture or executable requirements.
API Gateway for Traffic Management:
Amazon API Gateway can be used as the frontend to direct traffic to the AWS Fargate service. This ensures a serverless API endpoint is exposed to clients.
API Gateway integrates natively with ECS services (via a VPC link) and provides advanced HTTP functionalities, such as request throttling and caching.
Serverless and Managed:
Unlike Amazon ECS with EC2 (which requires managing EC2 instances), Fargate is fully serverless and automatically scales containers based on the traffic, which meets the requirement to migrate incrementally to serverless infrastructure.
It operates on a pay-per-use model, making it cost-efficient for predictable and consistent workloads.
Why Not the Other Options?
"Create a Lambda function to fetch the quantity. Use API Gateway to direct traffic for inventory check to this Lambda Function."
While AWS Lambda is serverless, this option requires re-writing the container-based microservice into a Lambda function, which does not satisfy the lift-and-shift requirement.
Migrating a container to Lambda introduces added complexity, such as handling execution contexts, timeouts, cold starts, and designing the microservice for event-based triggers.
User
Single choice
20)
An organization developed serverless applications by using an event driven architecture (Amazon API Gateway, AWS Lambda). When launched in production, customers complained about slow response during the morning peak hours. Developers pointed out it is related to AWS Lambda cold starts. On average, the development team estimated there will be 100 concurrent users.
How do you mitigate the AWS Lambda cold starts?
Prevent AWS Lambda cold start with the Amazon CloudWatch Metrics to schedule events on morning hours.
Prevent AWS Lambda cold starts with Lambda provisioned concurrency.
Prevent AWS Lambda cold starts with Lambda reserved concurrency.
Prevent AWS Lambda cold starts by increasing the service limits.
Assistant
The correct answer is:
Prevent AWS Lambda cold starts with Lambda provisioned concurrency.
Explanation:
A cold start occurs when an AWS Lambda function is invoked for the first time, or after a period of inactivity, and AWS needs to initialize a new execution environment for the function. This can cause latency, which is problematic for applications requiring low-latency responses.
Why Lambda Provisioned Concurrency is the Solution:
Provisioned Concurrency:
Ensures that a specified number of warm execution environments are always available and ready to handle requests for your AWS Lambda function.
Prevents cold starts during high-demand periods, such as the morning peak hours mentioned in the question.
This is the recommended solution for applications with predictable traffic patterns and low-latency requirements.
100 Concurrent Users:
With an estimated 100 concurrent users, you can configure provisioned concurrency to prepare warm environments for the necessary number of concurrent executions (e.g., set provisioned concurrency to 100).
On-demand Scalability:
While Provisioned Concurrency ensures low-latency responses by avoiding cold starts, Lambda can still scale on-demand beyond the provisioned concurrency level if needed.
Why Not the Other Options?
"Prevent AWS Lambda cold start with the Amazon CloudWatch Metrics to schedule events on morning hours."
This involves scheduling invocations (e.g., "pinging" the Lambda function) at regular intervals to keep execution environments warm. However:
This approach is not reliable because you cannot guarantee sufficient warm containers for all concurrent requests during high traffic periods.
It may increase Lambda costs unnecessarily as it keeps invoking the function even if there are no active users.
"Prevent AWS Lambda cold starts with Lambda reserved concurrency."
Reserved Concurrency guarantees a certain number of concurrent executions for a Lambda function (to avoid other functions consuming all available concurrency).
User
Multiple choice
21)
A large company is planning to adopt serverless. To begin, they want to migrate a maintenance script written in Python that is run nightly.
Which of the following services could they use as part of the migration? (Select TWO)
Amazon SNSAWS LambdaAWS BatchAmazon EventBridgeAmazon Simple Queue Service
Assistant
The correct answers are:
1. AWS Lambda 2. Amazon EventBridge
Explanation:
To migrate a nightly maintenance script to a serverless architecture, the ideal approach is to use AWS Lambda for executing the Python script, and Amazon EventBridge for scheduling the script to run nightly. Here's why:
1. AWS Lambda
AWS Lambda is a serverless computing service that allows you to run code without provisioning or managing servers.
It supports Python, so the existing script can run as a Lambda function with minimal changes.
It scales automatically based on traffic, and you're billed only for the compute time your code uses, making it a serverless choice for running a maintenance task.
2. Amazon EventBridge
Amazon EventBridge is a serverless event bus service that allows you to schedule tasks or respond to various events.
You can create a schedule rule in EventBridge to run the Lambda function on a nightly schedule (e.g., "every day at 2 AM"), making it perfect for running periodic maintenance scripts.
EventBridge integrates natively with AWS Lambda, simplifying the orchestration process.
Why Not the Other Options?
Amazon SNS (Simple Notification Service):
Amazon SNS is a pub/sub messaging service for sending notifications to multiple subscribers.
While it's great for sending messages between distributed systems, it’s not suited for executing or scheduling tasks, so it doesn't fit this use case.
AWS Batch:
AWS Batch is designed for batch processing at scale, such as managing large numbers of parallel or distributed jobs (e.g., scientific simulations, data processing pipelines).
For a simple nightly script, AWS Batch is overkill and not a cost-effective solution compared to AWS Lambda.
Amazon SQS (Simple Queue Service):
Amazon SQS is a message queuing service for decoupling systems and managing asynchronous communication between components.
It does not directly execute code or handle scheduling, so it does not fit this use case.
Summary:
To migrate a nightly maintenance script to a serverless system:
Use AWS Lambda to execute the Python script.
Use Amazon EventBridge to schedule Lambda invocations on a nightly basis.
Correct Answers:
AWS Lambda
Amazon EventBridge
User
Single choice
22)
A travel company is developing a new search engine that queries multiple airlines to find the best fares. Requests are sent to the airlines in parallel to minimize latency to customers and results are returned to the client as they arrive. The company has decided to use Amazon API Gateway REST APIs and airline partner have committed to a 15 second maximum SLA for search results.
Which of the following approaches offers the most flexibility to add new airlines partners while orchestrating the requests.
Proxy search requests to an SNS Topic that sends messages to airlines with search parameters. Subscribe a Lambda function to a second SNS Topic on which to receive and aggregate results.
Proxy search results to an AWS Step Functions workflow. Use a parallel state to send synchronous requests to all airlines. When all responses are received, move to aggregate step and return.
Proxy request to Lambda function. Using Node.js, send requests to all airlines and then use a Lambda Destination to aggregate results together before returning to client.
Proxy search requests to an SQS Queue. Use AWS Fargate to read messages from queue and send search parameters to airlines. Wait for results and then return to client.
Assistant
The correct answer is:
Proxy search results to an AWS Step Functions workflow. Use a parallel state to send synchronous requests to all airlines. When all responses are received, move to aggregate step and return.
Explanation:
For the given scenario, where multiple requests need to be sent in parallel to query airlines, and the system needs to aggregate responses and provide results back to the client, AWS Step Functions with a Parallel State offers the most flexible and scalable approach for orchestrating these tasks, especially as new airline partners are added.
Key Benefits of Using AWS Step Functions:
Flexibility:
Step Functions allow you to easily add new airlines by adding new branches to the Parallel State without changing significant amounts of code.
New airline integrations can simply involve adding additional request paths in the workflow definition, which simplifies scalability and flexibility.
Orchestration with Parallel State:
The Parallel State in Step Functions allows you to send requests to all airline APIs at the same time, minimizing latency.
Each branch can handle its own invocation (e.g., sending a search request and waiting for the airline's response), and Step Functions can wait for all branches to complete or handle partial results within a defined timeout.
Aggregation Step:
After all requests have completed or timeouts have occurred, Step Functions transitions to the aggregate step to combine the airline results.
Built-in Timeouts and Retries:
Step Functions allow configurable timeouts and retries for each step, which is crucial when working with an SLA for airline responses (e.g., 15 seconds max).
This ensures that the workflow remains robust and can handle intermittent failures in airline APIs.
Serverless and Scalable:
Step Functions is completely managed and serverless. No infrastructure provisioning is needed, and it scales automatically with the number of requests.
Why Not the Other Options?
Proxy search requests to an SNS Topic that sends messages to airlines with search parameters. Subscribe a Lambda function to a second SNS Topic on which to receive and aggregate results:
User
Single choice
23)
A hotel booking application's backend has been built with micro-services using AWS Lambda. Many of these micro-services require access to a common database. The developers have asked you what is the best way to store the database connection string and username/password to allow each service to connect. The connection parameters will vary based on which environment (Dev/Test/Prod) that the micro-services are deployed. What is the best method to store the common configuration?
What is the best method to store the common configuration?
AWS Config
AWS AppConfig
AWS Lambda Environment Variables
Application source code
AWS Systems Manager Parameter Store
Assistant
The correct answer is:
AWS Systems Manager Parameter Store
Explanation:
AWS Systems Manager Parameter Store is the best method for securely storing configuration data like database connection strings, usernames, and passwords, especially for serverless applications using AWS Lambda. It provides a centralized, secure, and flexible solution for managing and retrieving sensitive parameters across environments like Dev, Test, and Prod.
Why AWS Systems Manager Parameter Store is the Best Option:
Secure Storage:
It supports encryption of sensitive data using AWS Key Management Service (KMS) keys, ensuring that credentials, like database usernames and passwords, are securely stored.
Environment-Specific Configuration:
You can store configuration parameters for different environments (Dev/Test/Prod) under different paths or namespaces (e.g., /Prod/Database/ConnectionString). This makes it easy to manage and retrieve configurations specific to each environment.
Dynamic Access:
Lambda functions can access the parameters dynamically at runtime, ensuring that sensitive information is not hardcoded or stored in environment variables.
Centralized Configuration Management:
AWS Systems Manager Parameter Store serves as a centralized location for storing shared configurations and sensitive secrets for all your microservices.
Built-In Integration with Lambda:
AWS Lambda functions can use the AWS SDK to fetch configurations from Parameter Store at runtime. You can also use a caching library to minimize latency when retrieving parameters.
Why Not the Other Options?
AWS Config:
AWS Config is a governance and compliance service used to track configuration changes in AWS resources. It does not store sensitive application configuration or parameters.
AWS AppConfig:
AWS AppConfig is designed for dynamic feature flags, app configuration rollouts, and runtime configuration changes. While it can store non-sensitive application-level configurations, it is .
User
Single choice
24)
Your application recently experienced a large surge in usage that has led to higher costs than you estimated. The application uses Amazon Simple Notification Service (SNS) to publish customer profile changes to an AWS Lambda function. You have noticed that your Lambda costs are far higher than expected even though you return from the function immediately when the function does not need to process the change.
How can you lower costs with minimal changes to the application code and/or architecture?
Add an Amazon Simple Queue Service (SQS) queue and let the application send the messages to SQS. Spin up Amazon EC2 instance to filter the messages and post to Amazon Simple Notification Service (SNS) topic. As all the messages has valid data, no additional charges incurred at the Lambda layer.
Use Amazon SNS attribute based message filtering to only send messages that need to be processed downstream to Lambda.
AWS Lambda is a serverless service and not meant for the high-volume traffic. Replace Lambda with Amazon EC2 based instance.
Before sending the messages to Amazon Simple Notification Service (SNS) topic filter the messages at the application level. As all the messages has valid data, no additional charges incurred at the Lambda layer.
Assistant
The correct answer is:
Use Amazon SNS attribute-based message filtering to only send messages that need to be processed downstream to Lambda.
Explanation:
In this scenario:
The AWS Lambda function is invoked unnecessarily for messages that it does not need to process, leading to higher costs.
By filtering messages at the Amazon SNS level using attribute-based message filtering, you can avoid invoking the Lambda function altogether for messages that are not relevant. This reduces Lambda invocations and, in turn, the associated costs.
Why Use Amazon SNS Attribute-Based Message Filtering:
Efficient Messaging Filter:
Amazon SNS supports attribute-based message filtering by applying filter policies to subscriptions. Messages that do not match the filter policy are not sent to the subscriber (the Lambda function in this case).
This way, Lambda is only invoked for relevant messages, significantly reducing unnecessary invocations and costs.
Minimal Code and Architecture Changes:
Adding a filter policy to the SNS subscription is a configuration change and does not require modifying the application code or introducing new infrastructure.
The Lambda function remains unchanged while still processing only the necessary messages.
Cost Optimization:
AWS Lambda charges are based on invocations and duration. By narrowing down the set of events sent to Lambda, you reduce the number of invocations and save costs.
Why Not the Other Options?
"Add an Amazon Simple Queue Service (SQS) queue and spin up Amazon EC2 instance to filter the messages."
This introduces unnecessary complexity:
Spinning up and managing EC2 instances adds infrastructure overhead and increases costs.
SQS itself adds extra charges for queue operations.
Amazon SNS already supports built-in filtering, making this solution inefficient.
"AWS Lambda is a serverless service and not meant for high-volume traffic. Replace Lambda with Amazon EC2."
This is incorrect. AWS Lambda is designed for high-volume traffic and scales automatically to handle thousands of concurrent requests.
User
Single choice
25)
You have built a CloudWatch dashboard that consolidates system metrics from Lambda functions powering your serverless e-commerce backend. You also use CloudWatch logs for troubleshooting. The business would like insights into what is popular and has asked you provide metrics on orders placed by product category.
What is the most scalable and easiest way to implement this?
Write a CloudWatch logs insights query against logs and add to dashboard
Use metric filters to extract information from logs
Publish business level metrics as custom metrics from lambda function using CloudWatch PutMetricData API
Use embedded metric format (EMF) to log
Assistant
The correct answer is:
Use embedded metric format (EMF) to log
Explanation:
In this case, the goal is to collect business-level metrics, such as orders placed by product category, in a serverless and scalable manner. The Embedded Metric Format (EMF) is the most scalable and easiest way to implement this because it allows you to natively embed metric data into your CloudWatch Logs and automatically creates CloudWatch metrics based on the logged data without requiring additional pipeline processing.
Why Use Embedded Metric Format (EMF)?
Native Integration with CloudWatch Logs and Metrics:
EMF enables Lambda functions to log data in a specific format that CloudWatch interprets as metrics.
This effectively combines logging and monitoring into a single operation, saving you the effort of using additional APIs or writing custom code.
Business Metrics:
By embedding metrics like product categories and order counts in the logs, you can extract meaningful data (e.g., tracking popular product categories) directly as CloudWatch metrics.
These metrics can be visualized on CloudWatch dashboards or used with alarms for alerts.
Scalability:
EMF automatically integrates with CloudWatch’s native metric system, eliminating the need for storing or processing logs elsewhere, making it both scalable and cost-effective for serverless applications like Lambda.
Ease of Use:
Lambda functions only need to log business data (e.g., order category) in the JSON format required by EMF, and CloudWatch automatically generates metrics from it.
There is no need to manually parse logs, create filters, or use complex querying mechanisms.
Why Not the Other Options?
"Write a CloudWatch logs insights query against logs and add to the dashboard":
While CloudWatch Logs Insights is powerful for ad hoc analysis and troubleshooting, it is not ideal for ongoing, scalable metric tracking.
Using Logs Insights queries requires manual updates and added complexity in configuring and maintaining queries.
User
Single choice
26)
A retail company has asked you to improve their backend infrastructure. They are receiving customer complaints about their web store. On peak load hours, customers are seeing error messages from the backend when they submit purchase orders. The orders are lost unless the customers repeat the order process.
How can you change the infrastructure to improve the customer experience and avoid losing orders?
Create asynchronous communication between the Amazon API Gateway and Amazon Lambda using an Amazon Simple Queue Service (SQS) queue to store incoming orders until they are processed by Lambda.
Use API Gateway throttling to avoid overwhelming the backend with too many requests avoiding the generation of errors.
Create asynchronous communication between the API Gateway and Lambda using an Amazon Simple Notification Service (SNS) to store the orders until they are processed by Lambda.
Create synchronous communication between the Amazon API Gateway and AWS Lambda and have Amazon API Gateway send failed requests to an Amazon Dead Letter Queue
Assistant
The correct answer is:
Create asynchronous communication between the Amazon API Gateway and Amazon Lambda using an Amazon Simple Queue Service (SQS) queue to store incoming orders until they are processed by Lambda.
Explanation:
The scenario describes a backend system under high load during peak hours, where requests/orders are lost if failures occur. To improve the infrastructure and avoid losing orders, an architecture with asynchronous communication is the right approach. By introducing Amazon SQS as a buffer between API Gateway and Lambda, you can ensure that all incoming orders are captured and durably stored until they can be processed. This approach decouples the order intake from the order processing, dramatically improving reliability and scalability.
Why Use Amazon SQS with Asynchronous Communication:
Durable Storage:
Amazon SQS stores orders/messages reliably until they are processed by the system, ensuring that no requests are lost, even during peak load or backend failures.
Decoupling:
By introducing SQS as an intermediary queue, you decouple API Gateway from Lambda. This ensures the API Gateway immediately acknowledges the customer's request, allowing the customer experience to be seamless while the backend processes the request asynchronously.
Automatic Scaling:
Even under heavy loads, SQS can scale to handle an almost unlimited number of incoming messages. Lambda will process messages when capacity is available.
Error Handling:
In case Lambda fails to process a message, SQS can be configured with a Dead Letter Queue (DLQ) for troubleshooting and retrying failed orders.
Improved Customer Experience:
Customers will no longer see error messages during peak load because the API Gateway no longer depends on immediate Lambda processing. Customers get immediate acknowledgment that their order is received.
Why Not the Other Options?
"Use API Gateway throttling to avoid overwhelming the backend with too many requests avoiding the generation of errors."
, which may prevent errors caused by overloading the backend. However:
User
Single choice
27)
As a developer, you are refactoring an existing AWS Lambda function. The function currently stores data in an Amazon DynamoDB table but the size of items sometimes exceeds 400KB, causing an error. You have decided to store one of the larger data fields in an Amazon Simple Storage Service (S3) bucket to reduce the item size in DynamoDB.
What steps are required to allow the function to access the bucket in addition to the existing table?
Update the Lambda execution role to include s3:* on the bucket permissions.
Update the Lambda execution role trust policy to include both the S3 bucket and the DynamoDB table.
Update the Lambda execution role to include s3:PutObject permissions for all buckets.
Update the Lambda execution role to include s3:PutObject permissions for this bucket.
Assistant
The correct answer is:
Update the Lambda execution role to include s3:PutObject permissions for this bucket.
Explanation:
In AWS, Lambda functions run using an execution role that grants the function permissions to access AWS resources. To allow your Lambda function to store larger data fields in an Amazon S3 bucket, you need to modify the Lambda execution role to include the required S3 permissions.
Steps Required to Enable the Lambda Function to Access the S3 Bucket:
Grant Specific S3 Permissions:
For storing data in S3, the required permission is s3:PutObject. This allows the Lambda function to upload objects to the S3 bucket.
Specify the Bucket Name:
For security and best practices, you should minimize the scope of the permissions. Instead of granting access to all buckets in your account, the permissions should be scoped down to only the specific bucket that the Lambda function will use.
Execution Role Update:
Update the policy attached to the Lambda execution role to include the following statement:
s3:PutObject is the required action for uploading objects to the bucket.
Resource specifies the ARN (Amazon Resource Name) of the S3 bucket in which the objects will be stored. The /* ensures the permission applies only to the objects inside the specified bucket.
Why Not the Other Options?
"Update the Lambda execution role to include s3:* on the bucket permissions."
Granting s3:* provides all actions on the bucket, including unintended permissions like s3:DeleteBucket, s3:GetObject, or s3:ListBucket.
This is against the principle of least privilege, which states you should only grant permissions strictly needed for the task (in this case, ).
User
Single choice
28)
You have written a custom hash function in AWS Lambda. You are able to invoke the function in your account. You need to grant access to invoke the function to all member accounts of an AWS Organization.
Which of the following actions meet this requirement?
Create an execution role in each of the organization's member accounts and attach it to the Lambda function.
Create a resource policy and attach it to your Lambda function. Specify the Principal as '*' and use a condition to specify the organization's PrincipalOrgID.
Define the Lambda function as a global public function.
Create an SCP at the organization level that allows all member accounts to access the Lambda function.
Assistant
The correct answer is:
Create a resource policy and attach it to your Lambda function. Specify the Principal as '*' and use a condition to specify the organization's PrincipalOrgID.
Explanation:
To allow all member accounts of an AWS Organization to invoke a Lambda function, you need to apply a resource-based policy to the Lambda function. The resource policy should specify wildcard access ("Principal": "*") and use a condition key ("aws:PrincipalOrgID") to restrict access only to accounts within your AWS Organization.
Why This Works:
Resource-Based Policies for AWS Lambda:
Lambda functions use resource policies to grant access to resources across accounts, services, or organizations.
By specifying "Principal": "*", the function can be invoked by anyone who satisfies the policy conditions.
Restrict Access with PrincipalOrgID:
The condition "aws:PrincipalOrgID" ensures that even though the "Principal" allows access for all, only member accounts in the specified AWS Organization will be able to invoke the Lambda function.
"Create an execution role in each of the organization's member accounts and attach it to the Lambda function":
If you create execution roles in each member account, you cannot attach them directly to the Lambda function.
Lambda uses resource policies to manage cross-account or organizational access, not IAM execution roles.
User
Single choice
29)
A banking organization is investigating how to migrate an existing system to serverless. This system is built using a monolithic architecture and is currently hosted in AWS on Amazon Elastic Compute Cloud (EC2) which is accessed by customers using an Application Load Balancer (ALB). The system has a number of critical components that are important to maintaining the integrity of customer banking transactions. However, a number of non-critical components have been identified as being suitable for the initial migration to serverless. The organization wants to migrate components as soon as possible in a gradual manner that reduces risk and disruption to its customers.
What migration strategy would you recommend for this system?
Use the Strangler migration pattern to incrementally decompose the monolith and gradually migrate non-critical system components to serverless by routing non-critical routes in the Application Load Balancer (ALB) to serverless backends.
Adopt the Leapfrog pattern to completely rebuild and replace the whole current system with a new serverless cloud architecture and migrate to the new system in a single step.
Refactor the system to use containers. Use the Organic migration strategy to lift-and-shift the complete containerized system to the Amazon Elastic Container Service (Amazon ECS) using AWS Fargate for the underlying compute to satisfy the serverless requirement.
Use serverless to automate build tasks for the existing system and use this learning to migrate the complete existing application to a serverless cloud architecture.
Assistant
The correct answer is:
Use the Strangler migration pattern to incrementally decompose the monolith and gradually migrate non-critical system components to serverless by routing non-critical routes in the Application Load Balancer (ALB) to serverless backends.
Explanation:
The Strangler migration pattern is an ideal strategy for incrementally migrating a monolithic application to a serverless architecture. This approach enables teams to gradually transition parts of the application without disrupting the entire system or exposing customers to unnecessary risks.
Why the Strangler Pattern is the Best Fit:
Gradual Migration:
It allows the organization to incrementally migrate non-critical components of the system to serverless, while critical components remain in the monolithic architecture until they can be safely migrated.
This reduces risk by not attempting a complete system migration all at once.
Reduced Disruption:
By routing only specific ALB routes for non-critical components to serverless backends, the impact on customers is minimized.
Mitigating Risk:
The strangler pattern ensures that critical components remain stable in the existing architecture while non-critical components benefit from the agility and scalability of serverless.
Flexibility:
This pattern provides flexibility to test and validate new serverless components before fully replacing the monolith.
Over time, new functionality is added directly into the serverless architecture while legacy functionality is phased out.
Why Not the Other Options?
"Adopt the Leapfrog pattern to completely rebuild and replace the whole current system with a new serverless cloud architecture and migrate to the new system in a single step."
The Leapfrog pattern involves a complete overhaul of the monolithic system and moving all components into a new architecture at once. While this might result in a cleaner architecture, it:
Is risky for a critical banking system where transactions must remain reliable.
Introduces significant disruption to customers.
Requires more time and effort before results are visible compared to an incremental approach.
User
Single choice
30)
You manage an application that uses an Amazon API Gateway REST API and an AWS Lambda function that needs read and write access to DynamoDB.
Which of the following grants the function access to DynamoDB in the MOST secure manner?
Create a function resource-based policy with DynamoDB read and write operations to access all DynamoDB tables.
Create an IAM policy with DynamoDB read and write operations to access all DynamoDB tables. Add the policy to the function execution role.
Create an IAM policy with DynamoDB read and write operations to access specific DynamoDB tables. Add the policy to the function execution role.
Create a function resource-based policy with DynamoDB read and write operations to access specific DynamoDB tables.
Assistant
The correct answer is:
Create an IAM policy with DynamoDB read and write operations to access specific DynamoDB tables. Add the policy to the function execution role.
Explanation:
When designing secure access for a Lambda function to interact with DynamoDB, granting the minimum privileges required for the functionality is the best practice. The IAM execution role associated with the Lambda function is used to determine what resources the function can access during its execution.
Why This is the Best Option:
Principle of Least Privilege:
By granting access to specific DynamoDB tables, you reduce the scope of permissions, ensuring that the Lambda function can only access the exact resources it needs. This minimizes potential security risks in case the Lambda function is compromised.
IAM Policy for Function Execution Role:
The IAM execution role is specifically meant to define the permissions the Lambda function has when it runs. Associating the policy with the execution role enables the Lambda function to securely interact with DynamoDB.
Secure and Scalable:
IAM policies combined with the execution role follow AWS's security best practices and scale as needed for the Lambda function.
Resource-based policies, while useful for granting cross-account and finer-grained access, are not typically used for cases like Lambda accessing DynamoDB within the same account.
Why Not the Other Options?
"Create a function resource-based policy with DynamoDB read and write operations to access all DynamoDB tables."
A resource-based policy is not the right tool to grant a Lambda function permissions to access resources in DynamoDB. Resource-based policies are primarily used to control access to the Lambda function from external entities (e.g., from other accounts, users, APIs).
Allowing access to all DynamoDB tables violates the principle of least privilege, leaving your tables unnecessarily exposed.
"Create an IAM policy with DynamoDB read and write operations to access all DynamoDB tables. Add the policy to the function execution role."
While this solution works from a technical perspective, granting access to all DynamoDB tables introduces unnecessary security risks. If the Lambda function is compromised, an attacker could gain unintended access to unrelated resources.
User
Single choice
31)
Your company is planning a migration journey to AWS cloud. As a solution architect you worked on the plan and suggested to migrate some of the processes as a lift and shift to Amazon Elastic Cloud Compute (EC2) instances, then create lightweight scheduled jobs to AWS Lambda. Finally, experiment with AWS serverless technologies to plan for migrating API workloads in the future.
Which migration pattern describes this migration plan?
Organic
Leapfrog
Repurchasing
Strangler
Assistant
The correct answer is:
Organic
Explanation:
The described migration plan involves a step-by-step, gradual adoption of AWS services starting with a lift-and-shift approach on Amazon EC2, followed by transitioning certain lightweight jobs to AWS Lambda, and then experimenting with serverless services for API workloads in the future. This gradual and incremental method best aligns with the Organic migration pattern.
Key Characteristics of the Organic Migration Pattern:
Gradual Transformation:
The Organic pattern focuses on a gradual and iterative migration process. It starts by moving workloads in their current state to the cloud, allowing for future optimizations and modernization.
This aligns with the plan of lifting and shifting processes to Amazon EC2 instances while gradually adopting AWS Lambda.
Focus on Familiarity First:
Starting with a lift-and-shift approach (EC2) allows the company to maintain existing processes, minimizing disruption during the initial phases of the migration.
Incremental Refactoring:
After the initial lift-and-shift, the company incorporates less disruptive modernization steps, such as moving scheduled jobs to AWS Lambda and experimenting with future serverless solutions for APIs.
Why Not the Other Options?
Leapfrog:
The Leapfrog pattern involves rebuilding or replacing applications entirely with a modern, cloud-native architecture, skipping incremental steps like lift-and-shift.
This plan is not focused on replacing the entire system at once or adopting a wholly modern architecture immediately.
Repurchasing:
Repurchasing refers to replacing existing systems with commercial off-the-shelf software or adopting SaaS solutions instead of migrating an application as-is.
The plan refers to re-architecting workloads with Lambda and serverless APIs, not buying replacements.
Strangler:
The Strangler pattern involves incrementally replacing pieces of a monolithic application with new components, typically by routing traffic to modernized implementations while keeping the rest of the system intact.
User
Single choice
32)
You are maintaining a Lambda function that has a published version 1, as well as an alias named "LIVE". All requests are configured to route to the alias. The alias currently points to version 1. You updated the function code and want to send a portion of requests to the updated function.
What is the MOST operationally efficient way to achieve this?
Add the function version $LATEST to a routing configuration on the alias.
Create a second alias and configure a routing configuration on version 1.
Publish function version 2 and configure a routing configuration on the alias.
Publish function version 2 and use API Gateway to create a routing configuration for the two versions.
Assistant
The correct answer is:
Publish function version 2 and configure a routing configuration on the alias.
Explanation:
In AWS Lambda, aliases are used to manage traffic between specific versions of a Lambda function. To route traffic to multiple function versions (e.g., during testing or canary deployments), you can configure routing rules on an alias and assign a percentage of traffic to each version.
Steps to Achieve This Efficiently:
Publish Function Version 2:
After updating the code, you need to create a new version (e.g., version 2). A specific version is immutable and represents the updated code and configuration.
Configure Traffic Splitting on the Alias (LIVE):
Configure the existing alias LIVE to route incoming requests between version 1 and version 2 using a weighted traffic distribution.
For example:
Route 90% of traffic to version 1.
Route 10% of traffic to version 2.
This allows you to test the updated version gradually without fully replacing the original version, minimizing risks.
Example CLI command to update the alias with traffic routing:
Here, "2": 0.1 means 10% of the traffic is routed to version 2.
Why Not the Other Options?
"Add the function version $LATEST to a routing configuration on the alias."
Using $LATEST in a production routing configuration is not recommended because $LATEST reflects the most recent unpublished changes, which might be unstable or untested.
Routing traffic directly to $LATEST introduces unnecessary risk and operational complexity.
"Create a second alias and configure a routing configuration on version 1."
Creating a second alias for traffic splitting is unnecessary. Traffic splitting can be done directly on the , which already serves production requests.
User
Single choice
33)
A developer has just started using AWS Lambda to write an application and wants to ensure the code is well tested.
What design best practice can help with testing Lambda function code?
Separate business logic from Lambda-specific code
Avoid using recursive code within the Lambda functions.
Minimize dependencies and packages used by the Lambda functions.
Take advantage of execution environment reuse.
Assistant
The correct answer is:
Separate business logic from Lambda-specific code
Explanation:
When testing AWS Lambda code, it is crucial to separate the business logic from Lambda-specific code. This approach allows for isolated and modular testing of the application logic, independent of the Lambda runtime. Testing becomes simpler, more efficient, and reusable across different environments (e.g., locally or in CI/CD pipelines).
Benefits of Separating Business Logic:
Independent Testing:
Business logic, such as processing requests, performing calculations, or interacting with external APIs or databases, can be unit-tested without needing to invoke Lambda-specific features like event or context objects.
This isolates the application logic and avoids unnecessary dependencies during testing.
Improved Code Reusability:
By isolating the business logic, the same logic can be reused in other applications or services without being tied to Lambda-specific constructs.
Simplified Debugging:
Debugging becomes easier since tests are focused specifically on the core logic, and issues can be pinpointed more efficiently during the development or testing phases.
Mocking Lambda Contexts:
When the business logic is separate, mocks can easily simulate Lambda-specific inputs (e.g., event payloads or context values) in test cases.
Example of Best Practice:
Separate the Lambda handler from the core business logic:
python
# Business Logic
def process_data(input_data):
# Actual logic to process the input data
return {"result": len(input_data)}
# Lambda Handler
def lambda_handler(event, context):
input_data = event.get("data", [])
return process_data(input_data)
You can write unit tests to test process_data instead of the whole Lambda function.
Why Not the Other Options?
Avoid using recursive code within the Lambda functions.
User
Single choice
34)
A food and grocery delivery company is building a mobile application for their customers using AWS serverless services. As an architect you are asked to design the backend AWS solution architecture for the mobile app using event driven architecture. One of the features of the app is to provide real time updates to the user about the order delivery status.
What would be the efficient design for this feature to enable bi-directional communication between the API backend and the app?
Amazon API Gateway WebSockets
Publish Subscribe model using message queue
Webhooks with Amazon Simple Notification Service (Amazon SNS)
Client polling an AWS Lambda API
Assistant
The correct answer is:
Amazon API Gateway WebSockets
Explanation:
For real-time, bi-directional communication, where both the backend and the mobile app need to exchange messages and updates dynamically (e.g., real-time order delivery status), Amazon API Gateway WebSockets is the most efficient and scalable choice. WebSockets are specifically designed to enable persistent, two-way communication between the client and the server.
Why Amazon API Gateway WebSockets?
Supports Bi-Directional Communication:
WebSockets are ideal for maintaining a persistent connection between the backend and the mobile application, enabling real-time updates in both directions.
Event-Driven Architecture:
WebSockets integrate seamlessly with AWS Lambda, allowing you to trigger backend processing whenever there is a state change (e.g., order status update).
Real-Time User Experience:
Whenever the backend updates the order delivery status, API Gateway WebSockets can push real-time notifications to the connected clients (mobile apps), eliminating the need for client polling.
Cost and Scalability:
With API Gateway WebSockets, you pay only for the messages sent and received. It is highly scalable and eliminates the overhead of managing WebSocket infrastructure manually.
Efficient and Latency-Optimized:
Compared to polling or other mechanisms, WebSockets provide low-latency, live updating capabilities, making them ideal for scenarios like real-time updates.
Why Not the Other Options?
Publish-Subscribe Model Using Message Queue:
While the pub/sub model using a message queue works for asynchronous message broadcasting, it doesn’t provide bi-directional communication.
Solutions like Amazon SNS or Amazon SQS are excellent for fanout and notifications but are not efficient for building real-time interaction with mobile applications because they don’t maintain persistent connections.
Webhooks with Amazon Simple Notification Service (Amazon SNS):
User
Single choice
35)
A development team is tasked with updating their e-commerce website to handle the recent surge in online orders. The increases in orders is coming from new promotions that occur on ad-hoc basis. The current site is using synchronous REST APIs, which send requests to Lambda Functions and ultimately orders are stored in DynamoDB. During promotions, the APIs are timing out and losing orders, which is causing a lot of headaches for customers.
What pattern would be the most effective and easiest way to ensure all orders are eventually processed during these peak periods?
Swap the REST API for AppSync and refactor the API's to use GraphQL
Implement retry logic and exponential backoff when calling APIs
Increase the provisioned capacity of Lambda functions
Insert an Amazon Simple Queue Service (SQS) queue in front of your Lambda function, store orders in the queue and process them via your Lambda functions.
Assistant
The correct answer is:
Insert an Amazon Simple Queue Service (SQS) queue in front of your Lambda function, store orders in the queue and process them via your Lambda functions.
Explanation:
When encountering timeouts and order loss during peak traffic (e.g., promotions), the issue lies with the synchronous processing of orders. This can overwhelm the backend systems, leading to failures and lost data. To handle traffic spikes and ensure that all orders are processed eventually, the best solution is to implement asynchronous handling using Amazon SQS.
By introducing Amazon SQS between the REST APIs and the backend Lambda functions, you can decouple the message receiving process from the message processing logic, ensuring scalability and durability during high-traffic periods.
Benefits of Using Amazon SQS in Front of Lambda:
Asynchronous Processing:
Orders are placed into the SQS queue as soon as they are received and acknowledged back to the customer. This ensures customers don't face timeouts during peak traffic.
Durable Message Storage:
Messages in the SQS queue (orders in this case) are durable, ensuring no orders are lost during traffic surges.
Automatic Lambda Scaling:
AWS Lambda is natively integrated with Amazon SQS and can scale automatically to process messages from the queue in batches. This enables your backend to handle large volumes of orders efficiently.
Decoupling the System:
By decoupling the message ingestion (orders from REST APIs) from processing (Lambda + DynamoDB), failures or slowdowns in your backend don't affect the customer's experience.
Smooth Traffic Handling:
Even if the backend cannot keep up with processing immediately during a promotion, SQS will buffer the excess orders until they are processed, ensuring eventual consistency.
Why Not the Other Options?
"Swap the REST API for AppSync and refactor the API's to use GraphQL":
While AppSync (GraphQL) is a great tool for flexible APIs, switching from REST to GraphQL does not solve the underlying problem of traffic spikes and synchronous processing.
User
Single choice
36)
You are a tech lead for a team responsible for launching a new location services API for a contact management system, the location data is stored in a relational database running on Amazon RDS.
Your security team requires that credentials used to connect to databases must be encrypted at rest and rotated automatically every 90 days. All the activities associated with secrets rotation must be logged.
Which AWS service would allow you to implement this requirement with the least amount of overhead?
AWS Secrets Manager is the ideal service for securely managing and automatically rotating database credentials. It allows you to meet the security requirements of encryption, automatic rotation, and logging with minimal overhead.
Key Features of AWS Secrets Manager for This Use Case:
Automatic Secrets Rotation:
AWS Secrets Manager has built-in support for automatically rotating secrets for Amazon RDS databases. You can configure rotation to occur every 90 days (or another specified schedule).
The rotation process can update the database credentials securely and transparently with no interruptions to your application.
Encryption at Rest:
Secrets stored in AWS Secrets Manager are encrypted at rest using AWS Key Management Service (KMS). This ensures compliance with the requirement that credentials must be encrypted.
Activity Logging:
AWS Secrets Manager integrates with AWS CloudTrail, enabling you to log all activities related to secret creation, access, and rotation. This fulfills the requirement for tracking all actions associated with secrets rotation.
Minimal Overhead:
Secrets Manager handles all the complexity of securely managing, storing, and rotating credentials for your database, which significantly reduces implementation and management overhead for your development and operations teams.
Why Not the Other Options?
AWS Lambda Environment Variables:
While you could store credentials as Lambda environment variables, this approach:
Does not natively rotate credentials.
Exposes a security risk since environment variables could potentially be accessed by unauthorized users.
Does not meet the requirement for encryption and rotation.
AWS Systems Manager Parameter Store:
Parameter Store supports storing and securing sensitive configuration data, including database credentials.
However, Parameter Store does not natively support automated secrets rotation. You would need to build custom mechanisms, such as using AWS Lambda, to rotate credentials on your own, which increases overhead.
User
Single choice
37)
Company X has been operating a serverless application - using AWS Lambda, Amazon DynamoDB, Amazon API Gateway, and Amazon SQS - issue free for over 12 months. Two weeks ago, the customer service team started receiving increased reports of performance issues from end users during peak hours. Company X asked you to help troubleshoot the performance issues and identify any bottlenecks in the request paths. Which debugging and troubleshooting approach is the easiest way to help you locate bottlenecks in the application flow?
Review the Duration, Throttles, and Errors Lambda function metrics in Amazon CloudWatch to identify troublesome Lambda functions.
Use AWS X-Ray to trace requests and investigate latency between service interactions
Analyze dead-letter queues for errors and unhandled events.
Add debugging log statements to Lambda function code. Review function execution outputs in CloudWatch Logs to identify potential problems.
Assistant
The correct answer is:
Use AWS X-Ray to trace requests and investigate latency between service interactions
Explanation:
When debugging performance issues in a serverless application that includes multiple AWS services (e.g., AWS Lambda, API Gateway, DynamoDB, SQS), the primary challenge is identifying bottlenecks in the entire request flow. AWS X-Ray is the ideal tool for this use case as it provides end-to-end tracing, allowing you to visualize and analyze latency, bottlenecks, and service dependencies in the application flow.
Benefits of Using AWS X-Ray:
Full Visibility into the System:
AWS X-Ray provides a visual map of the request path, showing how requests flow through the different components (API Gateway, Lambda, DynamoDB, and SQS).
It helps you quickly identify which service or interaction is causing the bottleneck (e.g., high latency in DynamoDB queries or queue processing delays).
Detailed Latency Breakdown:
AWS X-Ray breaks down each request into segments and subsegments, showing how long each service or operation takes. This allows you to pinpoint latency issues at any specific integration point.
Error Detection:
If there are errors or retries in the request path, X-Ray highlights them, making it easier to troubleshoot.
Scalable and Low Overhead:
X-Ray integrates seamlessly with AWS services like Lambda, API Gateway, and DynamoDB. Enabling X-Ray requires minimal changes to the application, and it incurs low operational overhead compared to other approaches.
Why Not the Other Options?
"Review the Duration, Throttles, and Errors Lambda function metrics in Amazon CloudWatch to identify troublesome Lambda functions."
CloudWatch metrics for Lambda functions provide useful information about Lambda-specific performance (e.g., execution duration, throttling, errors), but it only focuses on individual functions.
It does not provide visibility across the entire application flow, such as interactions with DynamoDB, API Gateway, or SQS, which is critical for diagnosing performance bottlenecks.
"Analyze dead-letter queues for errors and unhandled events."
User
Single choice
38)
A retailer is planning to migrate their eCommerce application from a monolithic application to serverless. They've done some experimentation with serverless by moving some of their cron jobs to AWS Lambda.
What should be their next step in planning their migration?
Start breaking the application into microservices.
Understand what the application does, what each component does, and how each component interacts.
Choose the right data store for different microservices.
Decouple the control plane’s transactional data requirements from the data plane’s query operations.
Assistant
The correct answer is:
Understand what the application does, what each component does, and how each component interacts.
Explanation:
Migrating a monolithic application to serverless is a complex and strategic process that requires a clear understanding of the current architecture, including its components, functionality, and interdependencies. Before breaking the application into microservices or choosing specific technologies, it is crucial to analyze and understand how the existing system works, what each component is responsible for, and how they interact.
This understanding provides the foundation for planning the migration, identifying natural boundaries for splitting the application into microservices, and ensuring the migration aligns with business requirements.
Why is This the Next Step?
Complete Application Analysis is Critical:
A comprehensive understanding of the application's functionality and interactions helps uncover dependencies, bottlenecks, and tightly coupled components that must be addressed during the migration.
It reveals which parts of the monolith can be easily decoupled initially and which components need additional planning or re-engineering.
Foundation for Breaking into Microservices:
Without understanding how components interact, it is almost impossible to determine natural service boundaries for microservices.
This step enables you to identify independent services that can be migrated incrementally while minimizing disruption.
Identify Priorities and Challenges:
It helps you assess which parts of the application will benefit most from serverless (e.g., high-scale or event-driven components).
This step also uncovers potential challenges, such as state management, data consistency, or performance issues, arising from the transition to serverless.
Minimize Risks During Migration:
Improper planning can lead to incomplete migrations, broken functionality, or inefficient serverless architectures. By thoroughly understanding the application upfront, you mitigate these risks.
Why Not the Other Options?
"Start breaking the application into microservices."
Breaking the application into microservices . Doing so without understanding the application risks creating poorly defined microservices with overlapping responsibilities, increasing complexity and potential failure points.
User
Single choice
39)
You are part of a team that is planning to migrate an application to serverless on AWS. The application uses workers that listen to a queue to run background processes. The queue is maintained in a RabbitMQ cluster, deployed on premises. The team thinks that this is an easy place to introduce an AWS serverless service to maintain the queue. Their priority is to move to a serverless over lift and shift approach.
Which of the following services can be used to create a queue, without provisioning any servers?
Amazon EventBridge
Amazon Simple Notification Service (SNS)
Amazon Simple Queue Service (SQS)
Amazon Managed Queue (MQ)
Assistant
The correct answer is:
Amazon Simple Queue Service (SQS)
Explanation:
For a serverless approach to managing messages in a queue, Amazon Simple Queue Service (SQS) is the best choice. It’s a serverless, fully managed message queueing service, and requires no server provisioning or maintenance.
Why Choose Amazon SQS?
Serverless:
Amazon SQS is a completely serverless solution, which aligns with the requirement of moving to serverless instead of a lift-and-shift approach.
No Provisioning:
SQS does not require managing or provisioning servers for the queue, allowing the team to focus entirely on application logic rather than infrastructure management.
Designed for Background Processes:
SQS is tailor-made for decoupling services and supporting background processing, where workers (such as AWS Lambda functions) consume messages from the queue and process them.
High Scalability:
SQS supports unlimited throughput and scales automatically with workload, making it ideal for handling large volumes of messages like those used in background jobs.
Two Types of Queues:
Standard Queue: Offers high throughput with at-least-once delivery.
FIFO Queue: Guarantees message order and prevents duplication, which is useful for scenarios requiring strict ordering.
Native Integration:
SQS integrates seamlessly with AWS Lambda, Amazon EventBridge, and other AWS services to support an event-driven architecture.
Why Not the Other Options?
Amazon EventBridge:
EventBridge is an event bus rather than a message queue. While it can handle events and route them to specific targets, it does not support queue-specific patterns like message retention, visibility timeout, or parallel message workers.
EventBridge is designed for event-driven routing, not queuing background tasks.
Amazon Simple Notification Service (SNS):
User
Single choice
40)
A travel company is developing a new search engine that queries multiple airlines, hotels, and car rental services at one time. The company received feedback on their prototype that the search often resulted in timeout errors and that users could not tell if a search was still in progress. Using Amazon CloudWatch and AWS X-Ray, a developer found that while the Lambda function aggregating the search results was still running, the Amazon API Gateway REST API timed out after 30 seconds.
Which changes could the company make to their design to (1) alleviate the timeout errors and (2) provide users with ongoing status of their search?
Send the query to travel providers using SNS. Use Amazon EMR to perform a map-reduce to finalize the result.
Replace the REST API with a WebSocket API. Push the search updates to the client via the WebSocket.
Update the client to poll the REST API every 5 seconds to check for updates.
Register the client with an SNS Topic and publish updates to the topic.
Assistant
The correct answer is:
Replace the REST API with a WebSocket API. Push the search updates to the client via the WebSocket.
Explanation:
The issue with the current design is that the REST API times out after 30 seconds, which is the default limit for an Amazon API Gateway REST API integration. The Lambda function aggregating search results takes longer due to querying multiple external providers, leading to timeout errors and a poor user experience. To (1) alleviate timeout errors and (2) provide users with ongoing real-time status updates, WebSocket APIs are the optimal solution.
Why Use WebSocket APIs
No Timeout Limits:
Amazon API Gateway WebSocket APIs maintain a persistent connection between the client and the server, avoiding the 30-second timeout limitation of REST APIs.
The backend can send updates to the client as they become available, even for long-running processes.
Real-Time Updates:
WebSocket APIs allow the server (Lambda or any other service) to push updates to clients in real time as search results are processed, providing users with status updates (e.g., "Searching for flights...", "Hotels found...").
Efficient Communication:
Since WebSockets maintain a single persistent connection, they are more efficient than polling and avoid unnecessary HTTP requests.
This results in a better user experience and a reduction in network traffic.
Better UX:
Users will no longer experience timeouts, and they will see live updates of the search progress, which improves transparency and engagement.
Why Not the Other Options?
"Send the query to travel providers using SNS. Use Amazon EMR to perform a map-reduce to finalize the result."
SNS is a publish/subscribe messaging system—not designed for handling or managing long-running client requests or providing status updates.
EMR (Elastic MapReduce) is typically used for large-scale, batch-style data processing (e.g., big data analytics), not for real-time search aggregation. Both options would significantly complicate the architecture and are not suitable for this use case.
User
Multiple choice
41)
Your company has a serverless application with Amazon API Gateway and AWS Lambda having both read, as well as, write APIs. The developers make frequent changes to the Lambda code and run load tests on the application after every change. The regular load testing has resulted in a spike in the cost.
What are the best practices and cost savings options available on their Lambda compute usage? (Select TWO)
User reserve concurrency for the lambda functions and set the concurrency to a lower value.Use caching on Amazon API Gateway.Changing Lambda code does not necessarily require load testing. Unit and integration tests are sufficient. Use compute savings plan for lambda (discounted Savings Plans rates of up to 17% for a 1 or 3 year term, up to the commitment level.) Use Amazon EC2 instead of lambda.
Assistant
The correct answers are:
1. Use caching on Amazon API Gateway. 2. Use compute savings plan for Lambda (discounted Savings Plans rates of up to 17% for a 1 or 3 year term, up to the commitment level.)
Explanation:
To manage the cost spikes caused by frequent load testing while continuing to use AWS Lambda for serverless compute, the goal is to reduce operational overuse and optimize execution costs for both read and write APIs without compromising test quality. Below are detailed justifications for the selected options:
1. Use caching on Amazon API Gateway
Why It Helps:
API Gateway caching stores responses for read requests for a specified time-to-live (TTL), significantly reducing the number of incoming requests that need to invoke the Lambda function during read-heavy tests.
Leveraging caching reduces backend processing and associated Lambda invocation costs, especially for idempotent read requests during repetitive load tests.
Implementation:
You can enable caching for specific API Gateway routes (e.g., read APIs only) to avoid triggering the Lambda unnecessarily while ensuring fresh responses for write APIs.
2. Use compute savings plan for Lambda (discounted rates)
Why It Helps:
Compute Savings Plans provide discounted rates of up to 17% for AWS Lambda when you commit to a certain amount of compute usage over a period (e.g., 1 or 3 years).
Ideal for frequently used serverless applications like this scenario, where load testing will consistently invoke high compute usage.
Implementation:
Developers need to assess the Lambda compute usage trend (e.g., average GB-seconds consumed monthly) and commit to a savings plan matching expected usage.
This approach reduces costs while still allowing for frequent testing and changes.
Why the Other Options are Incorrect:
"Use reserved concurrency for the Lambda functions and set the concurrency to a lower value."
Reserved concurrency limits the number of concurrent executions for a Lambda function but does not reduce the frequency of invocations or directly lower costs.
User
Multiple choice
42)
What are the primary benefits and features of using AWS Serverless services? (Select THREE)
Serverless applications are difficult to scaleNo server provisioningHigh costReduced time to marketHigh availabilityPay for idle compute capacity
Assistant
The correct answers are:
1. No server provisioning 2. Reduced time to market 3. High availability
Explanation:
AWS Serverless services (e.g., AWS Lambda, Amazon API Gateway, Amazon DynamoDB, and others) are specifically designed to abstract away infrastructure management, enabling developers to build and deploy applications faster and more efficiently. Here are the primary benefits and features of serverless services:
1. No server provisioning
Why It's a Benefit:
Serverless services eliminate the need to provision, manage, and scale servers (physical or virtual).
AWS takes care of scaling up/down based on demand, allowing developers to focus solely on application logic and functionality.
Example: With AWS Lambda, you only need to upload code, and AWS handles everything from runtime to scaling.
2. Reduced time to market
Why It's a Benefit:
Serverless significantly reduces development and deployment time by abstracting infrastructure details and automating scalability, availability, and operational tasks.
Developers can focus purely on building business logic without worrying about server management, patching, or scaling infrastructure.
Ideal for startups or businesses looking for rapid innovation and agility.
3. High availability
Why It's a Benefit:
AWS Serverless services are built to be highly available and fault-tolerant by default. AWS automatically handles availability zones and implements redundant infrastructure to reduce downtime.
Services such as AWS Lambda, Amazon API Gateway, and DynamoDB are designed with built-in high availability and scalability.
This ensures that applications can handle traffic spikes or failover seamlessly.
Why Not the Other Options?
"Serverless applications are difficult to scale" (Incorrect):
One of the primary features of serverless services is automatic scalability.
AWS services such as Lambda and DynamoDB scale automatically with incoming traffic, enabling applications to seamlessly handle spikes and drops without requiring manual intervention.
User
Single choice
43)
You are responsible for building an e-commerce site. In your development process you create a MVP (Minimum Viable Product) and deploy it in a TEST environment. Your architecture is made of an Amazon API Gateway that calls a Lambda function and an Amazon DynamoDB table. A member of the QA team reported that during testing a synchronous call broke the system causing a timeout error.
What should you do to fix the error?
Increase the timeout limit in the API Gateway. If the invocation request returns invocation errors, Lambda retries that request two more times by default. You can configure this retry value between 0 and 2.
Increase the timeout limit in the API Gateway. If the invocation request returns invocation errors, Lambda retries that invocation for up to 6 hours. You can decrease the default duration using the maximum age of event setting.
Do nothing. In a synchronous invocation, like between API Gateway and Lambda, Lambda provides built-in retry behaviors.
Generate the SDK from the API stage, and use the backoff and retry mechanisms it provides.
Assistant
The correct answer is:
Increase the timeout limit in the API Gateway. If the invocation request returns invocation errors, Lambda retries that request two more times by default. You can configure this retry value between 0 and 2.
Explanation:
The issue is caused by the timeout error in the synchronous call path, where Amazon API Gateway invokes an AWS Lambda function. A timeout means that the API Gateway has exceeded the maximum time it can wait for a response from the Lambda function. To resolve this:
Synchronous Invocation Behavior:
In this scenario, API Gateway synchronously invokes the Lambda function.
By default, API Gateway has a maximum timeout of 29 seconds for its REST APIs. If the Lambda function doesn't return a response within this timeframe, API Gateway times out and returns an error to the client.
Configure API Gateway Timeout:
One way to fix this issue is to increase the timeout limit in API Gateway (up to its 29-second maximum). This gives the Lambda function more time to complete its execution and return a successful response.
Additionally, Lambda itself retries synchronous requests two more times by default, but only in case of invocation errors, not for timeouts.
Refactoring (if necessary):
If the Lambda function regularly exceeds the timeout limit, you may need to optimize the function's logic or offload long-running processes to an asynchronous processing model (not part of this question but an important consideration for future-proofing).
Detailed Review of the Other Options:
"Increase the timeout limit in the API Gateway. If the invocation request returns invocation errors, Lambda retries that invocation for up to 6 hours. You can decrease the default duration using the maximum age of event setting."
Incorrect because the 6-hour maximum retry window applies only to asynchronous invocations, not synchronous ones like the interaction between API Gateway and Lambda.
API Gateway's timeout is limited to 29 seconds, and synchronous invocations do not have a 6-hour retry period.
"Do nothing. In a synchronous invocation, like between API Gateway and Lambda, Lambda provides built-in retry behaviors."
User
Multiple choice
44)
An application that is processing customer requests has to also distribute the message to a number of downstream applications.
What AWS services can the application use to distribute the request messages to the downstream applications? (Select TWO)
Amazon AppFlowAmazon Aurora Database Activity StreamsAmazon EventBridge Amazon Simple Queue ServiceAmazon Simple Notification Service
Assistant
The correct answers are:
1. Amazon EventBridge 2. Amazon Simple Notification Service (SNS)
Explanation:
When you need to distribute messages to multiple downstream applications from a central source, AWS provides services like Amazon EventBridge (event-driven architecture) and Amazon Simple Notification Service (SNS) (pub/sub model). Both services allow you to distribute messages effectively and at scale.
1. Amazon EventBridge
Use Case: EventBridge is a fully managed event bus that enables decoupling of applications. It can distribute events to multiple downstream targets in real time.
Key Features:
Supports event filtering and transformation, allowing messages to be routed conditionally to the desired downstream application(s).
Integrates natively with over 200 AWS services (e.g., Lambda, SQS) and many third-party SaaS applications.
Ideal for event-driven architectures where applications react to real-time events.
2. Amazon Simple Notification Service (SNS)
Use Case: SNS is a publish/subscribe messaging service that allows publishing messages to multiple subscribers, including Lambda functions, SQS queues, HTTP endpoints, email, and SMS.
Key Features:
Supports fan-out messaging, which allows you to distribute a single message to multiple subscribers.
Works well for real-time notifications or broadcast-style communication between systems.
SNS can act as a hub, pushing messages to downstream applications via endpoints.
Why Not the Other Options?
"Amazon AppFlow":
Amazon AppFlow is used for data transfer between applications (e.g., from Salesforce to Amazon S3 or Redshift). It is not designed for message distribution or event routing.
"Amazon Aurora Database Activity Streams":
Aurora Database Activity Streams provide a real-time data stream from the database for auditing or monitoring purposes. It is unsuitable for distributing request messages among downstream applications.
User
Single choice
45)
You are working as a Solutions Architect for an e-commerce company. You have been tasked to review their order processing application. The application handles multiple steps for each order and it has become difficult to operate. Additionally the developers are struggling to add new features. Your review uncovers that business logic is mixed with logic around state tracking and complex error handling.
How would you rearchitect the application in order to separate the business logic from state and error handling?
Extract the business logic into several Lambda functions. Create an API Gateway with the corresponding routes for each function. Modify the applications clients to call the new API Gateway endpoint.
Create Lambda functions to implement the business logic. Use Amazon EventBridge to coordinate your functions and handle errors.
Create an AWS Step Function to model the order process and extract the business logic into Lambda functions.
Create Lambda functions for the business logic and use Amazon SQS FIFO queues to connect them asynchronously.
Assistant
The correct answer is:
Create an AWS Step Function to model the order process and extract the business logic into Lambda functions.
Explanation:
The issue in the current order processing application is that business logic is tightly coupled with state tracking and error handling, making the system difficult to manage and extend. To address this, you need to extract the business logic and use a service that can:
Decouple the workflow orchestration (state tracking, retries, error handling) from the actual business logic.
Provide visibility into the workflow execution and make the system easier to operate and monitor.
AWS Step Functions is the best choice for this use case because it allows you to define a state machine/workflow for the order process, separating state management and error handling from the actual business logic implemented in AWS Lambda.
Why Choose Step Functions?
Orchestration of Workflows:
AWS Step Functions can represent an entire multiservice order-processing workflow using a state machine.
The business logic is handled by Lambda functions, while Step Functions handles workflow state transitions, retries, timeouts, error handling, and branching.
Error Handling:
Step Functions provides built-in mechanisms for retry policies and error catching, simplifying the error handling logic that developers were previously managing alongside business logic.
Separation of Concerns:
Business logic is coded in Lambda functions, while Step Functions handles state tracking, coordination, and orchestration. This clean separation improves maintainability and allows developers to focus on improving business logic.
Extensibility:
With Step Functions, adding new steps (e.g., additional order processing steps) is simple and doesn't interrupt the existing logic. The process flow is easily updated in the Step Functions state machine definition.
Monitoring and Debugging:
User
Multiple choice
46)
You are creating AWS Lambda functions to handle events from an online ordering system.
What are some best practices you should follow when writing Lambda functions? (Select TWO)
Store state information within your function, but outside the function handler.Limit the use of function dependencies to only what is required.Split complex business logic into separate modular functions outside of the function handler.Store complex business logic within the function handler.Store database credentials directly in variables in the function.
Assistant
The correct answers are:
1. Limit the use of function dependencies to only what is required. 2. Split complex business logic into separate modular functions outside of the function handler.
Explanation:
AWS Lambda functions are designed to be lightweight, efficient, and modular. Following best practices ensures that your function performs optimally, is easier to maintain, and remains secure.
1. Limit the use of function dependencies to only what is required
Why It's Best Practice:
Reducing unnecessary dependencies minimizes the package size of your Lambda function.
Smaller packages result in faster cold starts, as less time is needed to initialize dependencies.
Minimal dependencies reduce potential security vulnerabilities from unused libraries.
Best Practice:
Include only those external libraries or packages that are absolutely necessary for the function to work.
2. Split complex business logic into separate modular functions outside of the function handler
Why It's Best Practice:
Separating the business logic into modular functions outside of the Lambda handler makes the code easier to test, debug, and maintain.
The Lambda handler should primarily:
Parse the event input.
Route the event to the appropriate business logic.
Handle responses and errors.
Example:
python
def process_order(order_data):
# The core business logic
return {"status": "success", "order_id": order_data["id"]}
def lambda_handler(event, context):
# Parse the input
order_data = event.get("order")
return process_order(order_data) # Call the split business logic
By keeping the core logic outside the handler, you can test and reuse the logic independently of AWS Lambda.
Why Not the Other Options?
User
Multiple choice
47)
A Solutions Architect is working with a company to migrate an existing application to AWS Lambda. A key requirement for the application is high throughput and low latency. The company is concerned about the potential impact of Lambda cold starts.
Which of the following Lambda design best practices can help to reduce cold start durations? (Select TWO)
Write modular functions that have a singular purpose.Separate business logic from Lambda-specific handler code.Avoid using recursive code in the Lambda functions.Use environment variables for operational parameters.Include only the dependencies and modules needed by the function.
Assistant
The correct answers are:
1. Include only the dependencies and modules needed by the function. 2. Use environment variables for operational parameters.
Explanation:
To reduce cold start durations in AWS Lambda, it's important to design functions that minimize initialization time and improve efficiency during startup. AWS Lambda functions experience cold starts when they are invoked for the first time or after a period of inactivity, as the execution environment and code need to be initialized. Adopting best practices can help optimize this process.
1. Include only the dependencies and modules needed by the function
Why It Helps:
The size of your Lambda deployment package directly impacts cold start duration because larger packages take longer to load and initialize.
By removing unnecessary dependencies, you reduce the function's size and initialization overhead, leading to faster cold start times.
Best Practice:
Keep your deployment package as lightweight as possible.
Use the AWS Lambda container image feature if you require a lot of dependencies, but still strive to minimize package bloat.
2. Use environment variables for operational parameters
Why It Helps:
Lambda functions can quickly access configuration values provided as environment variables during initialization instead of loading them dynamically from external systems or files, which reduces initialization time.
Avoids overhead caused by retrieving these parameters at runtime.
Environment variables are also preloaded into the execution environment, making them optimally accessible during Lambda startup.
Best Practice:
Use environment variables to store configuration or operational parameters (e.g., database connection strings, API keys).
Encrypt sensitive data with AWS KMS to ensure security.
Why Not the Other Options?
"Write modular functions that have a singular purpose":
Incorrect:
While writing modular functions adheres to good coding practices, it does not directly reduce cold start times.
User
Single choice
48)
You are a cloud architect working on modernizing an application for a customer. You decide to use managed services from AWS as a part of the application design.
How would you explain managed services from AWS to your customer?
A service managed by the operations team in your company.
A service managed by an AWS Partner.
A service managed and supported by the open source community.
A service managed by AWS.
Assistant
The correct answer is:
A service managed by AWS.
Explanation:
AWS managed services refer to fully managed infrastructure and platforms provided and operated by AWS for customers. These services allow customers to focus more on their applications, business logic, and goals, while AWS takes care of the operational overhead such as scaling, maintenance, updates, high availability, and security.
Key Features of AWS Managed Services:
Managed by AWS:
AWS takes care of provisioning, managing, and maintaining the underlying infrastructure or service, so customers don’t need to.
Examples include services like Amazon RDS, AWS Lambda, Amazon S3, Amazon DynamoDB, and Amazon API Gateway.
Reduced Operational Burden:
AWS handles administrative tasks such as scaling, patching, monitoring, and backups, allowing customers to focus on their solutions rather than infrastructure.
High Availability and Scalability:
Managed services are designed to scale automatically and provide high availability out of the box.
"A service managed by the operations team in your company":
Incorrect. This describes a traditional self-managed or on-premise service setup, not a managed service from AWS.
"A service managed by an AWS Partner":
Incorrect. AWS Partners may provide specialized services, but AWS managed services are directly managed by AWS itself.
"A service managed and supported by the open source community":
Incorrect. While some AWS services (e.g., Amazon RDS for PostgreSQL) may use open-source technologies, the services are managed by AWS, not the open-source community.
Final Explanation:
Managed services from AWS provide a way to offload the operational burden of managing and maintaining infrastructure while ensuring reliability, scalability, and performance. This allows businesses to focus more on innovation rather than infrastructure management.
Correct Answer: A service managed by AWS.
User
Single choice
49)
Your company uses an AWS Lambda function as part of an application that has a consistent but low volume of traffic. The function requires low latency and predictable start-up times.
What change to the AWS Lambda function would meet the requirement in the MOST operationally efficient way?
Configure Provisioned Concurrency
Mount an Amazon Elastic File System (EFS)
Use an AWS Lambda layer
Configure Reserved Concurrency
Assistant
The correct answer is:
Configure Provisioned Concurrency
Explanation:
To meet the requirement of low latency and predictable startup times, using Provisioned Concurrency for your AWS Lambda function is the best and most operationally efficient solution. Provisioned Concurrency ensures that the Lambda function is pre-initialized and ready to handle incoming traffic, eliminating cold starts that contribute to latency variability.
Why Use Provisioned Concurrency?
Eliminates Cold Starts:
Lambda provisioning ensures that the required number of execution environments are initialized in advance and remain pre-warmed to handle requests.
This reduces the startup latency caused by cold starts, providing low-latency and predictable response times even during periods of low traffic.
Consistent Performance:
By assigning a specific concurrency level to the function, you guarantee that a set number of function execution environments are always available to process requests immediately.
Optimized for Consistent but Low Volume Traffic:
Provisioned Concurrency is suitable for workloads that require predictable performance while handling a relatively low and predictable volume of traffic.
Operational Efficiency:
While minimizing latency, Provisioned Concurrency also simplifies operational management by ensuring consistent performance metrics without requiring complex tweaks or architecture changes.
Why Not the Other Options?
"Mount an Amazon Elastic File System (EFS)":
Mounting EFS to a Lambda function provides persistent file storage but does not address low latency or cold starts.
EFS integration has no effect on Lambda initialization time or startup predictability, making it irrelevant to the requirements here.
"Use an AWS Lambda layer":
Lambda Layers are used to package external dependencies or shared libraries for Lambda functions.
While layers reduce the size of deployment packages, they do not address cold starts or latency issues directly.
User
Single choice
50)
You are developing a Lambda function that gets requests from an API Gateway and handles updates of user profiles. These profiles include application preferences like notification options, user photo, user alias and more. The profile information is stored on an MS SQL RDS database on your VPC except for the photos which are stored in S3. The VPC has an Internet Gateway and a NAT Gateway.
How can you configure your Lambda function to access S3 and the RDS database privately?
Create a service control policy that routes traffic from the Lambda service to the S3 services. Add a resource policy to allow write access.
Create a Lambda Execution Role that allows write permissions to the S3 bucket. Create a VPC Endpoint for S3.
Use a Lambda Resource Policy that allows write permissions to the S3 bucket. Create a VPC Endpoint for S3. Start the Lambda function on a private subnet and use the VPC Endpoint to access S3 privately.
Create a new NAT Gateway and Internet Gateway. Configure route table. Create an execution role that allows the Lambda function to write to the bucket.
Assistant
The correct answer is:
Use a Lambda Resource Policy that allows write permissions to the S3 bucket. Create a VPC Endpoint for S3. Start the Lambda function on a private subnet and use the VPC Endpoint to access S3 privately.
Explanation:
The Lambda function in this scenario needs to access:
The RDS database, which is located in a private subnet within the VPC.
The S3 bucket, which by default is publicly accessible over the internet unless accessed privately via a VPC Endpoint.
To securely and privately access both S3 and the RDS database, the following steps are necessary:
Key Steps for Configuration:
Use a Lambda Resource Policy to Allow S3 Access:
The Lambda execution role must include policies allowing write access to the S3 bucket. The policy enables the function to interact with S3 for uploading or retrieving user photos.
Create a VPC Endpoint for S3:
When your Lambda function is configured to run in a private subnet within a VPC, it cannot access internet-based services (like S3) directly.
A VPC Endpoint for S3 provides private connectivity to Amazon S3 without sending traffic over the public internet via NAT Gateway or Internet Gateway.
This ensures that communication with Amazon S3 remains within AWS's private network, improving security and reducing costs.
Deploy Lambda in a Private Subnet:
Since the RDS database resides in a private subnet, the Lambda function must also be deployed in a private subnet within the same VPC.
This configuration ensures direct access to the RDS instance without requiring a NAT Gateway or public connectivity.
Access Existing Internet Services (If Needed):
If the Lambda function also needs access to internet services, a NAT Gateway can be added, but it's not necessary for accessing RDS (within the VPC) or S3 (via a VPC Endpoint).
Why Not the Other Options?
"Create a service control policy that routes traffic from the Lambda service to the S3 services. Add a resource policy to allow write access."
Service Control Policies (SCPs) are used in AWS Organizations to set global permissions across accounts and cannot be used to manage VPC routing or S3 access.
Dataset releases
Not yet included in a published release.
interface VPC endpoint (PrivateLink)
Final Answer:
The two correct options are:
Utilize VPC-enabled Lambda functions which can be invoked privately from resources in the VPC.
Create an interface VPC endpoint for the Lambda service.
"Use the active-connections command on the @connections API to periodically retrieve the total number of active connections and store this as a count in a DynamoDB table."
While it is possible to use the @connections API to manage WebSocket connections, there is no built-in “active-connections” command. Additionally, polling active connections periodically is inefficient for real-time systems and prone to inconsistencies.
"Use the $default route to trigger a Lambda function that increments an active user count in DynamoDB."
The $default route is invoked if no specific route matches a message from the client. It is not triggered during lifecycle events like connection establishment ($connect) or disconnection ($disconnect), and therefore it is unsuitable for tracking active users.
Final Recommendation:
To correctly implement a real-time active user counter:
Use $connect to trigger a Lambda function that increments the active user count in DynamoDB.
Use $disconnect to trigger a Lambda function that decrements the active user count in DynamoDB.
This approach ensures a reliable and real-time count of currently connected users on the chat platform.
To mitigate parameter tampering attacks, you should:
Use Amazon API Gateway models to define the expected schema and structure of incoming requests.
Enable a request validator to automatically ensure all requests comply with the defined models.
This approach ensures malicious or malformed requests are blocked before reaching your backend services, enhancing security.
Correct Answer: Configure an Amazon API Gateway model along with a request validator.
on-demand capacity
user wait time
Enable API caching and payload compression in Amazon API Gateway:
API caching and compression are methods to reduce repeated requests and optimize traffic size, but in this case, every feedback submission is likely a unique operation (not cacheable). This option does not solve the problem of peak load throttling or the synchronous interaction between Lambda and DynamoDB.
Recommendation:
Insert an Amazon SQS queue between API Gateway and the Lambda function.
Let players submit feedback quickly via API Gateway, which pushes the data into the queue.
Use Lambda to poll and asynchronously process the SQS messages and store them in DynamoDB.
This asynchronous decoupling solves the problem of high latency during peak periods by ensuring requests do not overwhelm the system and users do not experience wait time.
Correct Answer: Insert an Amazon Simple Queue Service queue between the API Gateway and Lambda function. Use Lambda's native SQS poller to read off the queue. Refactor the Lambda function to handle the new event object.
local development, IaC, packaging, or safe rollbacks
AWS CloudFormation:
While CloudFormation is used for Infrastructure as Code and managing the deployment of resources in a declarative manner, it does not provide tools for local testing of serverless applications or handling specific serverless integrations like AWS SAM does.
AWS CloudFormation is a backend tool on which AWS SAM is built; AWS SAM enhances CloudFormation for serverless use cases.
Why AWS SAM is Ideal for Your Scenario:
Local Development: Your team can simulate the full application stack (API Gateway, Lambda, DynamoDB) locally for faster testing and iteration.
Infrastructure as Code: Define the complete architecture for the flagship product.
Deployment Tools: Quickly package and deploy serverless applications using sam package and sam deploy.
Rollback Support: Easily revert to a previous version if a bad deployment occurs.
Final Answer:
AWS Serverless Application Model (SAM)
AWS Cloud9
AWS Cloud9 is an IDE (Integrated Development Environment) for development and collaboration. It allows you to write and debug code in the cloud but does not provide Infrastructure as Code, local testing, or deployment support.
AWS CloudFormation:
AWS CloudFormation provides powerful IaC capabilities but is a general-purpose tool.
It doesn't include specific features optimized for serverless applications, such as local testing or reduced syntax complexity (AWS SAM templates are more concise for serverless).
Final Recommendation:
AWS SAM is purpose-built for serverless applications and enables local development, testing, and deployments in a consistent and simplified way. It fully supports the use case of building and managing a serverless application involving API Gateway, Lambda, and DynamoDB.
Correct Answer: AWS Serverless Application Model (AWS SAM)
couples the application logic
It also increases costs if the application has high write throughput, as Lambda might be invoked unnecessarily multiple times.
"Create an Amazon EventBridge rule to schedule a Lambda function for scanning the table":
This approach involves periodically scanning the DynamoDB Table to check for changes. DynamoDB Scan operations are expensive and inefficient for large tables or frequent write operations.
The cost increases significantly as the table grows in size or if there are frequent updates, making this a poor choice for an event-driven mechanism.
"Use Amazon Kinesis Firehose to write to S3 with an S3 event trigger":
Using Amazon Kinesis Firehose and S3 introduces additional services and complexity.
Firehose is designed for data streaming and delivery to destinations (like S3 or Redshift), but it’s not suited for an observer mechanism for DynamoDB changes.
This option is more expensive, requires additional infrastructure, and is not natively integrated with DynamoDB.
Final Recommendation:
The native integration of DynamoDB Streams and Lambda provides the simplest, most cost-effective, and efficient solution for this use case. It directly handles asynchronous, real-time event processing with minimal operational overhead.
Correct Answer: Use Amazon DynamoDB Streams: as an item is written to the Amazon DynamoDB Table, a new stream record is written to reflect the item-level change that has happened to the table. This new stream record invokes a Lambda function, reading the data from the stream record, and publishes a message to an Amazon Simple Notification Service (SNS) Topic.
This is incorrect because API Gateway and AWS Lambda have service limits (e.g., concurrency for Lambda and request rate limits for API Gateway). Without proper tuning of these services and monitoring their usage, the infrastructure might fail during traffic spikes.
"Throttle Lambda functions by configuring reserved concurrency and sending excess traffic to DLQs":
While Reserved Concurrency ensures Lambda doesn't impact other functions' scaling, throttling excess traffic and sending it to a DLQ (Dead Letter Queue) isn't a solution for scaling. DLQs are used to handle failures, not manage traffic, and this doesn't directly address the scaling issue.
"Enable Auto Scaling Groups for AWS Lambda":
AWS Lambda does not use Auto Scaling Groups. Lambda automatically scales based on the number of incoming requests. This option is invalid.
Recommendation:
To ensure the serverless infrastructure scales properly, review and monitor service limits and quotas for both API Gateway and Lambda. Adjust limits as necessary to avoid bottlenecks while balancing costs and performance.
Correct Answer: Look at service limits for Amazon API Gateway and Lambda functions used in order to identify potential bottlenecks and balance performance requirements, costs, and business impact.
Use API Keys to rate limit incoming user requests:
While API Keys and rate limiting help protect your backend systems from traffic overload, this approach does not scale your application or reduce costs. Instead, rate limiting restricts traffic, which could lead to a poor user experience during peak demand periods (especially for an anticipated concert announcement).
Recommendation:
For cost-effective scaling, enabling API Gateway caching reduces backend workload significantly by handling repeat requests directly from the cache.
It minimizes Lambda invocations and RDS queries, which are the primary cost drivers for this architecture.
Correct Answer: Enable API Gateway caching to reduce backend invocations.
This approach does not scale well, as token validation is better handled once at the gateway level rather than inside every Lambda function.
"Create an Amazon Cognito Identity Pool and add your custom solutions as a federated identity provider."
Amazon Cognito Identity Pools allow users to authenticate to AWS resources with federated providers (e.g., SAML, social logins), but this requires integrating your IAM solution as a federated provider.
This also involves an additional migration effort and is not necessary since the IAM solution already works for token validation.
Final Recommendation:
Using an AWS Lambda authorizer to validate tokens with the existing IAM solution requires the least amount of work. It allows you to reuse the current IAM implementation to secure API Gateway requests without significant migration or architectural redesign.
Correct Answer: Use an AWS Lambda authorizer to validate tokens at the existing IAM solution. Connect the Lambda function that serves as your authorizer to a VPC to allow private connectivity to the existing IAM solution.
"Deploy the microservice as a container-based app on Amazon Elastic Container Service (ECS). Use Application Load Balancer to direct traffic for inventory check to this microservice."
While deploying on Amazon ECS is a standard approach for running containers on AWS, using ECS with EC2 instances is not serverless and requires managing the underlying EC2 infrastructure.
This approach also does not leverage API Gateway, which is a better fit for exposing APIs.
"Create a Lambda function to fetch the quantity. Use Application Load Balancer to direct traffic for inventory check to this Lambda Function."
ALB is not typically used with Lambda functions for serverless APIs. Instead, API Gateway is the standard service for this type of configuration in serverless architectures.
Similar to the first option, using a Lambda function would require rewriting the microservice code, which is not aligned with the "lift-and-shift" requirement.
Final Recommendation:
The simplest lift-and-shift path for a container-based application is to use AWS Fargate (serverless container service), avoiding the need to rewrite the application while moving incrementally to serverless.
Correct Answer: Deploy the microservice as a container-based app on AWS Fargate. Use Amazon API Gateway to direct traffic for inventory check to this microservice.
However, reserved concurrency does not address cold starts; it only sets a limit on simultaneous execution.
To specifically address cold starts, you need Provisioned Concurrency, not reserved concurrency.
"Prevent AWS Lambda cold starts by increasing the service limits."
Increasing Service Limits (e.g., for Lambda concurrency or API Gateway limits) does not directly address the issue of cold starts.
Even if the concurrency limit is increased, cold starts will still occur when new containers are initialized.
Final Recommendation:
To ensure the AWS Lambda function is always ready to handle requests during peak hours with minimal latency, use Lambda Provisioned Concurrency. This pre-warms the required number of execution environments and eliminates the latency issues caused by cold starts.
Amazon SNS is better suited for pub/sub scenarios where multiple subscribers need to be notified of a message.
Here, you need response aggregation and orchestration of airline APIs, which SNS is not designed to handle efficiently.
The added complexity of using two topics and Lambda for aggregation makes this approach less flexible and harder to scale as new airlines are added.
Proxy request to Lambda function. Using Node.js, send requests to all airlines and then use a Lambda Destination to aggregate results together before returning to client:
While Lambda can execute parallel tasks using libraries like Promise.all() in Node.js, there are drawbacks:
The Lambda function's execution time is limited to 15 minutes and could become unreliable during high traffic or as the number of airline partners grows.
Using Lambda Destinations is not ideal when results need to be aggregated immediately, as it introduces asynchronous steps outside the Lambda function.
This method is harder to scale and less flexible compared to Step Functions for orchestrating multiple parallel tasks.
Proxy search requests to an SQS Queue. Use AWS Fargate to read messages from the queue and send search parameters to airlines. Wait for results and then return to the client:
Amazon SQS is better suited for asynchronous message processing, and AWS Fargate is ideal for containerized, batch-style workloads.
Here, you need a synchronous workflow with result aggregation in near real-time to meet the customer's low-latency requirements. SQS + Fargate introduces unnecessary complexity, latency, and operational overhead for this type of problem.
Final Recommendation:
The AWS Step Functions workflow with a Parallel State is the best solution because it:
Provides flexibility to add new airlines easily.
Handles orchestration across airline APIs.
Aggregates responses for the client while respecting the 15-second SLA.
Allows timeout handling and retries in a structured manner.
Is scalable and serverless, without requiring additional infrastructure management.
Correct Answer: Proxy search results to an AWS Step Functions workflow. Use a parallel state to send synchronous requests to all airlines. When all responses are received, move to aggregate step and return.
not optimized for storing sensitive data like credentials
AWS Lambda Environment Variables:
While Lambda environment variables can store configuration data, they are not ideal for sensitive information like database credentials because:
Environment variables are visible in the AWS Lambda console by anyone with access.
Managing environment-specific configurations across multiple Lambda functions becomes challenging.
It's not centralized, and updating credentials requires redeploying the function.
Application Source Code:
Storing sensitive information like connection strings and credentials in source code is a bad security practice. It increases the risk of exposing sensitive data in version control systems like GitHub or during application deployment.
Final Recommendation:
For securely storing sensitive configurations (like database connection strings, usernames, and passwords) and managing environment-specific configurations dynamically, AWS Systems Manager Parameter Store is the best choice. It ensures security, flexibility, and usability across multiple environments and services.
Correct Answer: AWS Systems Manager Parameter Store
Switching to EC2 introduces fixed costs for instance uptime and requires significant re-architecting of the system, which goes against the goal of minimal changes.
"Before sending the messages to Amazon SNS, filter the messages at the application level."
While filtering messages at the application level can work, it assumes the application itself can know which messages Lambda needs to process.
This would require modifying the application code and possibly impact its performance or logic. Additionally, if the logic for filtering changes later, it would require further application-level changes, making this solution less flexible than SNS filtering.
Final Recommendation:
Use Amazon SNS attribute-based message filtering to prevent irrelevant messages from reaching the Lambda function. This solution is cost-effective, requires minimal changes, and leverages existing SNS capabilities.
Correct Answer: Use Amazon SNS attribute-based message filtering to only send messages that need to be processed downstream to Lambda.
"Use metric filters to extract information from logs":
Metric filters can extract some structured data from CloudWatch Logs and turn them into metrics, but they:
Are less flexible and harder to implement for tracking dynamic data like product categories across many logs.
Require predefining the patterns to look for, which limits the monitoring's adaptability.
Do not scale as efficiently as EMF for serverless applications.
"Publish business-level metrics as custom metrics from Lambda function using CloudWatch PutMetricData API":
Using the PutMetricData API allows you to create direct, custom metrics in CloudWatch, but it comes with a higher implementation overhead:
You need to write additional application code in Lambda to explicitly send metrics using the SDK.
You’ll also incur additional API request costs for every PutMetricData call.
EMF eliminates these issues by embedding metrics into the logs themselves.
Final Recommendation:
The Embedded Metric Format (EMF) solution is superior because it is:
Scalable: Automatically integrates with CloudWatch Metrics.
Simple: Requires minimal changes to the Lambda code (just modify the logs to follow EMF).
Cost-Effective: Reduces operational and API costs.
This is the easiest and most scalable way to track business-specific metrics like orders placed by product category in a serverless architecture.
Correct Answer: Use embedded metric format (EMF) to log.
Throttling limits the rate of incoming requests
Valid customer orders would get rejected during peak hours, worsening the customer experience.
Throttling is not a solution for ensuring message durability or reliability during spikes in traffic.
"Create asynchronous communication between the API Gateway and Lambda using an Amazon Simple Notification Service (SNS) to store the orders until they are processed by Lambda."
SNS is a pub/sub messaging service, and it does not provide durable storage. If the Lambda fails or is overwhelmed, messages may be lost unless another subscriber (e.g., SQS) is integrated to store messages.
SQS is the better option here because it is designed to store and queue messages durably until they are processed.
"Create synchronous communication between the Amazon API Gateway and AWS Lambda and have Amazon API Gateway send failed requests to an Amazon Dead Letter Queue."
Synchronous communication means the API Gateway waits for the Lambda function to process the request before returning a response to the customer. Under heavy loads:
Customers will continue to see errors because Lambda may fail due to concurrency limits or timeouts.
Orders would still be lost without retrying or buffering mechanisms.
Final Recommendation:
To solve the issue of lost orders and handle peak traffic effectively:
Introduce Amazon SQS as an intermediary queue between API Gateway and Lambda.
This makes the communication asynchronous, ensuring that all orders are durably stored even if Lambda is under heavy load or fails temporarily.
Correct Answer: Create asynchronous communication between the Amazon API Gateway and Amazon Lambda using an Amazon Simple Queue Service (SQS) queue to store incoming orders until they are processed by Lambda.
s3:PutObject
"Update the Lambda execution role trust policy to include both the S3 bucket and the DynamoDB table."
Trust policies define who/what can assume a role (e.g., whether Lambda is allowed to assume the execution role). Permissions for accessing resources (like S3 or DynamoDB) are defined in the role's policy statements, not the trust policy.
Updating the trust policy is not relevant to granting Lambda access to S3.
"Update the Lambda execution role to include s3:PutObject permissions for all buckets."
Granting s3:PutObject for all buckets increases the scope of permissions unnecessarily, which violates the least privilege principle and poses a security risk.
Permissions should be restricted to the specific bucket the Lambda function is expected to use.
Final Recommendation:
The least privilege, secure solution is to grant your Lambda function s3:PutObject permissions only for the specific bucket, ensuring it has access only to the resources it needs to complete its task.
Correct Answer:Update the Lambda execution role to include s3:PutObject permissions for this bucket.
"Define the Lambda function as a global public function":
There is no such option to make a Lambda function global and public.
Even if you allow wide access via "Principal": "*", best practices require you to restrict access using conditions (e.g., using PrincipalOrgID). Failing to do so would expose your function to all AWS accounts, which would be a security risk.
"Create an SCP at the organization level that allows all member accounts to access the Lambda function":
Service Control Policies (SCPs) are used to specify permission boundaries at the organization level. They only restrict or allow the actions that member accounts' IAM principals are allowed to perform.
An SCP cannot directly give access to resources (like Lambda functions) across accounts. It is the resource policy that grants access.
Final Recommendation:
To grant access to your Lambda function to all member accounts in an AWS Organization:
Create a resource-based policy for the Lambda function.
Specify "Principal": "*" to allow all accounts and use the condition key "aws:PrincipalOrgID" to restrict access to your organization.
Correct Answer:Create a resource policy and attach it to your Lambda function. Specify the Principal as '*' and use a condition to specify the organization's PrincipalOrgID.
"Refactor the system to use containers. Use the Organic migration strategy to lift-and-shift the complete containerized system to the Amazon Elastic Container Service (Amazon ECS) using AWS Fargate for the underlying compute to satisfy the serverless requirement."
While ECS with Fargate is a valid approach, it's a lift-and-shift strategy for containers, which is not truly serverless (containers still require image management and orchestration overhead).
This does not align with the stated goal of migrating non-critical components to serverless quickly.
"Use serverless to automate build tasks for the existing system and use this learning to migrate the complete existing application to a serverless cloud architecture."
While serverless automation for build tasks can indirectly assist migration, it doesn’t focus on migrating components of the existing application to serverless backends as requested.
This approach does not address the immediate problem of customer complaints or the need for a gradual migration plan.
Final Recommendation:
The Strangler migration pattern achieves the following:
Gradually decomposes the monolithic architecture.
Redirects non-critical components to serverless backends via ALB.
Maintains the stability and integrity of critical customer banking transactions in the monolithic system while facilitating a risk-averse move to serverless.
This strategy satisfies the organization's requirements: incremental migration, reduced risk, and minimized disruption to customers.
Correct Answer: Use the Strangler migration pattern to incrementally decompose the monolith and gradually migrate non-critical system components to serverless by routing non-critical routes in the Application Load Balancer (ALB) to serverless backends.
"Create a function resource-based policy with DynamoDB read and write operations to access specific DynamoDB tables."
Again, resource-based policies are generally used to authorize external access to Lambda functions, not for managing a function’s access to other AWS services like DynamoDB.
IAM policies attached to the execution role are the appropriate mechanism for governing what resources the Lambda function can access.
Final Recommendation:
The best practice is to:
Grant minimal permissions that allow the Lambda function to perform its required operations, following the principle of least privilege.
Use an IAM policy scoped to the specific DynamoDB tables the Lambda function needs to access, and attach it to the Lambda function's execution role.
Correct Answer: Create an IAM policy with DynamoDB read and write operations to access specific DynamoDB tables. Add the policy to the function execution role.
While this pattern aligns with gradual modernization, it is generally used for specific applications rather than entire infrastructure migration plans.
Final Recommendation:
The Organic migration pattern is the best fit for this scenario, as it describes a gradual, step-by-step migration strategy that includes:
Starting with a lift-and-shift (EC2 instances).
Incrementally adopting modern features (AWS Lambda).
Experimenting and planning for future serverless API workloads.
This approach minimizes business disruption and allows for learning and adaptation throughout the migration journey.
Correct Answer: Organic
existing alias (LIVE)
Using multiple aliases would increase operational overhead without delivering additional benefits.
"Publish function version 2 and use API Gateway to create a routing configuration for the two versions."
While API Gateway supports routing for upstream resources, this approach is not operationally efficient since Lambda aliases natively handle traffic splitting.
Introducing API Gateway routing adds unnecessary complexity and is not needed when Lambda features can natively handle the use case.
Final Recommendation:
To efficiently route traffic between the existing version and the updated version, use the traffic routing configuration on the alias (LIVE), which is specifically designed for this purpose in AWS Lambda.
This approach is simple, leverages built-in Lambda capabilities, and ensures a smooth rollout of the updated version.
Correct Answer: Publish function version 2 and configure a routing configuration on the alias.
This is unrelated to testing best practices. While avoiding recursive loops in Lambda (due to timeouts or high cost) is generally a good practice, it has no direct impact on ensuring testing quality.
Minimize dependencies and packages used by the Lambda functions.
While reducing dependencies improves Lambda function performance (e.g., shorter startup times or reduced package size), it does not directly ensure that code is well tested.
Take advantage of execution environment reuse.
Reuse of the execution environment (e.g., caching variables or connections) optimizes performance but is unrelated to testing Lambda function code itself. This is more of an optimization practice rather than a testing strategy.
Final Recommendation:
Separating the business logic from Lambda-specific code enables modular, reusable, and testable code. This design best practice enhances testability and aligns with the principles of clean and maintainable code.
Correct Answer:Separate business logic from Lambda-specific code
Webhooks are used to send messages from a server to a client via HTTP POST requests. However:
Webhooks are unidirectional (server-to-client) and require HTTPS endpoints on the client side.
Amazon SNS does not support WebSocket or Webhook-style interaction natively.
Webhooks introduce complexity in managing endpoints and retry logic, making them inefficient for this real-time, event-driven use case.
Client Polling an AWS Lambda API:
Polling involves the client repeatedly querying the server for updates at regular intervals. This approach is:
Inefficient and incurs unnecessary costs due to repeated API calls.
Ineffective for real-time updates because polling frequency introduces latency.
Resource-intensive, especially as the number of concurrent clients grows.
Final Recommendation:
For building real-time, bi-directional communication between a mobile app and the backend in an event-driven architecture, Amazon API Gateway WebSockets is the best option. It minimizes latency, scales effortlessly, and integrates seamlessly with AWS serverless services.
Correct Answer: Amazon API Gateway WebSockets
It also introduces significant refactoring effort, which goes against the "most effective and easiest way" requirement.
"Implement retry logic and exponential backoff when calling APIs":
Retries with exponential backoff reduce load temporarily but do not address the core issue of scalability or provide a durable system for handling surges in traffic.
Orders may still fail to process if the backend remains overloaded.
"Increase the provisioned capacity of Lambda functions":
Increasing Lambda concurrency may handle some additional load, but it does not solve the problem of lost orders or API timeouts.
Without decoupling through a queue, high back-pressure on Lambda or downstream resources (e.g., DynamoDB) will still cause failures.
This is also cost-inefficient, as it doesn't address traffic spikes dynamically.
Final Recommendation:
To handle the increased traffic during promotions:
Insert an Amazon Simple Queue Service (SQS) queue in front of the Lambda functions.
This pattern ensures all orders are processed asynchronously, reduces timeouts, and improves the overall customer experience without significant architectural changes.
Correct Answer: Insert an Amazon Simple Queue Service (SQS) queue in front of your Lambda function, store orders in the queue, and process them via your Lambda functions.
This AWS Config rule is used to check whether a secret in AWS Secrets Manager is configured for periodic rotation. It ensures compliance but does not implement automatic rotation or manage credentials directly.
The Config rule is a compliance tool, not a solution to rotate or manage credentials.
Final Recommendation:
AWS Secrets Manager is the best choice because it securely stores database credentials, automatically rotates them, ensures encryption at rest using KMS, and logs actions in CloudTrail—all with the least amount of operational overhead.
Correct Answer: AWS Secrets Manager
Dead-letter queues (DLQ) are useful for investigating messages that failed processing. However:
DLQs are only applicable for asynchronous services like SQS or SNS and do not provide performance insights for synchronous components like API Gateway or Lambda.
DLQs capture errors, not latency issues or bottlenecks.
"Add debugging log statements to Lambda function code. Review function execution outputs in CloudWatch Logs to identify potential problems."
Adding log statements only tracks what happens within individual Lambda functions. While helpful for debugging specific logic, it:
Increases developer overhead.
Does not provide end-to-end visibility into request flows across the system.
Cannot easily identify latencies across multiple services or pinpoint the root cause of performance issues.
Final Recommendation:
For identifying bottlenecks and debugging performance issues in a complex, serverless application, AWS X-Ray is the easiest and most effective tool as it provides complete end-to-end tracing and visibility across all services.
Correct Answer: Use AWS X-Ray to trace requests and investigate latency between service interactions
should not be the first step
"Choose the right data store for different microservices."
While choosing appropriate data stores is critical during the migration process, this step comes later in the planning phase. You first need to understand the application’s data needs and dependencies, which happens as part of the analysis phase.
"Decouple the control plane’s transactional data requirements from the data plane’s query operations."
Decoupling the control plane from the data plane is a specific technique applied to certain workloads and database operations. While it is helpful for certain architectures, it is not the logical next step for migrating an entire eCommerce application and should follow component analysis.
Final Recommendation:
The next step in any migration from a monolithic architecture to serverless is to fully understand the application and how its components interact. Only after this can you start decomposing the monolith into microservices or choosing the correct technologies for the new architecture.
Correct Answer: Understand what the application does, what each component does, and how each component interacts.
SNS is a publish/subscribe (pub/sub) messaging service designed for broadcasting messages to multiple subscribers rather than buffering messages for workers like a queue.
It does not manage message retention or support decoupled worker processing directly.
Amazon Managed Queue (MQ):
Amazon MQ is a managed message broker service for Apache ActiveMQ or RabbitMQ, which requires deploying and managing a message broker instance.
It involves server provisioning and ongoing management of the cluster, which does not align with the fully serverless requirement.
Final Recommendation:
For a queueing solution that is fully serverless, requires no physical server management, and can replace the existing RabbitMQ for processing background tasks, Amazon SQS is the best option. It simplifies the architecture, ensures scalability, and integrates seamlessly into other AWS services.
Correct Answer: Amazon Simple Queue Service (SQS)
"Update the client to poll the REST API every 5 seconds to check for updates."
Polling introduces repeated HTTP requests, causing unnecessary load on the backend.
It is inefficient, especially for high traffic, and does not address the REST API timeout issue.
This approach cannot provide real-time updates due to the interval between polls.
"Register the client with an SNS Topic and publish updates to the topic."
SNS is not designed for maintaining long-lived communication channels (e.g., a single session tied to a specific client's search query).
It requires the client to have a consumer that supports pub/sub (such as an email, SMS, or HTTP endpoint), which is not suitable for a search engine use case.
Final Recommendation:
To avoid timeouts and provide ongoing real-time search updates, replacing the REST API with a WebSocket API is the best option. WebSockets allow for persistent connections, live status updates, and efficient two-way communication between clients and backend services.
Correct Answer: Replace the REST API with a WebSocket API. Push the search updates to the client via the WebSocket.
While useful for controlling the load on downstream resources, setting a low concurrency during load testing would throttle invocations and might impact the validity or accuracy of the load test results. This approach does not solve the cost problem.
"Changing Lambda code does not necessarily require load testing. Unit and integration tests are sufficient."
While unit and integration tests are helpful for testing individual pieces of functionality and reducing the need for heavy load testing, they cannot fully replicate real-world traffic and scale tests.
Load testing ensures end-to-end system performance and scale validation, which is critical for production-ready applications. This suggestion sacrifices quality assurance.
"Use Amazon EC2 instead of Lambda."
Migrating to Amazon EC2 introduces infrastructure management overhead and eliminates the serverless benefits of AWS Lambda, such as automatic scaling and pay-per-use.
EC2 incurs flat costs for running instances (even when idle), which may not necessarily reduce costs for load testing and often increases complexity.
Final Recommendations:
Enable caching in Amazon API Gateway to reduce Lambda invocations for read-heavy routes during load tests.
Adopt a compute savings plan for AWS Lambda to secure a long-term discount for consistent or predictable Lambda usage.
Correct Answers: 1. Use caching on Amazon API Gateway. 2. Use compute savings plan for Lambda (discounted Savings Plans rates of up to 17% for a 1 or 3 year term, up to the commitment level).
"High cost" (Incorrect):
Serverless is designed to be cost-effective, as you pay only for the resources you use (e.g., Lambda execution time or API Gateway requests).
There is no cost for idle resources, making it typically cheaper than provisioning servers or managing underutilized infrastructure.
"Pay for idle compute capacity" (Incorrect):
One major benefit of serverless is that it does not charge for idle capacity. You only pay for actual usage.
For example, Lambda charges based on the number of requests and compute duration, while DynamoDB charges based on actual read/write capacity.
Final Benefits of Serverless:
No server provisioning: Serverless abstracts and automates infrastructure management.
Reduced time to market: Developers can focus purely on application logic and deliver solutions faster.
High availability: Built-in high availability and fault tolerance ensure seamless operations.
Correct Answers: 1. No server provisioning 2. Reduced time to market 3. High availability
Incorrect because while Lambda does have retry mechanisms, these are not automatically applied in synchronous invocations initiated by API Gateway.
If a timeout happens at the API Gateway level, it will fail immediately, and retries by Lambda do not come into play.
"Generate the SDK from the API stage, and use the backoff and retry mechanisms it provides."
Incorrect because exponential backoff and retry mechanisms would be implemented on the client side. This does not solve the problem of the Lambda function timing out due to insufficient API Gateway timeout configuration.
This could be a partial solution for mitigating transient failures but won't address the timeout issue where the Lambda execution is too long.
Correct Recommendation:
To fix the error caused by timeout:
Increase the API Gateway timeout to accommodate longer Lambda execution times (up to 29 seconds).
If needed, optimize the Lambda function logic to meet the timeout requirement or consider an architecture change to handle long-running processes asynchronously.
Correct Answer: Increase the timeout limit in the API Gateway. If the invocation request returns invocation errors, Lambda retries that request two more times by default. You can configure this retry value between 0 and 2.
"Amazon Simple Queue Service (SQS)":
SQS is a queueing service designed for point-to-point or decoupled asynchronous communication. However, it's not designed for fan-out messaging or distributing messages to multiple consumers simultaneously.
While you can use SNS in combination with SQS (fan-out model), SQS alone does not handle the message distribution use case effectively.
Final Recommendation:
For distributing request messages to multiple downstream applications:
Use Amazon SNS for fan-out messaging or notification-style systems where the same message must be sent to multiple subscribers.
Use Amazon EventBridge for event-driven systems where messages need to be routed to multiple services or targets, often with filtering or transformation.
Step Functions provides visual workflows, enabling detailed and intuitive monitoring of execution paths, which makes operations easier.
Failures, retries, and transitions can be viewed directly in the AWS Management Console for Step Functions.
Why Not the Other Options?
"Extract the business logic into several Lambda functions. Create an API Gateway with the corresponding routes for each function. Modify the applications clients to call the new API Gateway endpoint."
While this approach extracts business logic into individual Lambda functions, it does not address the separation of state tracking or error handling (which remains tied to your clients or elsewhere).
It also shifts complexity to the clients, which now need to coordinate multiple API calls, making the system harder to operate and monitor.
"Create Lambda functions to implement the business logic. Use Amazon EventBridge to coordinate your functions and handle errors."
EventBridge coordinates event-based, asynchronous workflows, not sequential workflows that require state tracking or complex, explicit workflow-defined logic (like retries and branching).
Step Functions is specifically designed to handle stateful workflow orchestration, while EventBridge is better suited for publish/subscribe and event-driven designs.
"Create Lambda functions for the business logic and use Amazon SQS FIFO queues to connect them asynchronously."
SQS FIFO queues are great for decoupling services and ensuring ordered processing, but they do not natively handle workflow orchestration (e.g., state transitions, retries, branching logic).
Combining SQS with Lambda would still require significant custom logic for state management and error handling, so it doesn't simplify the architecture as much as using Step Functions.
Final Recommendation:
To address the mixed state and error handling logic, the best approach is to refactor the application by extracting business logic into AWS Lambda functions and using AWS Step Functions to manage workflow orchestration, state tracking, retries, and error handling.
Correct Answer: Create an AWS Step Function to model the order process and extract the business logic into Lambda functions.
"Store state information within your function, but outside the function handler":
Incorrect:
Storing state outside of the handler in a Lambda execution environment (e.g., as a global variable) may work temporarily because AWS reuses execution environments between invocations.
However, this approach is unreliable because Lambda execution environments can be recycled at any time. This might lead to undefined behavior or data inconsistencies.
If state needs to be persisted, use external state storage like DynamoDB or Amazon S3.
"Store complex business logic within the function handler":
Incorrect:
Keeping all the business logic within the Lambda handler results in a monolithic function that is harder to read, debug, and test.
This violates best practices for modularity and single-responsibility coding principles.
"Store database credentials directly in variables in the function":
Incorrect:
This creates security risks because hardcoded credentials are visible in the code, making them susceptible to leaks or unauthorized access if the code is compromised.
Best Practice: Store sensitive information like database credentials in AWS Secrets Manager, AWS Systems Manager Parameter Store, or Lambda environment variables (encrypted with KMS).
Final Best Practices:
Limit function dependencies to essential libraries to improve performance and reduce cold start times.
Modularize business logic outside the Lambda handler for better testability, reuse, and maintainability.
Correct Answers: 1. Limit the use of function dependencies to only what is required. 2. Split complex business logic into separate modular functions outside of the function handler.
Modularization makes code easier to maintain and test, but it doesn't impact execution environment initialization.
"Separate business logic from Lambda-specific handler code":
Incorrect:
Separating business logic improves testability and simplifies function structure but does not address factors affecting cold starts such as environment initialization or dependency loading.
It affects code organization and maintainability rather than cold start efficiency.
"Avoid using recursive code in the Lambda functions":
Incorrect:
Avoiding recursion is a good practice to prevent issues like excessive resource consumption or stack overflow, but it's unrelated to cold start duration.
Recursive logic has no impact on startup latency; it only affects runtime performance or function execution limits.
Optimizing AWS Lambda Cold Starts:
Keep the deployment package lightweight by reducing dependencies and using tools like AWS SDK modularization.
Use environment variables for preloading data to avoid runtime lookups or fetching configurations.
Use Provisioned Concurrency for mission-critical low-latency needs.
Correct Answers: 1. Include only the dependencies and modules needed by the function. 2. Use environment variables for operational parameters.
Layers are unrelated to startup times for consistently low traffic workloads.
"Configure Reserved Concurrency":
Reserved Concurrency ensures that no more than a set number of concurrent executions of a Lambda function occur.
It does not reduce cold starts or pre-initialize execution environments; its primary purpose is to limit the concurrency usage for a specific function.
Reserved concurrency helps manage account-wide concurrency but does not improve response time or eliminate cold starts.
Final Recommendation:
To achieve low latency and predictable startup times for a Lambda function with a consistent but low traffic workload, Provisioned Concurrency is the most effective solution. It ensures pre-warmed execution environments are ready to serve traffic immediately. While it incurs additional costs, it guarantees consistent performance.
Correct Answer: Configure Provisioned Concurrency
SCPs do not configure networking for Lambda functions.
"Create a Lambda Execution Role that allows write permissions to the S3 bucket. Create a VPC Endpoint for S3."
While this partially addresses the issue by granting S3 access through a VPC Endpoint, it does not specify starting the Lambda function in a private subnet to securely access the RDS database.
Accessing RDS in the VPC requires the Lambda function to reside in the same VPC.
"Create a new NAT Gateway and Internet Gateway. Configure route table. Create an execution role that allows the Lambda function to write to the bucket."
Adding both a NAT Gateway and Internet Gateway for S3 access is unnecessary and costly when a VPC Endpoint for S3 provides a more secure and cost-efficient solution.
This does not address the scenario optimally because it routes traffic through public internet infrastructure when it can remain private via the VPC Endpoint.
Final Recommendation:
Use a Lambda Resource Policy to grant the function permissions to access S3.
Create a VPC Endpoint for S3 to enable private communication between the Lambda function (in the VPC) and the S3 bucket.
Ensure the Lambda function is deployed in a private subnet within the VPC to access the RDS database.
This configuration fulfills the requirements securely and efficiently, with no unnecessary exposure to the public internet.
Correct Answer: Use a Lambda Resource Policy that allows write permissions to the S3 bucket. Create a VPC Endpoint for S3. Start the Lambda function on a private subnet and use the VPC Endpoint to access S3 privately.