Skip to content

Latest commit

History

History
executable file
50 lines (35 loc) 路 1.29 KB

README.rst

File metadata and controls

executable file
50 lines (35 loc) 路 1.29 KB

AWS Jar

Jar makes it easy to save the state of your AWS Lambda functions. The data (either a dict or list) can be saved within the Lambda itself as an environment variable or on S3.

Install

pip install awsjar

Examples

Save state with Jar inside a Lambda environment variable

import awsjar

# Save your data with the Lambda itself, as an Environment Variable.
jar = awsjar.Jar(lambda_name='sams-lambda')
data = {'num_acorns': 50, 'acorn_hideouts': ['tree', 'lake', 'backyard']}
jar.put(data)

state = jar.get()
>> {'num_acorns': 50, 'acorn_hideouts': ['tree', 'lake', 'backyard']}

Save state with Bucket on an S3 bucket

import awsjar

# Save your data to an S3 object - s3://my-bucket/state.json
bkt = awsjar.Bucket(bucket='my-bucket', key='state.json')

data = {'num_acorns': 50, 'acorn_hideouts': ['tree', 'lake', 'backyard']}
bkt.put(data)

state = bkt.get()
>> {'num_acorns': 50, 'acorn_hideouts': ['tree', 'lake', 'backyard']}

Docs

User Guide