Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
*.swp
package-lock.json
__pycache__
.pytest_cache
.env
.venv
*.egg-info
*.js
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
Expand Down
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

33 changes: 11 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
## read-ssm-lambda-layer
Lambda Layer that loads environment variable from AWS Parameter Store with predefined your env variable. (discern as env prefix; like 'AWS_SSM_')
# Welcome to your CDK TypeScript project!

```python
This is a blank project for TypeScript development with CDK.

import os
The `cdk.json` file tells the CDK Toolkit how to execute your app.

# before
# AWS_SSM_DB_PASSWORD=/app/db_password
# AWS_SSM_SECRET_KEY=/app/key
## Useful commands

from ssm import load_parameter_store_with_envs
load_parameter_store_with_envs(prefix='AWS_SSM_')

# after
# AWS_SSM_DB_PASSWORD=/app/db_password
# AWS_SSM_SECRET_KEY=/app/key
# DB_PASSWORD=p@assw0rd!
# SECRET_KEY=S2cr2t_key


def main(event, context):
# in your lambda handler
pass

```
* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `cdk deploy` deploy this stack to your default AWS account/region
* `cdk diff` compare deployed stack with current state
* `cdk synth` emits the synthesized CloudFormation template
cdk bootstrap
14 changes: 0 additions & 14 deletions app.py

This file was deleted.

21 changes: 21 additions & 0 deletions bin/read-ssm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from '@aws-cdk/core';
import { ReadSsmStack } from '../lib/read-ssm-stack';

const app = new cdk.App();
new ReadSsmStack(app, 'ReadSsmStack', {
/* If you don't specify 'env', this stack will be environment-agnostic.
* Account/Region-dependent features and context lookups will not work,
* but a single synthesized template can be deployed anywhere. */

/* Uncomment the next line to specialize this stack for the AWS Account
* and Region that are implied by the current CLI configuration. */
// env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },

/* Uncomment the next line if you know exactly what Account and Region you
* want to deploy the stack to. */
// env: { account: '123456789012', region: 'us-east-1' },

/* For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html */
});
2 changes: 1 addition & 1 deletion cdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"app": "python3 app.py",
"app": "npx ts-node --prefer-ts-exts bin/read-ssm.ts",
"context": {
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
"@aws-cdk/core:enableStackNameDuplicates": "true",
Expand Down
10 changes: 0 additions & 10 deletions example/index.py

This file was deleted.

8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/test'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.tsx?$': 'ts-jest'
}
};
Loading