Skip to content

Commit

Permalink
Merge pull request #82 from nideveloper/master
Browse files Browse the repository at this point in the history
update readme to show deploying with cdk
  • Loading branch information
alexcasalboni committed May 11, 2020
2 parents 0e1b0a3 + c84bf3a commit 03ae45a
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,50 @@ You can finally deploy the serverless app:
$ bash scripts/deploy.sh
```

## How to deploy the state machine (AWS CDK)

First, [install AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html) and [configure your AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration):

```bash
$ pip install aws-sam-cli
$ aws configure
```

If you already have a CDK project you can include the following to use the [sam module](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-sam-readme.html):

```typescript
import sam = require('@aws-cdk/aws-sam');

new sam.CfnApplication(this, 'powerTuner', {
location: {
applicationId: 'arn:aws:serverlessrepo:us-east-1:451282441545:applications/aws-lambda-power-tuning',
semanticVersion: '3.2.4'
},
parameters: {
"lambdaResource": "*",
"PowerValues": "128,256,512,1024,1536,3008"
}
})
```

Alternatively you can use [CDK Patterns](https://github.com/cdk-patterns/serverless) to give you a pre configured project in either TypeScript or Python:

```bash
# For the TypeScript CDK version
npx cdkp init the-lambda-power-tuner

# or for the Python CDK version
npx cdkp init the-lambda-power-tuner --lang=python
```

To deploy the TypeScript version you just need to:

```bash
cd the-lambda-power-tuner
npm run deploy
```

For Python deployment, see the instructions [here](https://github.com/cdk-patterns/serverless#2-download-pattern-in-python-or-typescript-cdk)

## How to execute the state machine (programmatically)

Expand Down

0 comments on commit 03ae45a

Please sign in to comment.