Lambda Function: Multitasking feature in Cloud computing
Scenario
:- Zedtel organization have 1000+ virtual
machines in different region. company’s security team found some vulnerability.
To prevent outside DDos attack Company security team require to perform
eventful security task at a time with timid timeline globally at different
Machines at different zone. How’s it possible if single VM manually takes 10
minutes to perform operation. So, how can complete it asap??
In this
scenario Lambda function role is crucial to execute this task.
LAMBDA function has some important characteristics:
1. No server management2. Flexible scaling
3. No ideal capacity
4. High availability
Step-1 :
Create 2 EC2 instance with different availability Zone
Payment
Gateway WEB 01 EC2 instance via launch instance.
Payment
Gateway WEB 02 EC2 instance via launch instance.
Step-2
start both instances also 1 snapshot require which is after start instance .
One snapshot
is already there which details is mentioned here.
Step-3
select IAM service create new role for
AWS service .
select permissions appropriately with EC2 service /EBS wise for IAM user.
Step -4 Create role and apply it.
Step-5
apply script which we want to run under lambda function. Choose option which
language platform we used to run script.
Step-6
Apply code source in Editor mode.
Step-7
configuration require to run code Generally Memory size depends on Program code
and how many Virtual Machine at a time performing this operation.
Step-8 Test and Run code after test event.
Application
:
1. People use photo share application
to upload photos, application stores user photos in S3 bucket. In this
scenario, it automatically generates a thumbnail. Lambda function code can read
the photo object from bucket, create thumbnail version and save it in bucket.
2. Suppose customer have a custom
mobile application, customer can configure a Lambda function to process within
application.
Run
Program :
-
Use
of memory and CPU power are proportionate to Lambda.
-
TTL = Maximum amount of time in which program must be completed.
Note: If we
allocate TTL = 40 second, then please find output of sample code in Python3.8 as above.
Comments
Post a Comment