@awsless/ssm
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

npm version npm version license

Helper functions to fetch parameters from AWS SSM Parameter Store & easily mock the SSM client.

Basic usage

Example

import { ssm } from "@awsless/ssm";

const config = await ssm({
	secret: '/your-ssm-secret-path'
})

console.log(config.secret)

Typed values:

import { string, float, integer, array, json } from "@awsless/ssm";
import { ssm, integer, json } from "@awsless/ssm";

type JsonStruct = {
	username: string
	password: string
}

const config = await ssm({
	val1: integer('/path-to-int-value'),
	val2: json<JsonStruct>('/path-to-json-value')
})

Expiring cache values

import { ssm } from "@awsless/ssm";

const config = await ssm({
	secret: '/your-ssm-secret-path'
}, { ttl: 60 })

Mock the SSM Client

import { ssm, mockSSM } from '@awsless/ssm'

const mock = mockSSM({
	'/path': 'Hi',
})

it('should resolve ssm paths', async () => {
	const result = await ssm({
		value: '/path',
	})

	expect(result).toStrictEqual({
		value: 'Hi',
	})
})

Readme

Keywords

none

Package Sidebar

Install

npm i @awsless/ssm

Weekly Downloads

36

Version

0.0.7

License

MIT

Unpacked Size

19.4 kB

Total Files

6

Last publish

Collaborators

  • micmonen
  • ivands