This file contains 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 urllib.parse | |
import boto3 | |
print('Loading function') | |
s3 = boto3.client('s3') | |
def lambda_handler(event, context): | |
#1 - Get the bucket name |
This file contains 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 | |
print('Loading function') | |
def lambda_handler(event, context): | |
print('------------------------') | |
print(event) | |
#1. Iterate over each record | |
try: | |
for record in event['Records']: |
This file contains 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 | |
print('Loading function') | |
def lambda_handler(event, context): | |
#1. Parse out query string params | |
transactionId = event['queryStringParameters']['transactionId'] | |
transactionType = event['queryStringParameters']['type'] | |
transactionAmount = event['queryStringParameters']['amount'] |
This file contains 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
{ | |
"Comment": "A simple AWS Step Functions state machine that automates a call center support session.", | |
"StartAt": "ProcessTransaction", | |
"States": { | |
"ProcessTransaction": { | |
"Type" : "Choice", | |
"Choices": [ | |
{ | |
"Variable": "$.TransactionType", | |
"StringEquals": "PURCHASE", |
This file contains 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
from __future__ import print_function | |
import json | |
import urllib | |
import boto3 | |
import datetime | |
print('Loading message function...') | |
def process_refund(message, context): |
This file contains 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
{ | |
"Comment":"Transaction Processor State Machine Using SQS", | |
"StartAt":"ProcessTransaction", | |
"States":{ | |
"ProcessTransaction":{ | |
"Type":"Pass", | |
"Next":"BroadcastToSqs" | |
}, | |
"BroadcastToSqs":{ | |
"Type":"Task", |
This file contains 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
{ | |
"Comment":"Transaction Processor State Machine Using SNS", | |
"StartAt":"ProcessTransaction", | |
"States":{ | |
"ProcessTransaction":{ | |
"Type":"Pass", | |
"Next":"BroadcastToSns" | |
}, | |
"BroadcastToSns":{ | |
"Type":"Task", |
This file contains 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
#Talk python to me | |
import json | |
import boto3 | |
s3 = boto3.client('s3') | |
def lambda_handler(event, context): | |
bucket = 'aws-simplified-transactions' | |
key = 'transactions.json' |
This file contains 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
S3 PutObject Role | |
--- | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": "s3:PutObject", | |
"Resource": "*" |
This file contains 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 | |
from boto3.dynamodb.conditions import Key | |
def lambda_handler(event, context): | |
client = boto3.resource('dynamodb') | |
table = client.Table('Transactions') | |
#1. Example - Get Item By Id |
OlderNewer