This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const | |
moment = require('moment'); | |
module.exports.helloWorld = (event, context, callback) => { | |
const response = { | |
statusCode: 200, | |
headers: { | |
'Access-Control-Allow-Origin': '*', // Required for CORS support to work | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Serverless: Packaging service... | |
Serverless: Excluding development dependencies... | |
Serverless: Excluding development dependencies... | |
Serverless: Uploading CloudFormation file to S3... | |
Serverless: Uploading artifacts... | |
Serverless: Uploading service .zip file to S3 (1.07 KB)... | |
Serverless: Uploading service .zip file to S3 (839 KB)... | |
Serverless: Validating template... | |
Serverless: Updating Stack... | |
Serverless: Checking Stack update progress... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: serverless-layers | |
# The `provider` block defines where your service will be deployed | |
provider: | |
name: aws | |
runtime: nodejs8.10 | |
environment: | |
NODE_PATH: "./:/opt/node_modules" | |
# layers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: serverless-layers | |
# The `provider` block defines where your service will be deployed | |
provider: | |
name: aws | |
runtime: nodejs8.10 | |
# The `functions` block defines what code to deploy | |
functions: | |
helloWorld: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports.helloWorld = (event, context, callback) => { | |
const response = { | |
statusCode: 200, | |
headers: { | |
'Access-Control-Allow-Origin': '*', | |
}, | |
body: JSON.stringify({ | |
message: `Hello World` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "moment-layer", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = async (event) => { | |
const day = new Date().toDateString().substr(0,3); | |
const checkDay = 'Fri'; | |
const dayLen = 24 * 60 * 60 * 1000; | |
const weekDays = [ | |
new Date().toDateString().substr(0,3), | |
new Date(new Date().getTime() + (1 * dayLen)).toDateString().substr(0,3), | |
new Date(new Date().getTime() + (2 * dayLen)).toDateString().substr(0,3), | |
new Date(new Date().getTime() + (3 * dayLen)).toDateString().substr(0,3), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"StartAt": "CheckDay", | |
"States": { | |
"CheckDay": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:XXXXXXXXXX:XXXXXXXXXX:function:XXXXXXXX", | |
"Next": "IsItFriday" | |
}, | |
"IsItFriday": { | |
"Type": "Choice", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
AWS = require('aws-sdk'), | |
{ Readable } = require('readable-stream'); | |
const s3 = new AWS.S3({ | |
region: 'ap-northeast-2' | |
}); | |
s3SelectQuery = (query) => { | |
return new Promise((resolve, reject) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
aws = require("aws-sdk"), | |
AthenaExpress = require("athena-express"); | |
const awsCredentials = { | |
region: "ap-northeast-2" | |
}; | |
aws.config.update(awsCredentials); | |
const athenaExpressConfig = { aws }; |