If you want to get started with serverless, this article will cover setting up your AWS User, installing Serverless Framework and configuring your credentials.
Creating Your Serverless User
To allow serverless to do work on your account, you need to set up a user for it. To do this, navigate into AWS and search for “IAM” (Identity and Access Management).
Once in the IAM Page, click on Users in the list on the left hand side. This will open the list of users on your account. From here we’ll be clicking Add user.
We need to create a user which has Programmatic access and I’ve called my ServerlessAccount but the name doesn’t matter too much.
Next we need to give the user some permissions. When in the permissions screen, select Attach existing policies directly and then select AdministratorAccess. This will give our serverless framework permission to create all of the resources it needs to.
We don’t need to add any tags, so we can move straight onto Review.
In the review window, you’ll see the user has been given an Access key ID and a Secret access key. We’ll be needing those in the next part so keep this page open.
Serverless Install and Configuration
Now that we’ve created our user, we need to install the Serverless Framework on our machine.
Open up a terminal and run this command to install serverless globally on your computer. If you haven’t got npm or node installed check out this article.
npm install -g serverless
Now that we’ve got serverless installed, we need to set up the credentials for serverless to use. Run this command, putting your access key ID and Secret access key in the correct places.
serverless config credentials --provider aws --key ${Your access key ID} --secret ${Your secret access key} --profile serverlessUser
Once this has been run, you’re all set up with serverless. You can use serverless templates to create a repo with some of the setup already completed.
serverless create --template aws-nodejs --path ${Your Service Name}