Skip to contents

deploy a local lambda image to AWS Lambda

Usage

deploy_lambda(tag, policy_arns = NULL, role_arn = NULL, ...)

Arguments

tag

The tag of an existing local image tagged with ECR repo (see `build_lambda`)

policy_arns

character vector of IAM policy ARNs to attach to the Lambda execution role, besides `AWSLambdaBasicExecutionRole`. Use it to let the function call other AWS services, for example `"arn:aws:iam::aws:policy/AmazonS3FullAccess"`. Inside the function, `paws` clients then pick up the role's temporary credentials automatically.

role_arn

ARN of an existing IAM role for the function to run as. When given, no role is created, and `policy_arns` can't be used. The role must trust `lambda.amazonaws.com`.

...

Arguments passed onto `paws::lambda()$create_function()`, for example `Timeout`, `MemorySize` or `Environment`. `Architectures` is set from the image's architecture.

Value

Invisibly, a list with `ECR_image_uri`, `IAM_lambda_role_arn` and `Lambda_function_arn`.

Examples

if (FALSE) { # \dontrun{

  runtime_function <- "parity"
  runtime_path <- system.file("parity.R", package = "r2lambda")
  dependencies <- NULL

  build_lambda(
    tag = "myrepo52",
    runtime_function = runtime_function,
    runtime_path = runtime_path,
    dependencies = dependencies
    )

  deploy_lambda(tag = "myrepo52")

  invoke_lambda(
    function_name = "myrepo52",
    payload = list(number = 3),
    invocation_type = "RequestResponse"
    )

} # }