Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠

Pyae Phyoe Shein ppshein

🤠
View GitHub Profile
View api_gateway_to_sqs.md

Terraforming API Gateway to SQS queue

Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.

SQS

Start by creating the SQS queue.

resource "aws_sqs_queue" "queue" {
View sample.tfvars
resources = [{
bu = "netflix"
title = ["title_1", "title_2", "title_3", "title_4", "title_5", "title_6"]
query = ["SELECT max(provider.currItems.Maximum) FROM DatastoreSample as 'Cache Items' FROM DatastoreSample WHERE provider='ElastiCacheRedisNode' AND providerAccountName = 'xxx' AND displayName LIKE '${widget_line.value}%' TIMESERIES AUTO FACET displayName", "query_2", "query_3", "query_4", "query_5", "query_6"]
}, {
bu = "apple"
title = ["title_1", "title_2", "title_3", "title_4", "title_5", "title_6"]
query = ["query_1", "query_2", "query_3", "query_4", "query_5", "query_6"]
}, {
bu = "youtube"
View variables.tf
variable "resources" {
description = "My Dashboard"
type = list(object({
bu = string
title = string
query = list(string)
}))
}
View main.tf
resource "newrelic_one_dashboard" "this" {
name = var.dashboard_name
permissions = "public_read_only"
# To create TABS in dashboard
dynamic "page" {
for_each = var.resources
content {
# To display TABS name in dashboard
name = page.value["bu"]
# To create graph in dashboard
View firehose.tf
resource "aws_iam_role" "firehose_role" {
name = "firehose_es_delivery_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
@ppshein
ppshein / docker-compose.yml
Created May 3, 2020 — forked from pantsel/docker-compose.yml
example docker-compose.yml for kong, postgres and konga
View docker-compose.yml
version: "3"
networks:
kong-net:
driver: bridge
services:
#######################################
# Postgres: The database used by Kong
View aws-s3-upload.js
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 / serverless.yml
Created Mar 3, 2020
Sample serverless.yml file to deploy nodejs application to AWS Lambda and API Gateway
View serverless.yml
service: my-nodejs-api
custom:
customDomain:
domainName: api.ppshein.com
basePath: ''
stage: ${self:provider.stage}
createRoute53Record: true
provider:
name: aws
runtime: nodejs8.10
@ppshein
ppshein / example-api-gateway.yaml
Created Feb 28, 2020 — 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
View example-api-gateway.yaml
---
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'
@ppshein
ppshein / list.txt
Created Feb 23, 2020 — forked from shortjared/list.txt
List of AWS Service Principals
View list.txt
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