Creating a serverless-deploy user with AWS IAM
If you are building a project with AWS serverless using SAM or serverless framework , you’ll need to be regularly deploying your code from your local machine and CI/CD pipelines. Both of these frameworks use AWS CloudFormation under the hood to provision and deploy resource stacks. In order for these frameworks to provision your infrastructure for you, you will need to give them permission to do so.
NOTE: This article assumes you already have the AWS CLI installed and configured. You will need to set that up first. Instructions can be found here.
Firstly log into your AWS console and navigate to Identity and Access Management (IAM). Go to Users and the create new user. Name it something that is easy to identify like serverless-deploy. Ensure programmatic access is enabled.
Click through next, giving it no permissions, if required add some tags, otherwise click next. Download the user credentials (don’t lose these, you can’t recover them again) and then let’s add them to our local CLI.
AWS credentials are typically stored in ~/.aws
on your local machine if you have configured the AWS CLI.