https://github.com/waelson/serverless-parameter-store
This project show you how to integrate an AWS Lambda along with AWS System Manager. It is based on Serverless Framework using NodeJS template.
https://github.com/waelson/serverless-parameter-store
aws-lambda javascript node nodejs parameter-store serverless-framework ssm
Last synced: 10 months ago
JSON representation
This project show you how to integrate an AWS Lambda along with AWS System Manager. It is based on Serverless Framework using NodeJS template.
- Host: GitHub
- URL: https://github.com/waelson/serverless-parameter-store
- Owner: Waelson
- Created: 2021-05-05T15:32:45.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-06T12:14:05.000Z (almost 5 years ago)
- Last Synced: 2025-02-24T15:21:58.686Z (about 1 year ago)
- Topics: aws-lambda, javascript, node, nodejs, parameter-store, serverless-framework, ssm
- Language: JavaScript
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Description
This project show you how to integrate an AWS Lambda along with AWS System Manager. It's based on Serverless Framework using Node JS template.
---
### Pre Requirements
- You must have an AWS account
- You must have Serverless Framework installed
- You must have IAM permission to write and read in SSM (see policy.json file in the repository)
## Steps
### 1 - Storing parameters
```bash
aws ssm put-parameter --name DB_HOST --value localhost --type String
```
```bash
aws ssm put-parameter --name DB_PORT --value 3306 --type String
```
### 2 - Creating project
```bash
sls create --template aws-nodejs --name
```
### 3 - Setting serverless.yml
```yml
...
custom:
settings:
DB_HOST: ${ssm:DB_HOST}
DB_PORT: ${ssm:DB_PORT}
...
provider:
environment: ${self:custom.settings}
...
```
### 4 - Getting parameters
```javascript
const myDbHost = process.env.DB_HOST
const myDbPort = process.env.DB_PORT
```
### 5 - Deploying project
```bash
sls deploy -v
```
## Notice
All parameters defined in ```custom > setting``` section will be injected as environment variables in the settings of Lambda.