Configuring the Serverless Framework to Work with Amazon Web Services (AWS)

Sharing is Caring

The Serverless Framework is a free open source framework that allows us to easily build applications on cloud providers like AWS using serverless computing. In particular, on AWS it abstracts away a lot of the complexity of setting up API Gateway and AWS Lambda.

Amazon Web Services (AWS) is a cloud provider owned by Amazon. AWS is the market leader in infrastructure as a service and platform as a service which allows them to do scalable cloud applications without infrastructure provisioning or management problems. AWS allows us to pay for exactly what we need, allowing us to move faster and reduce capital expenditures.

So, How do We Connect Serverless Framework to AWS?

Connecting the Serverless Framework to AWS is pretty painless once we have downloaded our credentials from AWS. To do that we need to sign in to the portal located at

Once we have signed in successfully, we need to click our user name in the top right corner and choose “My Security Credentials”.

A new screen will load, you need to click “Create access key”

A new modal window will pop up, it’s really important to click “Download .csv file” and save this file somewhere useful on the computer. We will need the access key and secret access key later.

Now locate the file and open it in Excel or in Notepad. If you open it in Excel it should look something like this.

Now open up an instance of the terminal / command line somewhere.

Type in serverless -v to confirm that you have a version of serverless installed globally. If it isn’t found you can install it globally by typing: npm install -g serverless

Okay, great, let’s configure it now! At the terminal we’ll need to type in the below replacing the secrets with your secrets.

serverless config credentials –provider aws –key YourAccessKeyIdGoesHere –secret YourSecretAccessKeyGoesHere

If it’s successful it should look like this:

We then need to configure our project to have a serverless.yaml file. The easiest way to do this is to create a new serverless.yaml file manually and then paste in the below:

service: sample-app
  name: aws
  runtime: nodejs8.10
  stage: dev
  region: us-east-1
  memorySize: 128
    handler: app/app.handler
      - http: 
          path: /
          method: ANY
          cors: true
      - http: 
          path: /{proxy+}
          method: ANY
          cors: true

In this blog post, we’ve configured the Serverless Framework to potentially communicate with AWS and to potentially allow our project to deploy to AWS.

Sharing is Caring

Brian is a software architect and technology leader living in Niagara Falls with 13+ years of development experience. He is passionate about automation, business process re-engineering, and building a better tomorrow.

Brian is a proud father of four: two boys, and two girls and has been happily married to Crystal for more than ten years. From time to time, Brian may post about his faith, his family, and definitely about technology.