Skip to content

Instantly share code, notes, and snippets.

import json
import boto3
import uuid
client = boto3.client('stepfunctions')
def lambda_handler(event, context):
#INPUT -> { "TransactionId": "foo", "Type": "PURCHASE"}
transactionId = str(uuid.uuid1()) #90a0fce-sfhj45-fdsfsjh4-f23f
@djg07
djg07 / policy
Created December 29, 2019 21:41
AWSLambdaBasicExecutionPolicy
---
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
import json
import boto3
client = boto3.client('lambda')
def lambda_handler(event, context):
inputForInvoker = {'CustomerId': '123', 'Amount': 50 }
response = client.invoke(
FunctionName='YOUR LAMBDA ARN',
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"dynamodb:PutItem"
],
"Resource": "*"
import boto3
def lambda_handler(event, context):
client = boto3.resource('dynamodb')
table = client.Table('YOUR TABLE NAME')
# S, N, M, L, B, SS, NS
input = {'TransactionId': '31', 'State': 'PENDING',
'RelatedTransactions': [32, 33, 34],
'CustomerDetails': { 'Name': 'John Doe', 'AccountBalance': 50}}
import boto3
def main():
# 1 - Create Client
ddb = boto3.resource('dynamodb',
endpoint_url='http://localhost:8000',
region_name='dummy',
aws_access_key_id='dummy',
aws_secret_access_key='dummy')
# 2 - Create the Table
ddb.create_table(TableName='Transactions',