Skip to content

Instantly share code, notes, and snippets.

Avatar

em-shea

View GitHub Profile
View IAM policy for example CICD app
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:*",
"lambda:*",
"cloudformation:*",
"sns:CreateTopic",
@em-shea
em-shea / template.yaml
Last active May 12, 2020
An example SAM template for a Lambda function that's invoked by CloudWatch Events
View template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An example SAM template for a Lambda function that's invoked by a CloudWatch Event.
Resources:
MyFunction:
Type: 'AWS::Serverless::Function'
Properties:
FunctionName: MyFunction
Handler: MyFunction.lambda_handler
@em-shea
em-shea / template.yaml
Created May 12, 2020
An example SAM template for a Lambda function invoked by API Gateway
View template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An example SAM template for a Lambda function invoked by API Gateway.
Resources:
MyFunction:
Type: 'AWS::Serverless::Function'
Properties:
FunctionName: MyFunction
Handler: MyFunction.lambda_handler
@em-shea
em-shea / template.yaml
Last active Jun 17, 2020
An example SAM template for a Lambda & API Gateway app that sends messages using SNS
View template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An example SAM template for a Lambda & API Gateway app that sends messages using SNS.
Parameters:
# For any variables you don't want stored in your repo, you can pass them through the SAM deploy command
# Ie, sam deploy .... --parameter-overrides MyEmail=myemail@gmail.com
MyEmail:
Type: String
Resources:
@em-shea
em-shea / template.yaml
Last active May 12, 2020
An example SAM template that creates a DynamoDB table, a Lambda function that writes to DynamoDB, and a CloudWatch Event trigger
View template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An app that includes a DynamoDB table, Lambda function that writes to DynamoDB, and CloudWatch Event trigger
Resources:
LambdaWriteToDynamoDB:
# A function that writes to a DynamoDB table on a schedule
Type: 'AWS::Serverless::Function'
Properties:
FunctionName: LambdaWriteToDynamoDB
@em-shea
em-shea / dynamodb-data-to-s3.py
Last active Jun 17, 2020
A Lambda function that scans a given DynamoDB table and writes the data to S3
View dynamodb-data-to-s3.py
import os
import json
import boto3
from datetime import datetime
# Import resources from Boto3 and specify DynamoDB table to scan from and S3 bucket to write to
# Table and bucket name are passed as environment variables from SAM template
dynamo_client = boto3.resource('dynamodb')
table = boto3.resource('dynamodb').Table(os.environ['TABLE_NAME'])
s3 = boto3.resource('s3')
@em-shea
em-shea / quicksight-manifest.json
Created Apr 15, 2020
An example manifest for QuickSight
View quicksight-manifest.json
{
"fileLocations": [
{
"URIPrefixes": [
"s3://my-bucket-name"
]
}
],
"globalUploadSettings": {
"format": "JSON"
You can’t perform that action at this time.