« Running Locally | Running on AWS Step Functions » |
Running on AWS
Build and Deploy Lambda Function Code
Build .ZIP
Build a .zip file containing you application code. For example, to build the aws-lambda-fsm example applications you can do the following:
$ workon aws-lambda-fsm-workflows
(aws-lambda-fsm)[aws-lambda-fsm-workflows (master)]$ make build
...
adding: yaml/serializer.py (deflated 78%)
adding: yaml/tokens.py (deflated 78%)
If you have written a custom application that brings in aws-lambda-fsm as a module, you will have to ensure that pyyaml and (optionally) python-memcached are included in your .zip file.
Upload to S3
Configure AWS Services
Setup ~/.aws/credentials
$ cat ~/.aws/credentials
# Will expire on 2016-03-02T17:22:44Z
aws_access_key_id = ...
aws_secret_access_key = ...
aws_security_token = ...
aws_session_token = ...
Setup ~/.aws/config
$ cat ~/.aws/config
[default]
region=us-east-1
output=json
Create Kinesis Stream
$ workon aws-lambda-fsm
$ python tools/create_kinesis_stream.py --kinesis_num_shards=##
Create DynamoDB Tables
$ workon aws-lambda-fsm
$ python tools/create_dynamodb_table.py --dynamodb_read_capacity_units=## --dynamodb_write_capacity_units=##
Create Memcache/Redis
TODO:
Create and Configure the Lambda Function
Code
Handler
Configure the Lambda function handler as main.lambda_handler
Event Sources
Configure the Lambda function with three event sources
- Kinesis Stream
- DynamoDB Update
- CloudWatch Timer
IAM
Configure the Lambda function with a role like the following:
Start a State Machine
You can use the start_state_machine.py
script to start machines on AWS as well:
$ workon aws-lambda-fsm-workflows
$ python tools/start_state_machine.py --machine_name=tracer
« Running Locally | Running on AWS Step Functions » |