Skip to content

Instantly share code, notes, and snippets.

View yai333's full-sized avatar

Yi Ai yai333

  • Melbourne
View GitHub Profile
Resources:
AppSyncLambdaServiceRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: "${self:custom.appSync.serviceRole}-${self:provider.stage}"
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal:
@yai333
yai333 / rds.yml
Last active March 27, 2019 05:57
Resources:
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
InstanceTenancy: default
PublicSubnet:
Type: AWS::EC2::Subnet
Properties:
"use strict";
const AWS = require("aws-sdk");
const Sequelize = require("sequelize");
//connect to rds aurora
const sequelize = new Sequelize(
process.env.DATABASE_NAME,
process.env.DATABASE_USERNAME,
process.env.DATABASE_PASSWORD,
{
input PostInput {
title: String
content: String
notificationEmails: String
createdAt: String
}
type Mutation {
addPost(post: PostInput!): Post
deletePost(id: Int!): Post
input PostInput {
title: String
content: String
}
type Mutation {
addPost(post: PostInput!): Post
}
type Post {
custom:
poolName: ${self:provider.stage}SimpleCMS
dbName: "simpleCMS"
daxIamRole: ${self:service.name}DaxIamRole
postsTable: ${self:provider.stage}Posts
systemUserEmail: "yi.ai@neami.app"
daxClusterName: "myDynamodbDax"
tableThroughput: 5
appSync:
region: ${self:provider.region}
DaxIamRole:
Type: AWS::IAM::Role
Properties:
RoleName: ${self:service.name}dax
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal:
Service:
"use strict";
const AWS = require("aws-sdk");
const uuidv4 = require("uuid/v4");
const AmazonDaxClient = require("amazon-dax-client");
const dax = new AmazonDaxClient({
endpoints: process.env.DAX_ENDPOINT,
region: process.env.AWS_DEFAULT_REGION
});
const documentClient = new AWS.DynamoDB.DocumentClient({ service: dax });
custom:
appSync:
mappingTemplates:
- type: Mutation
dataSource: AWSSES
field: sendNotification
request: Mutation-sendNotification-request.vtl
response: Mutation-sendNotification-response.vtl
dataSources:
- type: HTTP
Resources:
AppSyncSESserviceRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: ${self:custom.appSync.serviceRole}-appsync-ses
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal: