create_function: Manage AWS Lambda Functions

Description Usage Arguments Details Value References See Also Examples

View source: R/create_function.R

Description

Create, update, and version AWS Lambda functions

Usage

1
2
3
4
5
6
7
8
9
create_function(name, description = name, func, handler, role,
  runtime = c("nodejs6.10", "nodejs4.3", "java8", "python2.7",
  "dotnetcore1.0", "nodejs4.3-edge"), timeout = 3L, ...)

update_function(name, func, description, handler, role,
  runtime = c("nodejs6.10", "nodejs4.3", "java8", "python2.7",
  "dotnetcore1.0", "nodejs4.3-edge"), timeout = 3L, ...)

make_function_version(name, description, ...)

Arguments

name

A character string specifying the function name (either a full ARN or a max 64-character string). For functions other than create_function this can also be an object of class “aws_lambda_function”.

description

Optionally, a max 256-character description of the function for your own use.

func

Either (1) a character string containing a url-style AWS S3 bucket and object key (e.g., "s3://bucketname/objectkey") where the object is the .zip file containing the AWS Lambda deployment package; (2) a file string pointing to a .zip containing the deployment package; or (3) a single file (e.g., a javascript file) that will be zipped and used as the deployment. The third option is merely a convenience for very simple deployment packages.

handler

A character string specifying the function within your code that Lambda calls to begin execution.

role

A character string containing an IAM role or an object of class “iam_role”. This is the role that is used when the function is invoked, so it must have permissions over any AWS resources needed by the function.

runtime

A character string specifying the runtime environment for the function.

timeout

An integer specifying the timeout for the function, in seconds.

...

Additional arguments passed to lambdaHTTP.

Details

create_function creates a new function from a deployment package. update_function can, separately, update the code within a function or the configuration settings thereof. make_function_version records a function version (see list_function_versions; changes made between versioning are not recorded.

Value

A list of class “aws_lambda_function”.

References

API Reference: CreateFunction API Reference: UpdateFunction API Reference: PublishFunction

See Also

invoke_function, create_function_alias, list_functions, delete_function

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## 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"]]
  role <- paste0("arn:aws:iam::", id, ":role/lambda_basic_execution")

  func <- create_function("helloworld", func = hello, 
                          handler = "helloworld.handler", 
                          role = role)
  
  # invoke function
  invoke_function(func)

  # delete function
  delete_function(func)

## End(Not run)

cloudyr/aws.lambda documentation built on Jan. 14, 2020, 4:57 a.m.