AWS Lambda functions for octochat.
- Sign up for AWS Lambda
- Install and configure the
awscommand-line client - Run
script/bootstrap
Sign up for AWS here.
The Lambda free tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month.
To install the aws command-line client use pip:
pip install awscli --upgrade --user
To configure aws, follow these quick configuration steps.
Once configured, you should see config and credentials files in ~/.aws.
script/bootstrap
script/pack_lambda .
script/push_lambda message_add package.zip
script/push_lambda messages_received_list package.zip
script/push_lambda messages_sent_list package.zipThis will:
- Ensure the Lambda function role is created, with the correct policy attached
- Create the DynamoDB table
- Package the Lambda function and all its dependencies
- Create the Lambda functions,
message_add,messages_received_list, andmessages_sent_liston AWS
To send a message:
script/exec_lambda message_add '{"toId": 2993937, "to": "imjohnbo", "fromId": 27806, "from": "swinton", "message": "Hello, John, how are you?"}'To list the 50 most recently received messages:
script/exec_lambda messages_received_list '{"toId": 2993937}'To list the 50 most recently sent messages:
script/exec_lambda messages_sent_list '{"fromId": 27806}'