AWS Lambda interview questions - sitapriyanka/aws GitHub Wiki
-
*Q. How does AWS Lambda secure my code?
-
*A. What Lambda does is, it stores the code in the Amazon S3 and encrypts it when it is resting. AWS Lambda is known to perform an additional integrity check while the code is running.
-
*Q. What is scaling?
-
*A. When the load on your system increases there is a need to scale it either we can perform Horizontal scaling or vertical scaling.
-
Horizontal Scaling is spinning up new servers of the same type and divert load to them.
-
Vertical scaling means to increase the capacity of the system so that it can handle the required load.
-
in **Autoscaling **..without manual interaction AWS spins up new servers when the load increases and shut down the servers when the load decreases.
-
Scale-out- is nothing but horizontal scaling.
-
scale-up - is vertical scaling.
-
*Is the infrastructure accessible on which the AWS Lambda runs?
-
*No. As AWS Lambda starts operating the compute infrastructure on behalf of the user, the foundation on which AWS Lambda runs is not accessible. It allows Lambda to apply security patches, perform health checks, and work out other routine maintenance.
-
*Q. Can I use packages with AWS Lambda?
-
*A. Absolutely yes! You can efficiently use custom as well as NPM packages to be precise.
-
*Q. The disadvantage of a serverless approach?
-
*A. These services completely depend on the vendor. If there are any issues from the vendor side we have the least control over it.
*Use cases of AWS Lambda
-
- We can write a Lambda functions that perform health checks of a website every 5 minutes
- Whenever an EC2 instance is launched, using the lambda function we can tag the instance with who has created it. When ec2 instance is launched -> Cloud trail logs events to cloud watch -> Cloud watch event can trigger Lambda function.
- We can create a restful API using a lambda function. Each function represents a method. like put / Get/ Post. and A Api gateway can trigger these functions. s3 Static hosting website which has javascript code calls -> API GateWay -> Lambda function -> Dynamo db fethched data -> return to Lambda -> return to API GateWay -> return to Website This is a complete end to end website in serverless approach.
- Another popular use case for AWS Lambda is event-driven data processing. Whenever new data is available, an event is generated. The event triggers the data processing needed to extract or transform the data. Figure 7.23 shows an example. 1 The load balancer collects access logs and uploads them to an object store periodically. 2 Whenever an object is created or modified, the object store triggers a Lambda function automatically. 3 The Lambda function downloads the file including the access logs from the object store, and sends the data to an Elasticsearch database to be available for analytics.