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
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
create_function(
  name,
  func,
  handler,
  role,
  runtime = c("nodejs12.x", "nodejs10.x", "java11", "java8", "python3.8", "python3.7",
    "python3.6", "python2.7", "dotnetcore3.1", "dotnetcore2.1", "go1.x", "ruby2.7",
    "ruby2.5", "provided"),
  timeout = 3L,
  description,
  layers,
  memory_size = 128L,
  ...
)

update_function_code(name, func, ...)

update_function_config(
  name,
  description,
  handler,
  role,
  runtime = c("nodejs12.x", "nodejs10.x", "java11", "java8", "python3.8", "python3.7",
    "python3.6", "python2.7", "dotnetcore3.1", "dotnetcore2.1", "go1.x", "ruby2.7",
    "ruby2.5", "provided"),
  timeout = 3L,
  ...
)

update_function(
  name,
  func,
  description,
  handler,
  role,
  runtime = c("nodejs12.x", "nodejs10.x", "java11", "java8", "python3.8", "python3.7",
    "python3.6", "python2.7", "dotnetcore3.1", "dotnetcore2.1", "go1.x", "ruby2.7",
    "ruby2.5", "provided"),
  timeout = 3L,
  ...
)

publish_function_version(name, description, ...)

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”.

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.

description

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

layers

A character vector of pre-built layers to be used by your function when runtime is provided.

memory_size

An integer specifying the amount of RAM that's allocated to the function. Unenforced minimum value of 128, maximum value of 3008 (will be enforced on the API side).

...

Additional arguments passed to lambdaHTTP.

Details

create_function creates a new function from a deployment package. update_function_code updates the code within a function. update_function_config updates the configuration settings of a function. publish_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: UpdateFunctionCode API Reference: PublishVersion

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
21
22
23
24
25
## 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)

## End(Not run)

cloudyr/aws.lambda documentation built on May 7, 2020, 11:54 p.m.