Skip to content

Instantly share code, notes, and snippets.

MyFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.8
CodeUri: ./src/my_function
Handler: index.lambda_handler
Events:
TableChanges:
Type: EventBridgeRule
Properties:
MyTable:
Type: AWS::DynamoDB::Table
Properties:
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
- AttributeName: sk
AttributeType: S
- AttributeName: gsi1_pk
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
HttpApi:
Type: AWS::Serverless::HttpApi
Properties:
StageName: prod
DefinitionBody:
@brysontyrrell
brysontyrrell / s3tester.py
Created April 1, 2021 14:18
Code used for a Lambda function testing S3 object read speeds.
import hashlib
import time
import boto3
s3 = boto3.resource("s3")
BUCKET = "my-bucket"
KEYS = [
"test100mb.file",
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: Creates an API Gateway to publish data to a SQS queue.
Resources:
ApiQueue:
Type: AWS::SQS::Queue
ApiRole:
AWSTemplateFormatVersion: 2010-09-09
# This can only be deployed once per account.
Resources:
GitHubOIDC:
Type: AWS::IAM::OIDCProvider
Properties:
Url: https://token.actions.githubusercontent.com
ClientIdList:
AWSTemplateFormatVersion: 2010-09-09
# See https://github.com/aws-actions/configure-aws-credentials#sample-iam-role-cloudformation-template
Parameters:
GitHubOrg:
Type: String
RepositoryName:
Type: String
AWSTemplateFormatVersion: 2010-09-09
Parameters:
DomainName:
Type: String
AllowedPattern: "^[a-z][a-z0-9-]{0,48}[a-z0-9]$"
RepositoryName:
Type: String
AWSTemplateFormatVersion: 2010-09-09
# See https://github.com/aws-actions/configure-aws-credentials#sample-iam-role-cloudformation-template
Parameters:
GitHubOrg:
Type: String
RepositoryName:
Type: String
name: Publish Package
on:
push:
branches:
- main
jobs:
publish: