Skip to content

Instantly share code, notes, and snippets.

View bahrmichael's full-sized avatar

Michael Bahr bahrmichael

View GitHub Profile
{
"StartAt": "Get Page Count",
"States": {
"Get Page Count": {
"Type": "Task",
"Resource": "arn:aws:states:::apigateway:invoke",
"Parameters": {
"ApiEndpoint": "xxxxxxxxxx.execute-api.us-east-1.amazonaws.com",
"Method": "HEAD",
"Stage": "prod",
import boto3
from uuid import uuid4
import random
client = boto3.client('s3')
bucket_name = 'my-bucket-name'
categories = ['a', 'b', 'c']
Service GB-month
DynamoDB $0.25
S3 $0.023
Lambda Store $0.15
Service Single Record One Million Records
DynamoDB $0.000000125 $0.125
S3 $0.0000054 $5.4
Lambda Store $0.000004 $4
import boto3
from uuid import uuid4
client = boto3.client('s3')
bucket_name = 'my-bucket-name'
categories = ['easy', 'medium', 'difficult']
for category in categories:
import boto3
from uuid import uuid4
client = boto3.client('s3')
bucket_name = 'my-bucket-name'
# Create 100 records with a random key
for i in range(100):
key = str(uuid4())
import boto3
from uuid import uuid4
from boto3.dynamodb.conditions import Key
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('random-table-categorized')
categories = ['easy', 'medium', 'difficult']
import boto3
from uuid import uuid4
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('random-table')
# Create 100 records with a random partition key
for i in range(100):
item = {'pk': str(uuid4()), 'text': f"{i}"}
table.put_item(Item=item)
{
"Comment": "A Hello World example of the Amazon States Language using Pass states",
"StartAt": "Invoke an API Gateway URL",
"States": {
"Invoke an API Gateway URL": {
"Type": "Task",
"Resource": "arn:aws:states:::apigateway:invoke",
"Parameters": {
"ApiEndpoint": "xxxxxxxxxx.execute-api.us-east-1.amazonaws.com",
"Method": "GET",
{
"Comment": "A Hello World example of the Amazon States Language using Pass states",
"StartAt": "Create pending order",
"States": {
"Create pending order": {
"Type": "Pass",
"Next": "Select Payment Method"
},
"Select Payment Method": {
"Type": "Choice",