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
{ | |
"Comment": "A description of my state machine", | |
"StartAt": "Add Order Entry", | |
"States": { | |
"Add Order Entry": { | |
"Type": "Task", | |
"Resource": "arn:aws:states:::dynamodb:putItem", | |
"Parameters": { | |
"TableName": "CustomerOrdersTable", | |
"Item": { |
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
IAM Policy | |
--- | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"rds-db:connect" | |
], |
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
{ | |
"Effect":"Allow", | |
"Principal":{ | |
"AWS":"<SUBSCRIBER_ACCOUNT_ID>" | |
}, | |
"Action":"sns:Subscribe", | |
"Resource":"arn:aws:sns:<REGION>:<PUBLISHER_ACCOUNT_ID>:<TOPIC_NAME>" | |
} |
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
Pre-Reqs | |
--- | |
1) CDK | |
2) NPM | |
3) A Github repository | |
1. Run this command | |
export CDK_NEW_BOOTSTRAP=1 | |
npx cdk bootstrap aws://<YOUR_ACCONT_ID>/<YOUR_REGION> --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://<YOUR_ACCONT_ID>/<YOUR_REGION> |
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
# aws s3api get-object --bucket arn:aws:s3-object-lambda:us-east-1:xxxxx:accesspoint/just-purchases --key orders.json transformed_data.json | |
import boto3 | |
import urllib3 | |
import json | |
http = urllib3.PoolManager() | |
def lambda_handler(event, context): | |
print(event) |
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
lambda function | |
---- | |
exports.handler = async (event) => { | |
console.log(event) | |
const customerId = event.pathParameters.customerId; | |
const customer = {'customerId': customerId, 'customerName': "Customer " + customerId }; | |
const response = { | |
statusCode: 200, | |
// Uncomment below to enable CORS requests | |
headers: { |
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": [ | |
{ | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "execute-api:Invoke", | |
"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
Connect & Disconnect | |
--- | |
import json | |
def lambda_handler(event, context): | |
print(event) | |
print("****") | |
print(context) | |
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 | |
firehose_client = boto3.client('firehose') | |
def lambda_handler(event, context): | |
resultString = "" | |
for record in event['Records']: |
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": [ | |
"cloudformation:DescribeStacks", | |
"cloudformation:CreateChangeSet", | |
"cloudformation:DescribeChangeSet", |