Setting up AWS CLI
To upload our work directly to AWS, we can use the AWS CLI. This allows us to manage our AWS services from the command line and create scripts to automate common tasks. For us, the most important CLI commands are the ones that allow us to create and update Lambdas. With automated scripts we now have the ability to quickly and easily create and deploy Lambdas, fixing the first of the local editing limitations.
To use the AWS CLI, we first need to set it up. You can install it by typing npm install -g aws-cli into your terminal.
Now we need to set up a user for our CLI to log in as. Log in to your AWS Console and navigate to or search for IAM. Click Add user so we can set up a user for our CLI. You're asked to give the user a name, so choose something like cli-user so that it is easily identifiable. Select Programmatic access, which will allow us to act as the user remotely, and click Next: Permissions.
In the Permissions screen, choose to Attach existing policies directly and select AdministratorAccess. This will let you do whatever you want through your CLI. You can set stricter policies on this user if you want, or if you are giving another person access to your account.
There’s another screen before you end up being shown your access keys. Copy your access keys and open a terminal. Run the command aws configure, which will ask you for four things:
AWS Access Key ID [None]: "Your Access Key ID
"AWS Secret Access Key [None]: "Your Secret Access Key"
Default region name [eu-west-1]:
Default output format [json]:
The first two are found on the last page of the user creation. The third must be the region you chose earlier (eu-west-1 or us-east-1), and the last one can be left as default.