{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
aws iam create-role
--role-name basic-lambda-role
--assume-role-policy-document file://policy.json
(주의: 줄바꿈(개행) 안먹힘. 가독성 위해 줄바꿈 삽입)
zip -r lb-test.zip index.js
aws lambda create-function --region ap-northeast-2 --function-name lb-test --zip-file fileb://lb-test.zip --role arn:aws:iam::************:role/basic-lambda-role --handler index.handler --runtime nodejs4.3 --memory-size 128
aws lambda list-functions --profile **** > lambda-functions.txt
(주의 : aws account 가 여러개일 경우 --profile {aws ID 입력})
aws lambda invoke --invocation-type RequestResponse --function-name lb-test --region ap-northeast-2 --log-type Tail --payload '{"username": "seokje"}' output.txt