Skip to content

Latest commit

 

History

History
133 lines (84 loc) · 4.51 KB

README-DEPLOY.md

File metadata and controls

133 lines (84 loc) · 4.51 KB

How to deploy the state machine

There are multiple ways to deploy the project.

If you are familiar with Infrastructure as Code, the easiest way is to deploy the app via the Serverless Application Repository (SAR) - see option 1 and 3.

If you prefer to verify and own the full YAML template, feel free to fork this repo and deploy everything with AWS SAM CLI - see option 2.

If you don't want to deal with CloudFormation or SAR at all, you can use the Lumigo CLI (which will take care of both deployment and execution) or the Lambda Power Tuner UI - see option 4 and 5.

Option 1: AWS Serverless Application Repository

You can find this app in the Serverless Application Repository and deploy it with just a few clicks in the AWS Management Console.

You can also integrate the SAR app in your existing CloudFormation stacks - check scripts/deploy-sar-app.yml and scripts/deploy-sar-app.sh for a sample implementation.

Option 2: fork this repo and deploy with AWS SAM

In case you want to deploy it "manually", you can run scripts/deploy.sh.

The script uses the AWS SAM CLI to create a new CloudFormation stack in your account.

First, install AWS SAM and configure your AWS credentials:

$ pip install aws-sam-cli
$ aws configure

Now, you can clone this repository as follows:

$ git clone https://github.com/alexcasalboni/aws-lambda-power-tuning.git

Configure your deployment bucket name (create one first!) and stack name in the deployment script:

# config
BUCKET_NAME=your-sam-templates-bucket
STACK_NAME=lambda-power-tuning
PowerValues='128,512,1024,1536,3008'

You can finally deploy the serverless app:

$ bash scripts/deploy.sh

Option 3: deploy the SAR app with AWS CDK

First, install AWS CDK and configure your AWS credentials:

$ pip install aws-sam-cli
$ aws configure

If you already have a CDK project you can include the following to use the sam module:

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.4.1'
  },
  parameters: {
    "lambdaResource": "*",
    "PowerValues": "128,256,512,1024,1536,3008"
  }
})

Alternatively you can use CDK Patterns to give you a pre configured project in either TypeScript or Python:

# 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:

cd the-lambda-power-tuner
npm run deploy

For Python deployment, see the instructions here.

Option 4: deploy with the Lumigo CLI

You can install the Lumigo CLI:

$ npm install -g lumigo-cli

And then power-tune your functions as follows:

$ lumigo-cli powertune-lambda <OPTIONS>

For the full documentation of the command parameters:

$ lumigo-cli --help powertune-lambda

(or check it out here).

Option 5: deploy via AWS Lambda Power Tuner UI

You can deploy and interact with Lambda Power Tuning with an ad-hoc web interface. This UI will deploy everything you need to power-tune your functions and also simplify the input/output management for Step Functions via API Gateway.

You can find the open-source project and the instructions to deploy it here: mattymoomoo/aws-power-tuner-ui.

Power Tuner UI

How to execute the state machine once deployed?

See here.