Serverless computing allows you to build and run applications and services without thinking about servers. With serverless computing, your application still runs on servers, but all the server management is done by AWS. Using AWS and its Serverless Platform, you can build and deploy applications on cost-effective services that provide built-in application availability and flexible scaling capabilities. This lets you focus on your application code instead of worrying about provisioning, configuring, and managing servers.
Building a serverless application allows you to focus on your application code instead of managing and operating infrastructure. You do not have to think about provisioning or configuring servers since AWS handles all of this for you. This reduces your infrastructure management burden and helps you get faster time-to-market.
- No server management
- Flexible scaling
- High availability
- No idle capacity
You can build a serverless web application by using several AWS services together. Each service is fully managed and does not require you to provision or manage servers. You only need to configure them together and upload your application code to AWS Lambda, a serverless compute service.
npm install -g serverless
Once the installation process is done you can verify that Serverless is installed successfully by running the following command in your terminal:
serverless
The Serverless Framework needs access to your cloud provider account so that it can create and manage resources on your behalf.
Once your have made your AWS account, then You can configure the Serverless Framework to use your AWS API Key & Secret in two ways:
- Setup with the aws-cli
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
- Using the aws-profile option
serverless deploy --aws-profile devProfile
- Install Node.js 6.x or later on your local machine
- Install the Serverless Framework open-source CLI version 1.47.0 or later
- Opening the folder of your service:
$ cd your-service-name
- Setting up an endpoint: You need to define a endpoint in your
serverless.yml
that will trigger your serverless function. - Deploying the Service:
serverless deploy -v
- Testing your Service:
serverless invoke local -f space-bot
- serverless-dotenv-plugin