Skip to content

Instantly share code, notes, and snippets.

@ppshein
ppshein / AppSyncAPI.yaml
Created January 17, 2020 09:18 — forked from adrianhall/AppSyncAPI.yaml
A CloudFormation template for DynamoDB + Cognito User Pool + AppSync API for the Notes tutorial
---
Description: AWS AppSync Notes API
Parameters:
APIName:
Type: String
Description: Name of the API - used to generate unique names for resources
MinLength: 3
MaxLength: 20
AllowedPattern: '^[a-zA-Z][a-zA-Z0-9_]*$'
@ppshein
ppshein / index.js
Created January 31, 2020 10:25
Check index whether exist or not then if not yet exist, create Index and Save document.
const elasticsearch = require('elasticsearch');
const esClient = new elasticsearch.Client({
host: process.env.ES_ENDPOINT,
apiVersion: "7.1",
});
exports.handler = async (event, context, callback) => {
const indexName = 'notifications';
const id = event.input.id;
const documents = event.input;
@ppshein
ppshein / Simple-S3Bucket-SNS
Created February 22, 2020 08:30 — forked from austoonz/Simple-S3Bucket-SNS
A CloudFormation template sample for creating an S3 Bucket with an SNS Trigger.
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Simple S3 Bucket with SNS Trigger
Parameters:
BucketName:
Type: String
Description: The name of the S3 Bucket to create
@ppshein
ppshein / list.txt
Created February 23, 2020 14:29 — forked from shortjared/list.txt
List of AWS Service Principals
acm.amazonaws.com
alexa-appkit.amazon.com
apigateway.amazonaws.com
application-autoscaling.amazonaws.com
appstream.application-autoscaling.amazonaws.com
appsync.amazonaws.com
athena.amazonaws.com
autoscaling.amazonaws.com
batch.amazonaws.com
channels.lex.amazonaws.com
@ppshein
ppshein / example-api-gateway.yaml
Created February 28, 2020 03:25 — forked from elerch/example-api-gateway.yaml
YAML version of tmaslen's API Gateway cloudformation template - useful when you don't want to use SAM
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Sample template that contains a Lambda function behind an API GW
Resources:
# BEGIN: Should only need this in an empty API Gateway situation
ApiGatewayCloudWatchLogsRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
const AWS = require("aws-sdk");
const s3 = new AWS.S3({ apiVersion: "2006-03-01" });
const fs = require("fs");
AWS.config.update({
accessKeyId: "",
secretAccessKey: "",
region: "ap-southeast-1",
Bucket: "mobile-ayaplus-backend-dev",
})
@ppshein
ppshein / docker-compose.yml
Created May 3, 2020 13:18 — forked from pantsel/docker-compose.yml
example docker-compose.yml for kong, postgres and konga
version: "3"
networks:
kong-net:
driver: bridge
services:
#######################################
# Postgres: The database used by Kong
@ppshein
ppshein / buckets.tf
Last active May 27, 2020 13:20 — forked from nagelflorian/buckets.tf
Terraform config for static website hosting on AWS
# AWS S3 bucket for static hosting
resource "aws_s3_bucket" "website" {
bucket = "${var.website_bucket_name}"
acl = "public-read"
tags {
Name = "Website"
Environment = "production"
}
resource "aws_iam_role" "firehose_role" {
name = "firehose_es_delivery_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
variable "resources" {
description = "My Dashboard"
type = list(object({
bu = string
title = string
query = list(string)
}))
}