in

How to get started with AWS serverless?

Serverless computing is a way of running applications and services without being worried about servers. Servers will be used but all the server management is done by the cloud provider. Also, you are charged based on your server usage. AWS Lambda,  Amazon S3, DynamoDB, Aurora, Kinesis, Fargate, and Amazon API Gateway are some of the examples of AWS serverless. 

In this blog, you will run your first “Hello world!” With serverless.

What is AWS Lambda?

AWS Lambda is an event-driven, serverless computing platform by Amazon Web Service(AWS). You just need to put the code on Lambda, and it runs without being worried about the server and resources. Lambda supports multiple languages and pay-as-you-go pricing. 

AWS launched AWS Lambda in 2014 and since then it has risen in popularity, becoming one of the most widely adopted and fastest-growing products for AWS. You can use it in different use cases like hosting a serverless website, working with external services, log analysis, automated tasks, daily backups, processing uploaded s3 objects, bulk real-time data processing, and many more. 

How to create your first AWS Lambda function?

Here you will create your first AWS Lambda function. 

  1. Login to your AWS management console and open AWS Lambda. 
  2. From the Lambda Console choose to Create a Function if you are using it the first time otherwise Lambda > Function page > Create a function. 
  3. Then to select Blueprints, in the search box type ‘Hello-world-python’ and select the hello-world-python blueprint. This Blueprint will give us an example code to do some minimal processing. 
  4. After selecting the blueprint click on Configure. 
  5. Now you will be prompted to enter some basic information regarding your function. 
  • Name: hello-world
  • Role: You will create a new IAM role with the required permission that AWS lambda can invoke your function on your behalf. Select create new role from the templates. 
  • Role Name: lambda_basic_execution
  1. Click on the Create Function. Leave the runtime as python and in the handler choose where AWS Lambda can begin executing your code. I.e. lambda_function.lambda_handler
  2. Scroll down to set memory, timeout, and VPC setting or leave them as default.

From the upper ‘Select a test event’ menu choose Configure Test Event. An editor will pop up.

  • Select Hello world from the sample event template list. 
  • Type event name HelloWorldEvent. 
  • Now you can change the values in the sample JSON file. Change value1 with Hello, world! And select create. 

 

Now from the dashboard click on Test. You will see the results in the console after successful execution. Congratulations you have successfully created your first Lambda function. 

What do you think?

Written by DANN N

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading…

0