AWS Certification: Lambda Questions

AWS Lambda

Overview
AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume.
1. A company is planning on building an application using the services available on AWS. This application will be stateless in nature, and the service must have the ability to scale according to the demand. Which of the following would be an ideal compute service to use in this scenario?

A. AWS DynamoDB

B. AWS Lambda

C. AWS S3

D. AWS SQS

Answer

B. AWS Lambda

The following content from an AWS Whitepaper supports the usage of AWS Lambda for this requirement: A stateless application is an application that needs no knowledge of previous interactions and stores no session information. Such an example could be an application that, given the same input, provides the same response to any end user. A stateless application can scale horizontally since any request can be serviced by any of the available compute resources (e.g., EC2 instances, AWS Lambda functions). For more information on AWS Cloud best practices, please visit the following URL: https://d1.awsstatic.com/whitepapers/AWS_Cloud_Best_Practices.pdf


2. A company owns an API which currently gets 1000 requests per second. The company wants to host this in a cost effective manner using AWS. Which one of the following solution is best suited for this?

A. Use API Gateway with the backend services as it is.

B. Use the API Gateway along with AWS Lambda

C. Use CloudFront along with the API backend service as it is.

D. Use ElastiCache along with the API backend service as it is.

Answer

B. Use the API Gateway along with AWS Lambda

Since the company has full ownership of the API, the best solution would be to convert the code for the API and use it in a Lambda function. This can help save on cost, since in the case of Lambda, you only pay for the time the function runs, and not for the infrastructure.

Then, you can use the API Gateway along with the AWS Lambda function to scale accordingly.

For more information on using API Gateway with AWS Lambda, please visit the following URL:

https://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started-with-lambda-integration.html

Note: With Lambda you do not have to provision your own instances; Lambda performs all the operational and administrative activities on your behalf, including capacity provisioning, monitoring fleet health, applying security patches to the underlying compute resources, deploying your code, running a web service front end, and monitoring and logging your code. AWS Lambda provides easy scaling and high availability to your code without additional effort on your part.


3. A company stores its log data in an S3 bucket. There is a current need to have search capabilities available for the data in S3. How can this be achieved in an efficient and ongoing manner? Choose 2 answers from the options below. Each answer forms a part of the solution.

A. Use an AWS Lambda function which gets triggered whenever data is added to the S3 bucket.

B. Create a Lifecycle Policy for the S3 bucket.

C. Load the data into Amazon Elasticsearch.

D. Load the data into Glacier.

Answer

A. & C.

AWS Elasticsearch provides full search capabilities and can be used for log files stored in the S3 bucket. AWS Documentation mentions the following with regard to the integration of Elasticsearch with S3: You can integrate your Amazon ES domain with Amazon S3 and AWS Lambda. Any new data sent to an S3 bucket triggers an event notification to Lambda, which then runs your custom Java or Node.js application code. After your application processes the data, it streams the data to your domain. For more information on integration between Elasticsearch and S3, please visit the following URL: https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-aws-integrations.html


4. A company wants to build a brand new application on the AWS Cloud. They want to ensure that this application follows the Microservices architecture. Which of the following services can be used to build this sort of architecture? Choose 3 answers from the options given below.

A. AWS Lambda

B. AWS ECS

C. AWS API Gateway

D. AWS Config

Answer

A., B. & C.

AWS Lambda is a serverless compute service that allows you to build independent services. The Elastic Container service (ECS) can be used to manage containers. The API Gateway is a serverless component for managing access to APIs. For more information about Microservices on AWS, please visit the following URL: https://aws.amazon.com/microservices/



A. Use AWS DynamoDB to store the jobs and then run them on demand.

B. Use AWS Lambda functions with C# for the Admin jobs.

C. Use AWS S3 to store the jobs and then run them on demand.

D. Use AWS Config functions with C# for the Admin jobs.

Answer

B. Use AWS Lambda functions with C# for the Admin jobs.

The best and most efficient option is to host the jobs suing AWS Lambda. This service has the facility to have the code run in the C# programming language. AWS Documentation mentions the following on AWS Lambda: AWS Lambda is a compute service that lets you run code without provisioning or managing servers. AWS Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second. You pay only for the compute time you consume – there is no charge when your code is not running. With AWS Lambda, you can run code for virtually any type of application or backend service – all with zero administration. For more information on AWS Lambda, please visit the following URL: https://docs.aws.amazon.com/lambda/latest/dg/welcome.html


6. An application currently accepts users to upload files to an S3 bucket. You want to ensure that the file name for each uploaded file is stored in a DynamoDB table. How can this be achieved? Choose 2 answers from the options given below. Each answer forms part of the solution.

A. Create an AWS Lambda function to insert the required entry for each uploaded file.

B. Use AWS CloudWatch to probe for any S3 event.

C. Add an event with notification send to Lambda.

D. Add the CloudWatch event to the DynamoDB table streams section.

Answer

A. & C.

You can create a Lambda function containing the code to process the file, and add the name of the file to the DynamoDB table.You can then use an Event Notification from the S3 bucket to invoke the Lambda function whenever the file is uploaded. For more information on Amazon S3 Event Notifications, please visit the following URL: https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html


7. You currently have a set of Lambda functions which have business logic embedded in them. You want customers to have the ability to call these functions via HTTPS. How can this be achieved?

A. Use the API Gateway and provide integration with the AWS Lambda functions.

B. Enable HTTP access on the AWS Lambda functions.

C. Add EC2 Instances with an API server installed. Integrate the server with AWSLambda functions.

D. Use S3 websites to make calls to the Lambda functions

Answer

A. Use the API Gateway and provide integration with the AWS Lambda functions.

An API Gateway provides the ideal access to your back end services via APIs. For more information on the API Gateway service, please visit the following URL: https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html


8. You want to build and deploy code functions in the AWS Cloud, but do not want to manage the infrastructure. Which of the following services can help meet this requirement?

A. AWS EC2

B. AWS API Gateway

C. AWS Lambda

D. AWS DynamoDB

Answer

C. AWS Lambda

AWS Documentation mentions the following: AWS Lambda is a compute service that lets you run code without provisioning or managing servers. AWS Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second. You pay only for the compute time you consume – there is no charge when your code is not running. With AWS Lambda, you can run code for virtually any type of application or backend service – all with zero administration. For more information on AWS Lambda, please visit the below URL: https://docs.aws.amazon.com/lambda/latest/dg/welcome.html