# NOT RUN {
# 'hello world!' example code
hello <- system.file("templates", "helloworld.js", package = "aws.lambda")
# get IAM role for Lambda execution
library("aws.iam")
id <- get_caller_identity()[["Account"]]
# Note: This role may not work. We recommend copying the ARN of a
# Lambda-capable role from the console once until we're able to more
# smoothly integrate with aws.iam.
role <- paste0("arn:aws:iam::", id, ":role/lambda_basic_execution")
lambda_func <- create_function("helloworld",
func = hello,
handler = "helloworld.handler",
role = role
)
# invoke function
invoke_function(lambda_func)
# delete function
delete_function(lambda_func)
# }
Run the code above in your browser using DataLab