Setting up for Serverless Development with AWS
Tags: aws, serverless, cloud, serverlessframework
Published: 2023-01-31 23:21:01

---
title: Setting up for Serverless Development with AWS
published: true
date: 2023-01-30 13:57:33 UTC
tags: #aws #serverless #cloud #serverlessframework
canonical_url: https://soprinye.com/serverless-development-with-aws
---

![article header](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hpft94q8zvv3ojw3ttnq.png)
&nbsp;  
## Introduction

Beginning serverless development requires that you have certain packages or software installed on your computer that make it easy to develop applications using the Serverless Framework. This article outlines the process of downloading and installing the various packages needed. You should already have an AWS account to continue with the steps below.

&nbsp;  
## Step 1: AWS IAM - Programmatic Access

AWS IAM (Identity and Access Management) is an access and permissions management service provided by AWS with fine-grained control over what services and usability boundaries apply to an IAM account. One great feature of an IAM user account is that it is different from your root account therefore you can easily revoke permissions whenever you feel the need to. It is advisable to set up an IAM user account for use in your development environment instead of using your root account.

We are going to set up an IAM account with _programmatic access_ only - such that this IAM user will be able to access AWS resources via API calls only.
 
Launch your browser and navigate to the [AWS Management Console](https://aws.amazon.com). Enter the word _users_ in the search bar and then click on the _Users with IAM Feature_.
![AWS management console](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0yeobjr8as6naykpbq73.png)

&nbsp;  
On the Users page, click on the _Add users_ button - you will then be shown a page where you will enter a username.
![AWS Management Console users page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0jmo6u3hmb7yyc72r1w.png)

&nbsp;  
After entering a user name, click on _Next_ to set the permission for the user you are creating. Select the "_Attach policies directly"_ option and check the "_AdministratorAccess"_ policy.
![AWS Management Console attach policy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tfr3gtm5f35bf9se998r.png)

&nbsp;  
At the bottom of the page, click on "_Next_" to review your settings and finally, click on the "_Create User"_ button.
![AWS Management Console create user page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ut065jctkj2cgkebge1y.png)

&nbsp;  
Click the newly created username and then select the "_Security Credentials_" tab. Locate the "_Access keys"_ section on the same page and click on the "_Create access key"_ button
![AWS Management Console security credentials](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pb6wv3p37srswgrs7gbq.png)![AWS Management Console create access keys](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1dpwhghc5pkd7128glc.png)

&nbsp;  
To create your access keys, select the "_Local code"_ option and agree by checking the proceed checkbox then click "_Next_".
![AWS Management Console Access Keys](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ub3rnf6dsylqcjjioetc.png)

&nbsp;  
Congratulations, your access keys have been generated. Copy these keys to a safe place because you will be using them in the next section.

&nbsp;  
## Step 2: AWS CLI

CLI is an acronym for `Command Line Interface` and is typically a lightweight and text-based application that runs via the command line, where it draws its name from. You interact with a CLI using commands as specified by the developers of the CLI. One of the features of AWS CLI is creating a connection between your local development environment and your AWS account such that you can issue commands via the CLI that will be received and responded to by the corresponding AWS service through your AWS account. This typically means you don't need to visit the management console to perform these actions.

You can install the AWS CLI by following the prompts for your specific OS below.
&nbsp;  
### Linux

Download the package as a compressed file - currently comes as a `.zip` extension and unpack the contents to an `aws` directory.
```shell
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip
```

For users with ARM-based OS, you have to substitute the curl request above, for the one below.
```shell
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
```

Install by running the install executable file
```shell
sudo ./aws/install
```
&nbsp;  
### macOS

Download and install using `curl` command
```shell
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
```

Install using the command below - this installs the AWS CLI package to your root directory
```shell
sudo installer -pkg ./AWSCLIV2.pkg -target /
```

&nbsp;
### Windows

Download and execute using the command
```shell
 msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
```

&nbsp;  
### AWS CLI Version

After the installation has been completed, you can verify that it was done correctly by running the command `aws --version`. This will display an output of the current AWS CLI and its dependencies.

```shell
aws --version
``` 
![AWS CLI version](https://cdn.hashnode.com/res/hashnode/image/upload/v1674811090095/8abcba6c-4f7b-483a-bb1c-fb84cc668b08.png)
&nbsp;  
### Configure AWS CLI with Access Keys

You will now configure your AWS CLI with the access keys in Step 1. To do this you have to run the command `aws configure --profile serverless-apps` Place the respective keys when prompted by the CLI. You can allow the default entry for Default region name and format.

&nbsp;  

> You should never share your access keys. You can quickly delete access keys that you think have been compromised in the Access Keys section and create a new one

&nbsp;  

![AWS CLI profile configuration](https://cdn.hashnode.com/res/hashnode/image/upload/v1674919514212/6269bce0-928e-45de-bdf2-e22fd80c2ee6.png)

&nbsp;  
## Step 3: Node.js

Node.js is a runtime environment for executing JavaScript and TypeScript languages. You will be writing your applications in JavaScript or TypeScript therefore you have to download and install Node.js runtime. To download Node.js, I recommend downloading via NVM.

&nbsp;
### NVM

NVM is short for Node Version Manager. It is a tool that manages different versions of the Node.js runtime. With NVM, you can switch between versions of Node.js when necessary. For example, if Project A requires Node.js 14 and Project B requires Node.js 16, with NVM, you simply need to issue the command `nvm use <version>` to switch between Node.js versions for different projects seamlessly. See the commands below to download NVM.
&nbsp;  
### Installing NVM

```shell
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
```

OR

```shell
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
```

When either of the commands above is run via the Command Line, it downloads and runs a script that clones the nvm repository to a `.nvm` folder and thereafter attempts to add the line of code below to one of the profile files: [`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`]
&nbsp;  
### Profile file

```shell
export NVM_DIR="$([-z "${XDG_CONFIG_HOME-}"] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[-s "$NVM_DIR/nvm.sh"] && \. "$NVM_DIR/nvm.sh" # This loads nvm
```

After that is done and you have verified that the file was updated, you should close the Command Line and launch it. This is a way to get NVM to startup with its config. To verify that it was successfully done, you should enter the command `nvm --version` which will return the current version of NVM installed. I have included a snapshot of this command and the output. Ensure you have the same version number or higher.

&nbsp;  
### NVM Version
```shell
nvm --version
```
![nvm version command and output](https://cdn.hashnode.com/res/hashnode/image/upload/v1674571461900/0eeeb912-4aa4-495b-9818-da2ca40be113.png)

If you face any issues with this installation, please refer to [NVM README](https://github.com/nvm-sh/nvm#installing-and-updating) on Github.

&nbsp;  
### Installing Node.js

After you're done installing NVM, you can then install Node.js via NPM. You can do so using the command below.

```shell
nvm install --lts
```

With this command, the NVM that's currently installed goes to work by downloading and installing the latest Node.js LTS (Long Term Support) version to your computer. After this is done, you can as well, run a command to ensure you have Node.js installed. This is done via the command `node --version`

&nbsp;  
### Node.js Version

```shell
node --version
```

After issuing this command you should get an output that tells you the current version of Node.js installed on your computer.

![node version command and output](https://cdn.hashnode.com/res/hashnode/image/upload/v1674573508076/4450c90f-cfa9-4c3d-ad4a-c9ff40b7ca5f.png)

&nbsp;  
## Step 4: Serverless Framework

Serverless Framework helps you build, deploy and manage Lambda functions easily which in turn makes up your serverless application. To get started building a serverless application, you need to install this framework which is easily done by running `npm install -g serverless`.
&nbsp;  
### Installing Serverless Framework

```
npm install -g serverless
```

To verify you have correctly installed the Serverless Framework, you should be able to successfully run the `serverless --version` or `sls -v` command. The output you get should be similar to the snapshot below on successful installation.
&nbsp;  
```shell
serverless --version
```&nbsp;  
### Serverless Version

![serverless framework version output](https://cdn.hashnode.com/res/hashnode/image/upload/v1674650636148/b51e120c-a035-4425-98bb-22c8fb440567.png)

With this, you have successfully installed the Serverless Framework. You can now start creating serverless applications using the Serverless Framework.
&nbsp;  
## Code Editor

In developing serverless applications, you will be writing code. To aid in this writing, you need a code editor. A code editor is simply a text editor that's made specifically for authoring code. Many code editors support working with the Serverless Framework. Below is a list of some of the very popular ones you can choose from.

- [VS Code](https://code.visualstudio.com/download) - Free

- [Sublime Text](https://www.sublimetext.com/3) - Free/Paid

- [Jetbrains Webstorm](https://www.jetbrains.com/webstorm/download/) - Paid

- [Jetbrains Fleet](https://www.jetbrains.com/fleet/) - Free

- [Notepad++](https://notepad-plus-plus.org/downloads/) - Free

- [Bracket](https://brackets.io) - Free

Select the one you are most comfortable with, paid or free and get cracking!
&nbsp;  
## Conclusion

Congratulations! on getting to the end of this guide. Hopefully, you got similar prompts when verifying that you correctly installed any of the tools. There may be version number differences but that's perfect; it's proof you have a better version than I had when writing this article. You are now ready to get busy, developing those great serverless apps.

Happy serverless coding!