This file contains hidden or 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
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html | |
#呼び出されるLambda(関数名:sample-lambda) | |
# Roleに必要なPolicy | |
# ・AWSLambdaBasicExecutionRole | |
def lambda_handler(event, context): | |
return {'test':'test'} | |
# 呼び出すLambda | |
# Roleに必要なPolicy |
This file contains hidden or 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
-module(greet). | |
-export([main/0]). | |
main() -> | |
greeting("Hi", "World"), | |
greeting("hoge", "hogeeee"). | |
greeting("Hi", Name) -> io:format("Hello!, ~p~n", [Name]); | |
greeting(H, Name) -> io:format("~p!, ~p~n", [H,Name]). |
This file contains hidden or 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
defmodule TestCode do | |
def hello() do | |
a = [foo: "bar", hello: "world", hello: "test"] | |
m = %{:foo => "hoge", "hoge" => "bar"} | |
IO.inspect a | |
IO.inspect m[m.foo] | |
m2 = %{m | :foo => "hhhh"} | |
IO.inspect m.foo | |
IO.inspect m2.foo | |
This file contains hidden or 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
//API実行用関数(POST) | |
function fetchUrlPost(URL, request, requestHeaders) { | |
return new Promise(function(resolve, reject) { | |
fetch(URL, { | |
mode: 'cors', | |
method: 'POST', | |
body: JSON.stringify(request), | |
headers: requestHeaders | |
}).then(response => { | |
console.log("HTTP STATUS :" + String(response.status)); |
This file contains hidden or 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
https://docs.aws.amazon.com/ja_jp/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-permissions.html | |
ポリシー | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", |
This file contains hidden or 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
# 使用するIAMロールに設定するポリシー | |
# AmazonAthenaFullAccess | |
# AmazonS3ReadOnlyAccess | |
# AWSLambdaExecute | |
# | |
# 環境変数 | |
# S3_BUCKET_NAME 例:bucket-name | |
# S3_BUCKET_PREFIX 例:dir_1/dir_2 | |
# RESULT_OUTPUT_S3_DIR 例:s3://aws-athena-query-results-**************-ap-northeast-1/ | |
# TARGET_DB 例:test_db |
This file contains hidden or 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
# 使用するIAMロールに設定するポリシー | |
# AmazonAthenaFullAccess | |
# AmazonS3ReadOnlyAccess | |
# AWSLambdaExecute | |
# | |
# 環境変数 | |
# RESULT_OUTPUT_S3_DIR 例:s3://aws-athena-query-results-**************-ap-northeast-1/ | |
# TARGET_DB 例:test_db | |
# TARGET_TABLE 例:test_table | |
# TARGET_LOCATION 例:s3://bucket-name/dir_1/dir_2 |
This file contains hidden or 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
import datetime | |
from dateutil.relativedelta import relativedelta | |
def build_target_date_list(): | |
start_date = '2017/01/01'.split('/') | |
target_date = datetime.date( | |
int(start_date[0]), | |
int(start_date[1]), | |
int(start_date[2]) | |
) |
This file contains hidden or 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
# 使用するIAMロールに設定するポリシー | |
# AmazonAthenaFullAccess | |
# AmazonS3ReadOnlyAccess もしかしたらいらないかも | |
# AWSLambdaExecute | |
# | |
# 環境変数 | |
# RESULT_OUTPUT_S3_DIR 例:s3://aws-athena-query-results-**************-ap-northeast-1/ | |
# TARGET_DB 例:test_db | |
# TARGET_TABLE 例:test_table | |
# TARGET_LOCATION 例:s3://bucket-name/dir_1/dir_2 |
This file contains hidden or 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
SHOW GLOBAL VARIABLES like 'max_connections'; | |
SHOW STATUS like 'Threads_connected'; |