Skip to content

Instantly share code, notes, and snippets.

View georgmao's full-sized avatar

AWSGeorge georgmao

View GitHub Profile
@georgmao
georgmao / promise.js
Last active October 25, 2017 15:15
AWS Promise Example
'use strict'
var AWS = require("aws-sdk");
var https = require('https');
var uuid = require ("uuid");
AWS.config.update({
region: "us-west-2"
});
---
swagger: "2.0"
info:
version: "2017-12-20T14:48:08Z"
title: "swaggerMergeDemo"
host: "jdy6k2gmn1.execute-api.us-west-2.amazonaws.com"
basePath: "/test"
schemes:
- "https"
paths:
@georgmao
georgmao / team1.yaml
Created December 21, 2017 20:44
team1
---
swagger: "2.0"
info:
version: "2017-12-20T14:48:08Z"
title: "swaggerMergeDemo"
host: "jdy6k2gmn1.execute-api.us-west-2.amazonaws.com"
basePath: "/test"
schemes:
- "https"
paths:
---
swagger: "2.0"
info:
version: "2017-12-20T14:48:08Z"
title: "swaggerMergeDemo"
host: "jdy6k2gmn1.execute-api.us-west-2.amazonaws.com"
basePath: "/test"
schemes:
- "https"
paths:
@georgmao
georgmao / team1.json
Last active December 21, 2017 21:22
IAM Permissions for Team1
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"apigateway:GET"
],
"Resource": [
"arn:aws:apigateway:*::/*",
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"apigateway:GET"
],
"Resource": [
"arn:aws:apigateway:*::/*",
@georgmao
georgmao / lambda.txt
Last active January 21, 2020 15:04
Dynamic Swagger Example
LambdaFunction:
Type: AWS::Serverless::Function
Properties:
# Replace <bucket> with your bucket name
CodeUri: s3://<bucket>/srcCode.zip
Handler: index.handler
Runtime: nodejs12.x
x-amazon-apigateway-integration:
responses:
default:
statusCode: 200
# NOTE: ${LambdaFunction} must match the Lambda resourcename
uri:
Fn::Sub: "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations"
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
DefinitionBody:
'Fn::Transform':
Name: 'AWS::Include'
# Replace <bucket> with your bucket name
Parameters:
@georgmao
georgmao / samSecrets.js
Created February 15, 2020 02:20
Sample SAM template using various ways to store secrets
Resources:
ApiFunction:
Type: AWS::Serverless::Function
Properties:
Environment:
Variables:
# this is a standard lambda env var
user: "This is a regular env var"
# this is a var loaded from SSM