This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSLambdaBasicExecutionPolicy | |
--- | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"dynamodb:PutItem" | |
], | |
"Resource": "*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
OlderNewer