You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::Lambda::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for AWS Lambda. To construct a client, you need to configure a :region and :credentials.

lambda = Aws::Lambda::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::Lambda::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::Lambda::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :active_endpoint_cache (Boolean)

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :disable_host_prefix_injection (Boolean)

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available. See Plugins::EndpointPattern for more details.

  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :endpoint_cache_max_entries (Integer)

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_max_threads (Integer)

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_poll_interval (Integer)

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec. See Plugins::EndpointDiscovery for more details.

  • :endpoint_discovery (Boolean)

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#add_layer_version_permission(options = {}) ⇒ Types::AddLayerVersionPermissionResponse

Adds permissions to the resource-based policy of a version of an AWS Lambda layer. Use this action to grant layer usage permission to other accounts. You can grant permission to a single account, all AWS accounts, or all accounts in an organization.

To revoke permission, call RemoveLayerVersionPermission with the statement ID that you specified when you added it.

Examples:

Example: To add permissions to a layer version


# The following example grants permission for the account 223456789012 to use version 1 of a layer named my-layer.

resp = client.add_layer_version_permission({
  action: "lambda:GetLayerVersion", 
  layer_name: "my-layer", 
  principal: "223456789012", 
  statement_id: "xaccount", 
  version_number: 1, 
})

# resp.to_h outputs the following:
{
  revision_id: "35d87451-f796-4a3f-a618-95a3671b0a0c", 
  statement: "{\"Sid\":\"xaccount\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::223456789012:root\"},\"Action\":\"lambda:GetLayerVersion\",\"Resource\":\"arn:aws:lambda:us-east-2:123456789012:layer:my-layer:1\"}", 
}

Request syntax with placeholder values


resp = client.add_layer_version_permission({
  layer_name: "LayerName", # required
  version_number: 1, # required
  statement_id: "StatementId", # required
  action: "LayerPermissionAllowedAction", # required
  principal: "LayerPermissionAllowedPrincipal", # required
  organization_id: "OrganizationId",
  revision_id: "String",
})

Response structure


resp.statement #=> String
resp.revision_id #=> String

Options Hash (options):

  • :layer_name (required, String)

    The name or Amazon Resource Name (ARN) of the layer.

  • :version_number (required, Integer)

    The version number.

  • :statement_id (required, String)

    An identifier that distinguishes the policy from others on the same layer version.

  • :action (required, String)

    The API action that grants access to the layer. For example, lambda:GetLayerVersion.

  • :principal (required, String)

    An account ID, or * to grant permission to all AWS accounts.

  • :organization_id (String)

    With the principal set to *, grant permission to all accounts in the specified organization.

  • :revision_id (String)

    Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.

Returns:

See Also:

#add_permission(options = {}) ⇒ Types::AddPermissionResponse

Grants an AWS service or another account permission to use a function. You can apply the policy at the function level, or specify a qualifier to restrict access to a single version or alias. If you use a qualifier, the invoker must use the full Amazon Resource Name (ARN) of that version or alias to invoke the function.

To grant permission to another account, specify the account ID as the Principal. For AWS services, the principal is a domain-style identifier defined by the service, like s3.amazonaws.com or sns.amazonaws.com. For AWS services, you can also specify the ARN of the associated resource as the SourceArn. If you grant permission to a service principal without specifying the source, other accounts could potentially configure resources in their account to invoke your Lambda function.

This action adds a statement to a resource-based permissions policy for the function. For more information about function policies, see Lambda Function Policies.

Examples:

Example: To grant Amazon S3 permission to invoke a function


# The following example adds permission for Amazon S3 to invoke a Lambda function named my-function for notifications from a bucket named my-bucket-1xpuxmplzrlbh in account 123456789012.

resp = client.add_permission({
  action: "lambda:InvokeFunction", 
  function_name: "my-function", 
  principal: "s3.amazonaws.com", 
  source_account: "123456789012", 
  source_arn: "arn:aws:s3:::my-bucket-1xpuxmplzrlbh/*", 
  statement_id: "s3", 
})

# resp.to_h outputs the following:
{
  statement: "{\"Sid\":\"s3\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"lambda:InvokeFunction\",\"Resource\":\"arn:aws:lambda:us-east-2:123456789012:function:my-function\",\"Condition\":{\"StringEquals\":{\"AWS:SourceAccount\":\"123456789012\"},\"ArnLike\":{\"AWS:SourceArn\":\"arn:aws:s3:::my-bucket-1xpuxmplzrlbh\"}}}", 
}

Example: To grant another account permission to invoke a function


# The following example adds permission for account 223456789012 invoke a Lambda function named my-function.

resp = client.add_permission({
  action: "lambda:InvokeFunction", 
  function_name: "my-function", 
  principal: "223456789012", 
  statement_id: "xaccount", 
})

# resp.to_h outputs the following:
{
  statement: "{\"Sid\":\"xaccount\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::223456789012:root\"},\"Action\":\"lambda:InvokeFunction\",\"Resource\":\"arn:aws:lambda:us-east-2:123456789012:function:my-function\"}", 
}

Request syntax with placeholder values


resp = client.add_permission({
  function_name: "FunctionName", # required
  statement_id: "StatementId", # required
  action: "Action", # required
  principal: "Principal", # required
  source_arn: "Arn",
  source_account: "SourceOwner",
  event_source_token: "EventSourceToken",
  qualifier: "Qualifier",
  revision_id: "String",
})

Response structure


resp.statement #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :statement_id (required, String)

    A statement identifier that differentiates the statement from others in the same policy.

  • :action (required, String)

    The action that the principal can use on the function. For example, lambda:InvokeFunction or lambda:GetFunction.

  • :principal (required, String)

    The AWS service or account that invokes the function. If you specify a service, use SourceArn or SourceAccount to limit who can invoke the function through that service.

  • :source_arn (String)

    For AWS services, the ARN of the AWS resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.

  • :source_account (String)

    For Amazon S3, the ID of the account that owns the resource. Use this together with SourceArn to ensure that the resource is owned by the specified account. It is possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.

  • :event_source_token (String)

    For Alexa Smart Home functions, a token that must be supplied by the invoker.

  • :qualifier (String)

    Specify a version or alias to add permissions to a published version of the function.

  • :revision_id (String)

    Only update the policy if the revision ID matches the ID that\'s specified. Use this option to avoid modifying a policy that has changed since you last read it.

Returns:

See Also:

#create_alias(options = {}) ⇒ Types::AliasConfiguration

Creates an alias for a Lambda function version. Use aliases to provide clients with a function identifier that you can update to invoke a different version.

You can also map an alias to split invocation requests between two versions. Use the RoutingConfig parameter to specify a second version and the percentage of invocation requests that it receives.

Examples:

Example: To create an alias for a Lambda function


# The following example creates an alias named LIVE that points to version 1 of the my-function Lambda function.

resp = client.create_alias({
  description: "alias for live version of function", 
  function_name: "my-function", 
  function_version: "1", 
  name: "LIVE", 
})

# resp.to_h outputs the following:
{
  alias_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:LIVE", 
  description: "alias for live version of function", 
  function_version: "1", 
  name: "LIVE", 
  revision_id: "873282ed-xmpl-4dc8-a069-d0c647e470c6", 
}

Request syntax with placeholder values


resp = client.create_alias({
  function_name: "FunctionName", # required
  name: "Alias", # required
  function_version: "Version", # required
  description: "Description",
  routing_config: {
    additional_version_weights: {
      "AdditionalVersion" => 1.0,
    },
  },
})

Response structure


resp.alias_arn #=> String
resp.name #=> String
resp.function_version #=> String
resp.description #=> String
resp.routing_config.additional_version_weights #=> Hash
resp.routing_config.additional_version_weights["AdditionalVersion"] #=> Float
resp.revision_id #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :name (required, String)

    The name of the alias.

  • :function_version (required, String)

    The function version that the alias invokes.

  • :description (String)

    A description of the alias.

  • :routing_config (Types::AliasRoutingConfiguration)

    The routing configuration of the alias.

Returns:

See Also:

#create_event_source_mapping(options = {}) ⇒ Types::EventSourceMappingConfiguration

Creates a mapping between an event source and an AWS Lambda function. Lambda reads items from the event source and triggers the function.

For details about each event source type, see the following topics.

The following error handling options are only available for stream sources (DynamoDB and Kinesis):

  • BisectBatchOnFunctionError - If the function returns an error, split the batch in two and retry.

  • DestinationConfig - Send discarded records to an Amazon SQS queue or Amazon SNS topic.

  • MaximumRecordAgeInSeconds - Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires

  • MaximumRetryAttempts - Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires.

  • ParallelizationFactor - Process multiple batches from each shard concurrently.

Examples:

Example: To create a mapping between an event source and an AWS Lambda function


# The following example creates a mapping between an SQS queue and the my-function Lambda function.

resp = client.create_event_source_mapping({
  batch_size: 5, 
  event_source_arn: "arn:aws:sqs:us-west-2:123456789012:my-queue", 
  function_name: "my-function", 
})

# resp.to_h outputs the following:
{
  batch_size: 5, 
  event_source_arn: "arn:aws:sqs:us-west-2:123456789012:my-queue", 
  function_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
  last_modified: Time.parse(1569284520.333), 
  state: "Creating", 
  state_transition_reason: "USER_INITIATED", 
  uuid: "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", 
}

Request syntax with placeholder values


resp = client.create_event_source_mapping({
  event_source_arn: "Arn", # required
  function_name: "FunctionName", # required
  enabled: false,
  batch_size: 1,
  maximum_batching_window_in_seconds: 1,
  parallelization_factor: 1,
  starting_position: "TRIM_HORIZON", # accepts TRIM_HORIZON, LATEST, AT_TIMESTAMP
  starting_position_timestamp: Time.now,
  destination_config: {
    on_success: {
      destination: "DestinationArn",
    },
    on_failure: {
      destination: "DestinationArn",
    },
  },
  maximum_record_age_in_seconds: 1,
  bisect_batch_on_function_error: false,
  maximum_retry_attempts: 1,
  topics: ["Topic"],
  queues: ["Queue"],
  source_access_configurations: [
    {
      type: "BASIC_AUTH", # accepts BASIC_AUTH
      uri: "Arn",
    },
  ],
})

Response structure


resp.uuid #=> String
resp.starting_position #=> String, one of "TRIM_HORIZON", "LATEST", "AT_TIMESTAMP"
resp.starting_position_timestamp #=> Time
resp.batch_size #=> Integer
resp.maximum_batching_window_in_seconds #=> Integer
resp.parallelization_factor #=> Integer
resp.event_source_arn #=> String
resp.function_arn #=> String
resp.last_modified #=> Time
resp.last_processing_result #=> String
resp.state #=> String
resp.state_transition_reason #=> String
resp.destination_config.on_success.destination #=> String
resp.destination_config.on_failure.destination #=> String
resp.topics #=> Array
resp.topics[0] #=> String
resp.queues #=> Array
resp.queues[0] #=> String
resp.source_access_configurations #=> Array
resp.source_access_configurations[0].type #=> String, one of "BASIC_AUTH"
resp.source_access_configurations[0].uri #=> String
resp.maximum_record_age_in_seconds #=> Integer
resp.bisect_batch_on_function_error #=> true/false
resp.maximum_retry_attempts #=> Integer

Options Hash (options):

  • :event_source_arn (required, String)

    The Amazon Resource Name (ARN) of the event source.

    • Amazon Kinesis - The ARN of the data stream or a stream consumer.

    • Amazon DynamoDB Streams - The ARN of the stream.

    • Amazon Simple Queue Service - The ARN of the queue.

    • Amazon Managed Streaming for Apache Kafka - The ARN of the cluster.

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it\'s limited to 64 characters in length.

  • :enabled (Boolean)

    If true, the event source mapping is active. Set to false to pause polling and invocation.

  • :batch_size (Integer)

    The maximum number of items to retrieve in a single batch.

    • Amazon Kinesis - Default 100. Max 10,000.

    • Amazon DynamoDB Streams - Default 100. Max 1,000.

    • Amazon Simple Queue Service - Default 10. Max 10.

    • Amazon Managed Streaming for Apache Kafka - Default 100. Max 10,000.

  • :maximum_batching_window_in_seconds (Integer) — default: Streams

    The maximum amount of time to gather records before invoking the function, in seconds.

  • :parallelization_factor (Integer) — default: Streams

    The number of batches to process from each shard concurrently.

  • :starting_position (String)

    The position in a stream from which to start reading. Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK Streams sources. AT_TIMESTAMP is only supported for Amazon Kinesis streams.

  • :starting_position_timestamp (Time)

    With StartingPosition set to AT_TIMESTAMP, the time from which to start reading.

  • :destination_config (Types::DestinationConfig) — default: Streams

    An Amazon SQS queue or Amazon SNS topic destination for discarded records.

  • :maximum_record_age_in_seconds (Integer) — default: Streams

    Discard records older than the specified age. The default value is infinite (-1).

  • :bisect_batch_on_function_error (Boolean) — default: Streams

    If the function returns an error, split the batch in two and retry.

  • :maximum_retry_attempts (Integer) — default: Streams

    Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records will be retried until the record expires.

  • :topics (Array<String>) — default: MSK

    The name of the Kafka topic.

  • :queues (Array<String>) — default: MQ

    The name of the Amazon MQ broker destination queue to consume.

  • :source_access_configurations (Array<Types::SourceAccessConfiguration>) — default: MQ

    The Secrets Manager secret that stores your broker credentials. To store your secret, use the following format: { "username": "your username", "password": "your password" }

    To reference the secret, use the following format: [ { "Type": "BASIC_AUTH", "URI": "secretARN" } ]

    The value of Type is always BASIC_AUTH. To encrypt the secret, you can use customer or service managed keys. When using a customer managed KMS key, the Lambda execution role requires kms:Decrypt permissions.

Returns:

See Also:

#create_function(options = {}) ⇒ Types::FunctionConfiguration

Creates a Lambda function. To create a function, you need a deployment package and an execution role. The deployment package contains your function code. The execution role grants the function permission to use AWS services, such as Amazon CloudWatch Logs for log streaming and AWS X-Ray for request tracing.

When you create a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute or so. During this time, you can't invoke or modify the function. The State, StateReason, and StateReasonCode fields in the response from GetFunctionConfiguration indicate when the function is ready to invoke. For more information, see Function States.

A function has an unpublished version, and can have published versions and aliases. The unpublished version changes when you update your function's code and configuration. A published version is a snapshot of your function code and configuration that can't be changed. An alias is a named resource that maps to a version, and can be changed to map to a different version. Use the Publish parameter to create version 1 of your function from its initial configuration.

The other parameters let you configure version-specific and function-level settings. You can modify version-specific settings later with UpdateFunctionConfiguration. Function-level settings apply to both the unpublished and published versions of the function, and include tags (TagResource) and per-function concurrency limits (PutFunctionConcurrency).

If another account or an AWS service invokes your function, use AddPermission to grant permission by creating a resource-based IAM policy. You can grant permissions at the function level, on a version, or on an alias.

To invoke your function directly, use Invoke. To invoke your function in response to events in other AWS services, create an event source mapping (CreateEventSourceMapping), or configure a function trigger in the other service. For more information, see Invoking Functions.

Examples:

Example: To create a function


# The following example creates a function with a deployment package in Amazon S3 and enables X-Ray tracing and environment variable encryption.

resp = client.create_function({
  code: {
    s3_bucket: "my-bucket-1xpuxmplzrlbh", 
    s3_key: "function.zip", 
  }, 
  description: "Process image objects from Amazon S3.", 
  environment: {
    variables: {
      "BUCKET" => "my-bucket-1xpuxmplzrlbh", 
      "PREFIX" => "inbound", 
    }, 
  }, 
  function_name: "my-function", 
  handler: "index.handler", 
  kms_key_arn: "arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966", 
  memory_size: 256, 
  publish: true, 
  role: "arn:aws:iam::123456789012:role/lambda-role", 
  runtime: "nodejs12.x", 
  tags: {
    "DEPARTMENT" => "Assets", 
  }, 
  timeout: 15, 
  tracing_config: {
    mode: "Active", 
  }, 
})

# resp.to_h outputs the following:
{
  code_sha_256: "YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=", 
  code_size: 5797206, 
  description: "Process image objects from Amazon S3.", 
  environment: {
    variables: {
      "BUCKET" => "my-bucket-1xpuxmplzrlbh", 
      "PREFIX" => "inbound", 
    }, 
  }, 
  function_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
  function_name: "my-function", 
  handler: "index.handler", 
  kms_key_arn: "arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966", 
  last_modified: Time.parse("2020-04-10T19:06:32.563+0000"), 
  last_update_status: "Successful", 
  memory_size: 256, 
  revision_id: "b75dcd81-xmpl-48a8-a75a-93ba8b5b9727", 
  role: "arn:aws:iam::123456789012:role/lambda-role", 
  runtime: "nodejs12.x", 
  state: "Active", 
  timeout: 15, 
  tracing_config: {
    mode: "Active", 
  }, 
  version: "1", 
}

Request syntax with placeholder values


resp = client.create_function({
  function_name: "FunctionName", # required
  runtime: "nodejs", # required, accepts nodejs, nodejs4.3, nodejs6.10, nodejs8.10, nodejs10.x, nodejs12.x, java8, java8.al2, java11, python2.7, python3.6, python3.7, python3.8, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, dotnetcore3.1, nodejs4.3-edge, go1.x, ruby2.5, ruby2.7, provided, provided.al2
  role: "RoleArn", # required
  handler: "Handler", # required
  code: { # required
    zip_file: "data",
    s3_bucket: "S3Bucket",
    s3_key: "S3Key",
    s3_object_version: "S3ObjectVersion",
  },
  description: "Description",
  timeout: 1,
  memory_size: 1,
  publish: false,
  vpc_config: {
    subnet_ids: ["SubnetId"],
    security_group_ids: ["SecurityGroupId"],
  },
  dead_letter_config: {
    target_arn: "ResourceArn",
  },
  environment: {
    variables: {
      "EnvironmentVariableName" => "EnvironmentVariableValue",
    },
  },
  kms_key_arn: "KMSKeyArn",
  tracing_config: {
    mode: "Active", # accepts Active, PassThrough
  },
  tags: {
    "TagKey" => "TagValue",
  },
  layers: ["LayerVersionArn"],
  file_system_configs: [
    {
      arn: "FileSystemArn", # required
      local_mount_path: "LocalMountPath", # required
    },
  ],
})

Response structure


resp.function_name #=> String
resp.function_arn #=> String
resp.runtime #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.role #=> String
resp.handler #=> String
resp.code_size #=> Integer
resp.description #=> String
resp.timeout #=> Integer
resp.memory_size #=> Integer
resp.last_modified #=> Time
resp.code_sha_256 #=> String
resp.version #=> String
resp.vpc_config.subnet_ids #=> Array
resp.vpc_config.subnet_ids[0] #=> String
resp.vpc_config.security_group_ids #=> Array
resp.vpc_config.security_group_ids[0] #=> String
resp.vpc_config.vpc_id #=> String
resp.dead_letter_config.target_arn #=> String
resp.environment.variables #=> Hash
resp.environment.variables["EnvironmentVariableName"] #=> String
resp.environment.error.error_code #=> String
resp.environment.error.message #=> String
resp.kms_key_arn #=> String
resp.tracing_config.mode #=> String, one of "Active", "PassThrough"
resp.master_arn #=> String
resp.revision_id #=> String
resp.layers #=> Array
resp.layers[0].arn #=> String
resp.layers[0].code_size #=> Integer
resp.state #=> String, one of "Pending", "Active", "Inactive", "Failed"
resp.state_reason #=> String
resp.state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.last_update_status #=> String, one of "Successful", "Failed", "InProgress"
resp.last_update_status_reason #=> String
resp.last_update_status_reason_code #=> String, one of "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.file_system_configs #=> Array
resp.file_system_configs[0].arn #=> String
resp.file_system_configs[0].local_mount_path #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :runtime (required, String)

    The identifier of the function\'s runtime.

  • :role (required, String)

    The Amazon Resource Name (ARN) of the function\'s execution role.

  • :handler (required, String)

    The name of the method within your code that Lambda calls to execute your function. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see Programming Model.

  • :code (required, Types::FunctionCode)

    The code for the function.

  • :description (String)

    A description of the function.

  • :timeout (Integer)

    The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds.

  • :memory_size (Integer)

    The amount of memory that your function has access to. Increasing the function\'s memory also increases its CPU allocation. The default value is 128 MB. The value must be a multiple of 64 MB.

  • :publish (Boolean)

    Set to true to publish the first version of the function during creation.

  • :vpc_config (Types::VpcConfig)

    For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets in the VPC. When you connect a function to a VPC, it can only access resources and the internet through that VPC. For more information, see VPC Settings.

  • :dead_letter_config (Types::DeadLetterConfig)

    A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. For more information, see Dead Letter Queues.

  • :environment (Types::Environment)

    Environment variables that are accessible from function code during execution.

  • :kms_key_arn (String)

    The ARN of the AWS Key Management Service (AWS KMS) key that\'s used to encrypt your function\'s environment variables. If it\'s not provided, AWS Lambda uses a default service key.

  • :tracing_config (Types::TracingConfig)

    Set Mode to Active to sample and trace a subset of incoming requests with AWS X-Ray.

  • :tags (Hash<String,String>)

    A list of tags to apply to the function.

  • :layers (Array<String>)

    A list of function layers to add to the function\'s execution environment. Specify each layer by its ARN, including the version.

  • :file_system_configs (Array<Types::FileSystemConfig>)

    Connection settings for an Amazon EFS file system.

Returns:

See Also:

#delete_alias(options = {}) ⇒ Struct

Deletes a Lambda function alias.

Examples:

Example: To delete a Lambda function alias


# The following example deletes an alias named BLUE from a function named my-function

resp = client.delete_alias({
  function_name: "my-function", 
  name: "BLUE", 
})

Request syntax with placeholder values


resp = client.delete_alias({
  function_name: "FunctionName", # required
  name: "Alias", # required
})

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :name (required, String)

    The name of the alias.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_event_source_mapping(options = {}) ⇒ Types::EventSourceMappingConfiguration

Deletes an event source mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings.

When you delete an event source mapping, it enters a Deleting state and might not be completely deleted for several seconds.

Examples:

Example: To delete a Lambda function event source mapping


# The following example deletes an event source mapping. To get a mapping's UUID, use ListEventSourceMappings.

resp = client.delete_event_source_mapping({
  uuid: "14e0db71-xmpl-4eb5-b481-8945cf9d10c2", 
})

# resp.to_h outputs the following:
{
  batch_size: 5, 
  event_source_arn: "arn:aws:sqs:us-west-2:123456789012:my-queue", 
  function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function", 
  last_modified: Time.parse("${timestamp}"), 
  state: "Enabled", 
  state_transition_reason: "USER_INITIATED", 
  uuid: "14e0db71-xmpl-4eb5-b481-8945cf9d10c2", 
}

Request syntax with placeholder values


resp = client.delete_event_source_mapping({
  uuid: "String", # required
})

Response structure


resp.uuid #=> String
resp.starting_position #=> String, one of "TRIM_HORIZON", "LATEST", "AT_TIMESTAMP"
resp.starting_position_timestamp #=> Time
resp.batch_size #=> Integer
resp.maximum_batching_window_in_seconds #=> Integer
resp.parallelization_factor #=> Integer
resp.event_source_arn #=> String
resp.function_arn #=> String
resp.last_modified #=> Time
resp.last_processing_result #=> String
resp.state #=> String
resp.state_transition_reason #=> String
resp.destination_config.on_success.destination #=> String
resp.destination_config.on_failure.destination #=> String
resp.topics #=> Array
resp.topics[0] #=> String
resp.queues #=> Array
resp.queues[0] #=> String
resp.source_access_configurations #=> Array
resp.source_access_configurations[0].type #=> String, one of "BASIC_AUTH"
resp.source_access_configurations[0].uri #=> String
resp.maximum_record_age_in_seconds #=> Integer
resp.bisect_batch_on_function_error #=> true/false
resp.maximum_retry_attempts #=> Integer

Options Hash (options):

  • :uuid (required, String)

    The identifier of the event source mapping.

Returns:

See Also:

#delete_function(options = {}) ⇒ Struct

Deletes a Lambda function. To delete a specific function version, use the Qualifier parameter. Otherwise, all versions and aliases are deleted.

To delete Lambda event source mappings that invoke a function, use DeleteEventSourceMapping. For AWS services and resources that invoke your function directly, delete the trigger in the service where you originally configured it.

Examples:

Example: To delete a version of a Lambda function


# The following example deletes version 1 of a Lambda function named my-function.

resp = client.delete_function({
  function_name: "my-function", 
  qualifier: "1", 
})

Request syntax with placeholder values


resp = client.delete_function({
  function_name: "FunctionName", # required
  qualifier: "Qualifier",
})

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function or version.

    Name formats .title

    • Function name - my-function (name-only), my-function:1 (with version).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (String)

    Specify a version to delete. You can\'t delete a version that\'s referenced by an alias.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_function_concurrency(options = {}) ⇒ Struct

Removes a concurrent execution limit from a function.

Examples:

Example: To remove the reserved concurrent execution limit from a function


# The following example deletes the reserved concurrent execution limit from a function named my-function.

resp = client.delete_function_concurrency({
  function_name: "my-function", 
})

Request syntax with placeholder values


resp = client.delete_function_concurrency({
  function_name: "FunctionName", # required
})

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_function_event_invoke_config(options = {}) ⇒ Struct

Deletes the configuration for asynchronous invocation for a function, version, or alias.

To configure options for asynchronous invocation, use PutFunctionEventInvokeConfig.

Examples:

Example: To delete an asynchronous invocation configuration


# The following example deletes the asynchronous invocation configuration for the GREEN alias of a function named my-function.

resp = client.delete_function_event_invoke_config({
  function_name: "my-function", 
  qualifier: "GREEN", 
})

Request syntax with placeholder values


resp = client.delete_function_event_invoke_config({
  function_name: "FunctionName", # required
  qualifier: "Qualifier",
})

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (String)

    A version number or alias name.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_layer_version(options = {}) ⇒ Struct

Deletes a version of an AWS Lambda layer. Deleted versions can no longer be viewed or added to functions. To avoid breaking functions, a copy of the version remains in Lambda until no functions refer to it.

Examples:

Example: To delete a version of a Lambda layer


# The following example deletes version 2 of a layer named my-layer.

resp = client.delete_layer_version({
  layer_name: "my-layer", 
  version_number: 2, 
})

Request syntax with placeholder values


resp = client.delete_layer_version({
  layer_name: "LayerName", # required
  version_number: 1, # required
})

Options Hash (options):

  • :layer_name (required, String)

    The name or Amazon Resource Name (ARN) of the layer.

  • :version_number (required, Integer)

    The version number.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_provisioned_concurrency_config(options = {}) ⇒ Struct

Deletes the provisioned concurrency configuration for a function.

Examples:

Example: To delete a provisioned concurrency configuration


# The following example deletes the provisioned concurrency configuration for the GREEN alias of a function named my-function.

resp = client.delete_provisioned_concurrency_config({
  function_name: "my-function", 
  qualifier: "GREEN", 
})

Request syntax with placeholder values


resp = client.delete_provisioned_concurrency_config({
  function_name: "FunctionName", # required
  qualifier: "Qualifier", # required
})

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (required, String)

    The version number or alias name.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#get_account_settings(options = {}) ⇒ Types::GetAccountSettingsResponse

Retrieves details about your account's limits and usage in an AWS Region.

Examples:

Example: To get account settings


# This operation takes no parameters and returns details about storage and concurrency quotas in the current Region.

resp = client.({
})

# resp.to_h outputs the following:
{
  account_limit: {
    code_size_unzipped: 262144000, 
    code_size_zipped: 52428800, 
    concurrent_executions: 1000, 
    total_code_size: 80530636800, 
    unreserved_concurrent_executions: 1000, 
  }, 
  account_usage: {
    function_count: 4, 
    total_code_size: 9426, 
  }, 
}

Request syntax with placeholder values


resp = client.()

Response structure


resp..total_code_size #=> Integer
resp..code_size_unzipped #=> Integer
resp..code_size_zipped #=> Integer
resp..concurrent_executions #=> Integer
resp..unreserved_concurrent_executions #=> Integer
resp..total_code_size #=> Integer
resp..function_count #=> Integer

Returns:

See Also:

#get_alias(options = {}) ⇒ Types::AliasConfiguration

Returns details about a Lambda function alias.

Examples:

Example: To get a Lambda function alias


# The following example returns details about an alias named BLUE for a function named my-function

resp = client.get_alias({
  function_name: "my-function", 
  name: "BLUE", 
})

# resp.to_h outputs the following:
{
  alias_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function:BLUE", 
  description: "Production environment BLUE.", 
  function_version: "3", 
  name: "BLUE", 
  revision_id: "594f41fb-xmpl-4c20-95c7-6ca5f2a92c93", 
}

Request syntax with placeholder values


resp = client.get_alias({
  function_name: "FunctionName", # required
  name: "Alias", # required
})

Response structure


resp.alias_arn #=> String
resp.name #=> String
resp.function_version #=> String
resp.description #=> String
resp.routing_config.additional_version_weights #=> Hash
resp.routing_config.additional_version_weights["AdditionalVersion"] #=> Float
resp.revision_id #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :name (required, String)

    The name of the alias.

Returns:

See Also:

#get_event_source_mapping(options = {}) ⇒ Types::EventSourceMappingConfiguration

Returns details about an event source mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings.

Examples:

Example: To get a Lambda function's event source mapping


# The following example returns details about an event source mapping. To get a mapping's UUID, use ListEventSourceMappings.

resp = client.get_event_source_mapping({
  uuid: "14e0db71-xmpl-4eb5-b481-8945cf9d10c2", 
})

# resp.to_h outputs the following:
{
  batch_size: 500, 
  bisect_batch_on_function_error: false, 
  destination_config: {
  }, 
  event_source_arn: "arn:aws:sqs:us-east-2:123456789012:mySQSqueue", 
  function_arn: "arn:aws:lambda:us-east-2:123456789012:function:myFunction", 
  last_modified: Time.parse("${timestamp}"), 
  last_processing_result: "No records processed", 
  maximum_record_age_in_seconds: 604800, 
  maximum_retry_attempts: 10000, 
  state: "Creating", 
  state_transition_reason: "User action", 
  uuid: "14e0db71-xmpl-4eb5-b481-8945cf9d10c2", 
}

Request syntax with placeholder values


resp = client.get_event_source_mapping({
  uuid: "String", # required
})

Response structure


resp.uuid #=> String
resp.starting_position #=> String, one of "TRIM_HORIZON", "LATEST", "AT_TIMESTAMP"
resp.starting_position_timestamp #=> Time
resp.batch_size #=> Integer
resp.maximum_batching_window_in_seconds #=> Integer
resp.parallelization_factor #=> Integer
resp.event_source_arn #=> String
resp.function_arn #=> String
resp.last_modified #=> Time
resp.last_processing_result #=> String
resp.state #=> String
resp.state_transition_reason #=> String
resp.destination_config.on_success.destination #=> String
resp.destination_config.on_failure.destination #=> String
resp.topics #=> Array
resp.topics[0] #=> String
resp.queues #=> Array
resp.queues[0] #=> String
resp.source_access_configurations #=> Array
resp.source_access_configurations[0].type #=> String, one of "BASIC_AUTH"
resp.source_access_configurations[0].uri #=> String
resp.maximum_record_age_in_seconds #=> Integer
resp.bisect_batch_on_function_error #=> true/false
resp.maximum_retry_attempts #=> Integer

Options Hash (options):

  • :uuid (required, String)

    The identifier of the event source mapping.

Returns:

See Also:

#get_function(options = {}) ⇒ Types::GetFunctionResponse

Returns information about the function or function version, with a link to download the deployment package that's valid for 10 minutes. If you specify a function version, only details that are specific to that version are returned.

Examples:

Example: To get a Lambda function


# The following example returns code and configuration details for version 1 of a function named my-function.

resp = client.get_function({
  function_name: "my-function", 
  qualifier: "1", 
})

# resp.to_h outputs the following:
{
  code: {
    location: "https://awslambda-us-west-2-tasks.s3.us-west-2.amazonaws.com/snapshots/123456789012/my-function-e7d9d1ed-xmpl-4f79-904a-4b87f2681f30?versionId=sH3TQwBOaUy...", 
    repository_type: "S3", 
  }, 
  configuration: {
    code_sha_256: "YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=", 
    code_size: 5797206, 
    description: "Process image objects from Amazon S3.", 
    environment: {
      variables: {
        "BUCKET" => "my-bucket-1xpuxmplzrlbh", 
        "PREFIX" => "inbound", 
      }, 
    }, 
    function_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
    function_name: "my-function", 
    handler: "index.handler", 
    kms_key_arn: "arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966", 
    last_modified: Time.parse("2020-04-10T19:06:32.563+0000"), 
    last_update_status: "Successful", 
    memory_size: 256, 
    revision_id: "b75dcd81-xmpl-48a8-a75a-93ba8b5b9727", 
    role: "arn:aws:iam::123456789012:role/lambda-role", 
    runtime: "nodejs12.x", 
    state: "Active", 
    timeout: 15, 
    tracing_config: {
      mode: "Active", 
    }, 
    version: "$LATEST", 
  }, 
  tags: {
    "DEPARTMENT" => "Assets", 
  }, 
}

Request syntax with placeholder values


resp = client.get_function({
  function_name: "NamespacedFunctionName", # required
  qualifier: "Qualifier",
})

Response structure


resp.configuration.function_name #=> String
resp.configuration.function_arn #=> String
resp.configuration.runtime #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.configuration.role #=> String
resp.configuration.handler #=> String
resp.configuration.code_size #=> Integer
resp.configuration.description #=> String
resp.configuration.timeout #=> Integer
resp.configuration.memory_size #=> Integer
resp.configuration.last_modified #=> Time
resp.configuration.code_sha_256 #=> String
resp.configuration.version #=> String
resp.configuration.vpc_config.subnet_ids #=> Array
resp.configuration.vpc_config.subnet_ids[0] #=> String
resp.configuration.vpc_config.security_group_ids #=> Array
resp.configuration.vpc_config.security_group_ids[0] #=> String
resp.configuration.vpc_config.vpc_id #=> String
resp.configuration.dead_letter_config.target_arn #=> String
resp.configuration.environment.variables #=> Hash
resp.configuration.environment.variables["EnvironmentVariableName"] #=> String
resp.configuration.environment.error.error_code #=> String
resp.configuration.environment.error.message #=> String
resp.configuration.kms_key_arn #=> String
resp.configuration.tracing_config.mode #=> String, one of "Active", "PassThrough"
resp.configuration.master_arn #=> String
resp.configuration.revision_id #=> String
resp.configuration.layers #=> Array
resp.configuration.layers[0].arn #=> String
resp.configuration.layers[0].code_size #=> Integer
resp.configuration.state #=> String, one of "Pending", "Active", "Inactive", "Failed"
resp.configuration.state_reason #=> String
resp.configuration.state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.configuration.last_update_status #=> String, one of "Successful", "Failed", "InProgress"
resp.configuration.last_update_status_reason #=> String
resp.configuration.last_update_status_reason_code #=> String, one of "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.configuration.file_system_configs #=> Array
resp.configuration.file_system_configs[0].arn #=> String
resp.configuration.file_system_configs[0].local_mount_path #=> String
resp.code.repository_type #=> String
resp.code.location #=> String
resp.tags #=> Hash
resp.tags["TagKey"] #=> String
resp.concurrency.reserved_concurrent_executions #=> Integer

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (String)

    Specify a version or alias to get details about a published version of the function.

Returns:

See Also:

#get_function_concurrency(options = {}) ⇒ Types::GetFunctionConcurrencyResponse

Returns details about the reserved concurrency configuration for a function. To set a concurrency limit for a function, use PutFunctionConcurrency.

Examples:

Example: To get the reserved concurrency setting for a function


# The following example returns the reserved concurrency setting for a function named my-function.

resp = client.get_function_concurrency({
  function_name: "my-function", 
})

# resp.to_h outputs the following:
{
  reserved_concurrent_executions: 250, 
}

Request syntax with placeholder values


resp = client.get_function_concurrency({
  function_name: "FunctionName", # required
})

Response structure


resp.reserved_concurrent_executions #=> Integer

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

Returns:

See Also:

#get_function_configuration(options = {}) ⇒ Types::FunctionConfiguration

Returns the version-specific settings of a Lambda function or version. The output includes only options that can vary between versions of a function. To modify these settings, use UpdateFunctionConfiguration.

To get all of a function's details, including function-level settings, use GetFunction.

Examples:

Example: To get a Lambda function's event source mapping


# The following example returns and configuration details for version 1 of a function named my-function.

resp = client.get_function_configuration({
  function_name: "my-function", 
  qualifier: "1", 
})

# resp.to_h outputs the following:
{
  code_sha_256: "YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=", 
  code_size: 5797206, 
  description: "Process image objects from Amazon S3.", 
  environment: {
    variables: {
      "BUCKET" => "my-bucket-1xpuxmplzrlbh", 
      "PREFIX" => "inbound", 
    }, 
  }, 
  function_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
  function_name: "my-function", 
  handler: "index.handler", 
  kms_key_arn: "arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966", 
  last_modified: Time.parse("2020-04-10T19:06:32.563+0000"), 
  last_update_status: "Successful", 
  memory_size: 256, 
  revision_id: "b75dcd81-xmpl-48a8-a75a-93ba8b5b9727", 
  role: "arn:aws:iam::123456789012:role/lambda-role", 
  runtime: "nodejs12.x", 
  state: "Active", 
  timeout: 15, 
  tracing_config: {
    mode: "Active", 
  }, 
  version: "$LATEST", 
}

Request syntax with placeholder values


resp = client.get_function_configuration({
  function_name: "NamespacedFunctionName", # required
  qualifier: "Qualifier",
})

Response structure


resp.function_name #=> String
resp.function_arn #=> String
resp.runtime #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.role #=> String
resp.handler #=> String
resp.code_size #=> Integer
resp.description #=> String
resp.timeout #=> Integer
resp.memory_size #=> Integer
resp.last_modified #=> Time
resp.code_sha_256 #=> String
resp.version #=> String
resp.vpc_config.subnet_ids #=> Array
resp.vpc_config.subnet_ids[0] #=> String
resp.vpc_config.security_group_ids #=> Array
resp.vpc_config.security_group_ids[0] #=> String
resp.vpc_config.vpc_id #=> String
resp.dead_letter_config.target_arn #=> String
resp.environment.variables #=> Hash
resp.environment.variables["EnvironmentVariableName"] #=> String
resp.environment.error.error_code #=> String
resp.environment.error.message #=> String
resp.kms_key_arn #=> String
resp.tracing_config.mode #=> String, one of "Active", "PassThrough"
resp.master_arn #=> String
resp.revision_id #=> String
resp.layers #=> Array
resp.layers[0].arn #=> String
resp.layers[0].code_size #=> Integer
resp.state #=> String, one of "Pending", "Active", "Inactive", "Failed"
resp.state_reason #=> String
resp.state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.last_update_status #=> String, one of "Successful", "Failed", "InProgress"
resp.last_update_status_reason #=> String
resp.last_update_status_reason_code #=> String, one of "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.file_system_configs #=> Array
resp.file_system_configs[0].arn #=> String
resp.file_system_configs[0].local_mount_path #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (String)

    Specify a version or alias to get details about a published version of the function.

Returns:

See Also:

#get_function_event_invoke_config(options = {}) ⇒ Types::FunctionEventInvokeConfig

Retrieves the configuration for asynchronous invocation for a function, version, or alias.

To configure options for asynchronous invocation, use PutFunctionEventInvokeConfig.

Examples:

Example: To get an asynchronous invocation configuration


# The following example returns the asynchronous invocation configuration for the BLUE alias of a function named my-function.

resp = client.get_function_event_invoke_config({
  function_name: "my-function", 
  qualifier: "BLUE", 
})

# resp.to_h outputs the following:
{
  destination_config: {
    on_failure: {
      destination: "arn:aws:sqs:us-east-2:123456789012:failed-invocations", 
    }, 
    on_success: {
    }, 
  }, 
  function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:BLUE", 
  last_modified: Time.parse("${timestamp}"), 
  maximum_event_age_in_seconds: 3600, 
  maximum_retry_attempts: 0, 
}

Request syntax with placeholder values


resp = client.get_function_event_invoke_config({
  function_name: "FunctionName", # required
  qualifier: "Qualifier",
})

Response structure


resp.last_modified #=> Time
resp.function_arn #=> String
resp.maximum_retry_attempts #=> Integer
resp.maximum_event_age_in_seconds #=> Integer
resp.destination_config.on_success.destination #=> String
resp.destination_config.on_failure.destination #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (String)

    A version number or alias name.

Returns:

See Also:

#get_layer_version(options = {}) ⇒ Types::GetLayerVersionResponse

Returns information about a version of an AWS Lambda layer, with a link to download the layer archive that's valid for 10 minutes.

Examples:

Example: To get information about a Lambda layer version


# The following example returns information for version 1 of a layer named my-layer.

resp = client.get_layer_version({
  layer_name: "my-layer", 
  version_number: 1, 
})

# resp.to_h outputs the following:
{
  compatible_runtimes: [
    "python3.6", 
    "python3.7", 
  ], 
  content: {
    code_sha_256: "tv9jJO+rPbXUUXuRKi7CwHzKtLDkDRJLB3cC3Z/ouXo=", 
    code_size: 169, 
    location: "https://awslambda-us-east-2-layers.s3.us-east-2.amazonaws.com/snapshots/123456789012/my-layer-4aaa2fbb-ff77-4b0a-ad92-5b78a716a96a?versionId=27iWyA73cCAYqyH...", 
  }, 
  created_date: Time.parse("2018-11-14T23:03:52.894+0000"), 
  description: "My Python layer", 
  layer_arn: "arn:aws:lambda:us-east-2:123456789012:layer:my-layer", 
  layer_version_arn: "arn:aws:lambda:us-east-2:123456789012:layer:my-layer:1", 
  license_info: "MIT", 
  version: 1, 
}

Request syntax with placeholder values


resp = client.get_layer_version({
  layer_name: "LayerName", # required
  version_number: 1, # required
})

Response structure


resp.content.location #=> String
resp.content.code_sha_256 #=> String
resp.content.code_size #=> Integer
resp.layer_arn #=> String
resp.layer_version_arn #=> String
resp.description #=> String
resp.created_date #=> Time
resp.version #=> Integer
resp.compatible_runtimes #=> Array
resp.compatible_runtimes[0] #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.license_info #=> String

Options Hash (options):

  • :layer_name (required, String)

    The name or Amazon Resource Name (ARN) of the layer.

  • :version_number (required, Integer)

    The version number.

Returns:

See Also:

#get_layer_version_by_arn(options = {}) ⇒ Types::GetLayerVersionResponse

Returns information about a version of an AWS Lambda layer, with a link to download the layer archive that's valid for 10 minutes.

Examples:

Example: To get information about a Lambda layer version


# The following example returns information about the layer version with the specified Amazon Resource Name (ARN).

resp = client.get_layer_version_by_arn({
  arn: "arn:aws:lambda:ca-central-1:123456789012:layer:blank-python-lib:3", 
})

# resp.to_h outputs the following:
{
  compatible_runtimes: [
    "python3.8", 
  ], 
  content: {
    code_sha_256: "6x+xmpl/M3BnQUk7gS9sGmfeFsR/npojXoA3fZUv4eU=", 
    code_size: 9529009, 
    location: "https://awslambda-us-east-2-layers.s3.us-east-2.amazonaws.com/snapshots/123456789012/blank-python-lib-e5212378-xmpl-44ee-8398-9d8ec5113949?versionId=WbZnvf...", 
  }, 
  created_date: Time.parse("2020-03-31T00:35:18.949+0000"), 
  description: "Dependencies for the blank-python sample app.", 
  layer_arn: "arn:aws:lambda:us-east-2:123456789012:layer:blank-python-lib", 
  layer_version_arn: "arn:aws:lambda:us-east-2:123456789012:layer:blank-python-lib:3", 
  version: 3, 
}

Request syntax with placeholder values


resp = client.get_layer_version_by_arn({
  arn: "LayerVersionArn", # required
})

Response structure


resp.content.location #=> String
resp.content.code_sha_256 #=> String
resp.content.code_size #=> Integer
resp.layer_arn #=> String
resp.layer_version_arn #=> String
resp.description #=> String
resp.created_date #=> Time
resp.version #=> Integer
resp.compatible_runtimes #=> Array
resp.compatible_runtimes[0] #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.license_info #=> String

Options Hash (options):

  • :arn (required, String)

    The ARN of the layer version.

Returns:

See Also:

#get_layer_version_policy(options = {}) ⇒ Types::GetLayerVersionPolicyResponse

Returns the permission policy for a version of an AWS Lambda layer. For more information, see AddLayerVersionPermission.

Examples:

Request syntax with placeholder values


resp = client.get_layer_version_policy({
  layer_name: "LayerName", # required
  version_number: 1, # required
})

Response structure


resp.policy #=> String
resp.revision_id #=> String

Options Hash (options):

  • :layer_name (required, String)

    The name or Amazon Resource Name (ARN) of the layer.

  • :version_number (required, Integer)

    The version number.

Returns:

See Also:

#get_policy(options = {}) ⇒ Types::GetPolicyResponse

Returns the resource-based IAM policy for a function, version, or alias.

Examples:

Example: To retrieve a Lambda function policy


# The following example returns the resource-based policy for version 1 of a Lambda function named my-function.

resp = client.get_policy({
  function_name: "my-function", 
  qualifier: "1", 
})

# resp.to_h outputs the following:
{
  policy: "{\"Version\":\"2012-10-17\",\"Id\":\"default\",\"Statement\":[{\"Sid\":\"xaccount\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:root\"},\"Action\":\"lambda:InvokeFunction\",\"Resource\":\"arn:aws:lambda:us-east-2:123456789012:function:my-function:1\"}]}", 
  revision_id: "4843f2f6-7c59-4fda-b484-afd0bc0e22b8", 
}

Request syntax with placeholder values


resp = client.get_policy({
  function_name: "NamespacedFunctionName", # required
  qualifier: "Qualifier",
})

Response structure


resp.policy #=> String
resp.revision_id #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (String)

    Specify a version or alias to get the policy for that resource.

Returns:

See Also:

#get_provisioned_concurrency_config(options = {}) ⇒ Types::GetProvisionedConcurrencyConfigResponse

Retrieves the provisioned concurrency configuration for a function's alias or version.

Examples:

Example: To view a provisioned concurrency configuration


# The following example displays details for the provisioned concurrency configuration for the BLUE alias of the specified function.

resp = client.get_provisioned_concurrency_config({
  function_name: "my-function", 
  qualifier: "BLUE", 
})

# resp.to_h outputs the following:
{
  allocated_provisioned_concurrent_executions: 100, 
  available_provisioned_concurrent_executions: 100, 
  last_modified: Time.parse("2019-12-31T20:28:49+0000"), 
  requested_provisioned_concurrent_executions: 100, 
  status: "READY", 
}

Example: To get a provisioned concurrency configuration


# The following example returns details for the provisioned concurrency configuration for the BLUE alias of the specified function.

resp = client.get_provisioned_concurrency_config({
  function_name: "my-function", 
  qualifier: "BLUE", 
})

# resp.to_h outputs the following:
{
  allocated_provisioned_concurrent_executions: 100, 
  available_provisioned_concurrent_executions: 100, 
  last_modified: Time.parse("2019-12-31T20:28:49+0000"), 
  requested_provisioned_concurrent_executions: 100, 
  status: "READY", 
}

Request syntax with placeholder values


resp = client.get_provisioned_concurrency_config({
  function_name: "FunctionName", # required
  qualifier: "Qualifier", # required
})

Response structure


resp.requested_provisioned_concurrent_executions #=> Integer
resp.available_provisioned_concurrent_executions #=> Integer
resp.allocated_provisioned_concurrent_executions #=> Integer
resp.status #=> String, one of "IN_PROGRESS", "READY", "FAILED"
resp.status_reason #=> String
resp.last_modified #=> Time

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (required, String)

    The version number or alias name.

Returns:

See Also:

#invoke(options = {}) ⇒ Types::InvocationResponse

Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. To invoke a function asynchronously, set InvocationType to Event.

For synchronous invocation, details about the function response, including errors, are included in the response body and headers. For either invocation type, you can find more information in the execution log and trace.

When an error occurs, your function may be invoked multiple times. Retry behavior varies by error type, client, event source, and invocation type. For example, if you invoke a function asynchronously and it returns an error, Lambda executes the function up to two more times. For more information, see Retry Behavior.

For asynchronous invocation, Lambda adds events to a queue before sending them to your function. If your function does not have enough capacity to keep up with the queue, events may be lost. Occasionally, your function may receive the same event multiple times, even if no error occurs. To retain events that were not processed, configure your function with a dead-letter queue.

The status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your function from executing, such as permissions errors, limit errors, or issues with your function's code and configuration. For example, Lambda returns TooManyRequestsException if executing the function would cause you to exceed a concurrency limit at either the account level (ConcurrentInvocationLimitExceeded) or function level (ReservedFunctionConcurrentInvocationLimitExceeded).

For functions with a long timeout, your client might be disconnected during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings.

This operation requires permission for the lambda:InvokeFunction action.

Examples:

Example: To invoke a Lambda function


# The following example invokes version 1 of a function named my-function with an empty event payload.

resp = client.invoke({
  function_name: "my-function", 
  payload: "{}", 
  qualifier: "1", 
})

# resp.to_h outputs the following:
{
  payload: "200 SUCCESS", 
  status_code: 200, 
}

Example: To invoke a Lambda function asynchronously


# The following example invokes version 1 of a function named my-function asynchronously.

resp = client.invoke({
  function_name: "my-function", 
  invocation_type: "Event", 
  payload: "{}", 
  qualifier: "1", 
})

# resp.to_h outputs the following:
{
  payload: "", 
  status_code: 202, 
}

Request syntax with placeholder values


resp = client.invoke({
  function_name: "NamespacedFunctionName", # required
  invocation_type: "Event", # accepts Event, RequestResponse, DryRun
  log_type: "None", # accepts None, Tail
  client_context: "String",
  payload: "data",
  qualifier: "Qualifier",
})

Response structure


resp.status_code #=> Integer
resp.function_error #=> String
resp.log_result #=> String
resp.payload #=> IO
resp.executed_version #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :invocation_type (String)

    Choose from the following options.

    • RequestResponse (default) - Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.

    • Event - Invoke the function asynchronously. Send events that fail multiple times to the function\'s dead-letter queue (if it\'s configured). The API response only includes a status code.

    • DryRun - Validate parameter values and verify that the user or role has permission to invoke the function.

  • :log_type (String)

    Set to Tail to include the execution log in the response.

  • :client_context (String)

    Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.

  • :payload (IO, String)

    The JSON that you want to provide to your Lambda function as input.

  • :qualifier (String)

    Specify a version or alias to invoke a published version of the function.

Returns:

See Also:

#invoke_async(options = {}) ⇒ Types::InvokeAsyncResponse

For asynchronous function invocation, use Invoke.

Invokes a function asynchronously.

Examples:

Example: To invoke a Lambda function asynchronously


# The following example invokes a Lambda function asynchronously

resp = client.invoke_async({
  function_name: "my-function", 
  invoke_args: "{}", 
})

# resp.to_h outputs the following:
{
  status: 202, 
}

Request syntax with placeholder values


resp = client.invoke_async({
  function_name: "NamespacedFunctionName", # required
  invoke_args: source_file, # file/IO object, or string data, required
})

Response structure


resp.status #=> Integer

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :invoke_args (required, IO, String)

    The JSON that you want to provide to your Lambda function as input.

Returns:

See Also:

#list_aliases(options = {}) ⇒ Types::ListAliasesResponse

Returns a list of aliases for a Lambda function.

Examples:

Example: To list a function's aliases


# The following example returns a list of aliases for a function named my-function.

resp = client.list_aliases({
  function_name: "my-function", 
})

# resp.to_h outputs the following:
{
  aliases: [
    {
      alias_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function:BETA", 
      description: "Production environment BLUE.", 
      function_version: "2", 
      name: "BLUE", 
      revision_id: "a410117f-xmpl-494e-8035-7e204bb7933b", 
      routing_config: {
        additional_version_weights: {
          "1" => 0.7, 
        }, 
      }, 
    }, 
    {
      alias_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function:LIVE", 
      description: "Production environment GREEN.", 
      function_version: "1", 
      name: "GREEN", 
      revision_id: "21d40116-xmpl-40ba-9360-3ea284da1bb5", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_aliases({
  function_name: "FunctionName", # required
  function_version: "Version",
  marker: "String",
  max_items: 1,
})

Response structure


resp.next_marker #=> String
resp.aliases #=> Array
resp.aliases[0].alias_arn #=> String
resp.aliases[0].name #=> String
resp.aliases[0].function_version #=> String
resp.aliases[0].description #=> String
resp.aliases[0].routing_config.additional_version_weights #=> Hash
resp.aliases[0].routing_config.additional_version_weights["AdditionalVersion"] #=> Float
resp.aliases[0].revision_id #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :function_version (String)

    Specify a function version to only list aliases that invoke that version.

  • :marker (String)

    Specify the pagination token that\'s returned by a previous request to retrieve the next page of results.

  • :max_items (Integer)

    Limit the number of aliases returned.

Returns:

See Also:

#list_event_source_mappings(options = {}) ⇒ Types::ListEventSourceMappingsResponse

Lists event source mappings. Specify an EventSourceArn to only show event source mappings for a single event source.

Examples:

Example: To list the event source mappings for a function


# The following example returns a list of the event source mappings for a function named my-function.

resp = client.list_event_source_mappings({
  function_name: "my-function", 
})

# resp.to_h outputs the following:
{
  event_source_mappings: [
    {
      batch_size: 5, 
      event_source_arn: "arn:aws:sqs:us-west-2:123456789012:mySQSqueue", 
      function_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
      last_modified: Time.parse(1569284520.333), 
      state: "Enabled", 
      state_transition_reason: "USER_INITIATED", 
      uuid: "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_event_source_mappings({
  event_source_arn: "Arn",
  function_name: "FunctionName",
  marker: "String",
  max_items: 1,
})

Response structure


resp.next_marker #=> String
resp.event_source_mappings #=> Array
resp.event_source_mappings[0].uuid #=> String
resp.event_source_mappings[0].starting_position #=> String, one of "TRIM_HORIZON", "LATEST", "AT_TIMESTAMP"
resp.event_source_mappings[0].starting_position_timestamp #=> Time
resp.event_source_mappings[0].batch_size #=> Integer
resp.event_source_mappings[0].maximum_batching_window_in_seconds #=> Integer
resp.event_source_mappings[0].parallelization_factor #=> Integer
resp.event_source_mappings[0].event_source_arn #=> String
resp.event_source_mappings[0].function_arn #=> String
resp.event_source_mappings[0].last_modified #=> Time
resp.event_source_mappings[0].last_processing_result #=> String
resp.event_source_mappings[0].state #=> String
resp.event_source_mappings[0].state_transition_reason #=> String
resp.event_source_mappings[0].destination_config.on_success.destination #=> String
resp.event_source_mappings[0].destination_config.on_failure.destination #=> String
resp.event_source_mappings[0].topics #=> Array
resp.event_source_mappings[0].topics[0] #=> String
resp.event_source_mappings[0].queues #=> Array
resp.event_source_mappings[0].queues[0] #=> String
resp.event_source_mappings[0].source_access_configurations #=> Array
resp.event_source_mappings[0].source_access_configurations[0].type #=> String, one of "BASIC_AUTH"
resp.event_source_mappings[0].source_access_configurations[0].uri #=> String
resp.event_source_mappings[0].maximum_record_age_in_seconds #=> Integer
resp.event_source_mappings[0].bisect_batch_on_function_error #=> true/false
resp.event_source_mappings[0].maximum_retry_attempts #=> Integer

Options Hash (options):

  • :event_source_arn (String)

    The Amazon Resource Name (ARN) of the event source.

    • Amazon Kinesis - The ARN of the data stream or a stream consumer.

    • Amazon DynamoDB Streams - The ARN of the stream.

    • Amazon Simple Queue Service - The ARN of the queue.

    • Amazon Managed Streaming for Apache Kafka - The ARN of the cluster.

  • :function_name (String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it\'s limited to 64 characters in length.

  • :marker (String)

    A pagination token returned by a previous call.

  • :max_items (Integer)

    The maximum number of event source mappings to return.

Returns:

See Also:

#list_function_event_invoke_configs(options = {}) ⇒ Types::ListFunctionEventInvokeConfigsResponse

Retrieves a list of configurations for asynchronous invocation for a function.

To configure options for asynchronous invocation, use PutFunctionEventInvokeConfig.

Examples:

Example: To view a list of asynchronous invocation configurations


# The following example returns a list of asynchronous invocation configurations for a function named my-function.

resp = client.list_function_event_invoke_configs({
  function_name: "my-function", 
})

# resp.to_h outputs the following:
{
  function_event_invoke_configs: [
    {
      function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:GREEN", 
      last_modified: Time.parse(1577824406.719), 
      maximum_event_age_in_seconds: 1800, 
      maximum_retry_attempts: 2, 
    }, 
    {
      function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:BLUE", 
      last_modified: Time.parse(1577824396.653), 
      maximum_event_age_in_seconds: 3600, 
      maximum_retry_attempts: 0, 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_function_event_invoke_configs({
  function_name: "FunctionName", # required
  marker: "String",
  max_items: 1,
})

Response structure


resp.function_event_invoke_configs #=> Array
resp.function_event_invoke_configs[0].last_modified #=> Time
resp.function_event_invoke_configs[0].function_arn #=> String
resp.function_event_invoke_configs[0].maximum_retry_attempts #=> Integer
resp.function_event_invoke_configs[0].maximum_event_age_in_seconds #=> Integer
resp.function_event_invoke_configs[0].destination_config.on_success.destination #=> String
resp.function_event_invoke_configs[0].destination_config.on_failure.destination #=> String
resp.next_marker #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :marker (String)

    Specify the pagination token that\'s returned by a previous request to retrieve the next page of results.

  • :max_items (Integer)

    The maximum number of configurations to return.

Returns:

See Also:

#list_functions(options = {}) ⇒ Types::ListFunctionsResponse

Returns a list of Lambda functions, with the version-specific configuration of each. Lambda returns up to 50 functions per call.

Set FunctionVersion to ALL to include all published versions of each function in addition to the unpublished version. To get more information about a function or version, use GetFunction.

Examples:

Example: To get a list of Lambda functions


# This operation returns a list of Lambda functions.

resp = client.list_functions({
})

# resp.to_h outputs the following:
{
  functions: [
    {
      code_sha_256: "dBG9m8SGdmlEjw/JYXlhhvCrAv5TxvXsbL/RMr0fT/I=", 
      code_size: 294, 
      description: "", 
      function_arn: "arn:aws:lambda:us-west-2:123456789012:function:helloworld", 
      function_name: "helloworld", 
      handler: "helloworld.handler", 
      last_modified: Time.parse("2019-09-23T18:32:33.857+0000"), 
      memory_size: 128, 
      revision_id: "1718e831-badf-4253-9518-d0644210af7b", 
      role: "arn:aws:iam::123456789012:role/service-role/MyTestFunction-role-zgur6bf4", 
      runtime: "nodejs10.x", 
      timeout: 3, 
      tracing_config: {
        mode: "PassThrough", 
      }, 
      version: "$LATEST", 
    }, 
    {
      code_sha_256: "sU0cJ2/hOZevwV/lTxCuQqK3gDZP3i8gUoqUUVRmY6E=", 
      code_size: 266, 
      description: "", 
      function_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
      function_name: "my-function", 
      handler: "index.handler", 
      last_modified: Time.parse("2019-10-01T16:47:28.490+0000"), 
      memory_size: 256, 
      revision_id: "93017fc9-59cb-41dc-901b-4845ce4bf668", 
      role: "arn:aws:iam::123456789012:role/service-role/helloWorldPython-role-uy3l9qyq", 
      runtime: "nodejs10.x", 
      timeout: 3, 
      tracing_config: {
        mode: "PassThrough", 
      }, 
      version: "$LATEST", 
      vpc_config: {
        security_group_ids: [
        ], 
        subnet_ids: [
        ], 
        vpc_id: "", 
      }, 
    }, 
  ], 
  next_marker: "", 
}

Request syntax with placeholder values


resp = client.list_functions({
  master_region: "MasterRegion",
  function_version: "ALL", # accepts ALL
  marker: "String",
  max_items: 1,
})

Response structure


resp.next_marker #=> String
resp.functions #=> Array
resp.functions[0].function_name #=> String
resp.functions[0].function_arn #=> String
resp.functions[0].runtime #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.functions[0].role #=> String
resp.functions[0].handler #=> String
resp.functions[0].code_size #=> Integer
resp.functions[0].description #=> String
resp.functions[0].timeout #=> Integer
resp.functions[0].memory_size #=> Integer
resp.functions[0].last_modified #=> Time
resp.functions[0].code_sha_256 #=> String
resp.functions[0].version #=> String
resp.functions[0].vpc_config.subnet_ids #=> Array
resp.functions[0].vpc_config.subnet_ids[0] #=> String
resp.functions[0].vpc_config.security_group_ids #=> Array
resp.functions[0].vpc_config.security_group_ids[0] #=> String
resp.functions[0].vpc_config.vpc_id #=> String
resp.functions[0].dead_letter_config.target_arn #=> String
resp.functions[0].environment.variables #=> Hash
resp.functions[0].environment.variables["EnvironmentVariableName"] #=> String
resp.functions[0].environment.error.error_code #=> String
resp.functions[0].environment.error.message #=> String
resp.functions[0].kms_key_arn #=> String
resp.functions[0].tracing_config.mode #=> String, one of "Active", "PassThrough"
resp.functions[0].master_arn #=> String
resp.functions[0].revision_id #=> String
resp.functions[0].layers #=> Array
resp.functions[0].layers[0].arn #=> String
resp.functions[0].layers[0].code_size #=> Integer
resp.functions[0].state #=> String, one of "Pending", "Active", "Inactive", "Failed"
resp.functions[0].state_reason #=> String
resp.functions[0].state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.functions[0].last_update_status #=> String, one of "Successful", "Failed", "InProgress"
resp.functions[0].last_update_status_reason #=> String
resp.functions[0].last_update_status_reason_code #=> String, one of "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.functions[0].file_system_configs #=> Array
resp.functions[0].file_system_configs[0].arn #=> String
resp.functions[0].file_system_configs[0].local_mount_path #=> String

Options Hash (options):

  • :master_region (String)

    For Lambda@Edge functions, the AWS Region of the master function. For example, us-east-1 filters the list of functions to only include Lambda@Edge functions replicated from a master function in US East (N. Virginia). If specified, you must set FunctionVersion to ALL.

  • :function_version (String)

    Set to ALL to include entries for all published versions of each function.

  • :marker (String)

    Specify the pagination token that\'s returned by a previous request to retrieve the next page of results.

  • :max_items (Integer)

    The maximum number of functions to return.

Returns:

See Also:

#list_layer_versions(options = {}) ⇒ Types::ListLayerVersionsResponse

Lists the versions of an AWS Lambda layer. Versions that have been deleted aren't listed. Specify a runtime identifier to list only versions that indicate that they're compatible with that runtime.

Examples:

Example: To list versions of a layer


# The following example displays information about the versions for the layer named blank-java-lib

resp = client.list_layer_versions({
  layer_name: "blank-java-lib", 
})

# resp.to_h outputs the following:
{
  layer_versions: [
    {
      compatible_runtimes: [
        "java8", 
      ], 
      created_date: Time.parse("2020-03-18T23:38:42.284+0000"), 
      description: "Dependencies for the blank-java sample app.", 
      layer_version_arn: "arn:aws:lambda:us-east-2:123456789012:layer:blank-java-lib:7", 
      version: 7, 
    }, 
    {
      compatible_runtimes: [
        "java8", 
      ], 
      created_date: Time.parse("2020-03-17T07:24:21.960+0000"), 
      description: "Dependencies for the blank-java sample app.", 
      layer_version_arn: "arn:aws:lambda:us-east-2:123456789012:layer:blank-java-lib:6", 
      version: 6, 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_layer_versions({
  compatible_runtime: "nodejs", # accepts nodejs, nodejs4.3, nodejs6.10, nodejs8.10, nodejs10.x, nodejs12.x, java8, java8.al2, java11, python2.7, python3.6, python3.7, python3.8, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, dotnetcore3.1, nodejs4.3-edge, go1.x, ruby2.5, ruby2.7, provided, provided.al2
  layer_name: "LayerName", # required
  marker: "String",
  max_items: 1,
})

Response structure


resp.next_marker #=> String
resp.layer_versions #=> Array
resp.layer_versions[0].layer_version_arn #=> String
resp.layer_versions[0].version #=> Integer
resp.layer_versions[0].description #=> String
resp.layer_versions[0].created_date #=> Time
resp.layer_versions[0].compatible_runtimes #=> Array
resp.layer_versions[0].compatible_runtimes[0] #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.layer_versions[0].license_info #=> String

Options Hash (options):

  • :compatible_runtime (String)

    A runtime identifier. For example, go1.x.

  • :layer_name (required, String)

    The name or Amazon Resource Name (ARN) of the layer.

  • :marker (String)

    A pagination token returned by a previous call.

  • :max_items (Integer)

    The maximum number of versions to return.

Returns:

See Also:

#list_layers(options = {}) ⇒ Types::ListLayersResponse

Lists AWS Lambda layers and shows information about the latest version of each. Specify a runtime identifier to list only layers that indicate that they're compatible with that runtime.

Examples:

Example: To list the layers that are compatible with your function's runtime


# The following example returns information about layers that are compatible with the Python 3.7 runtime.

resp = client.list_layers({
  compatible_runtime: "python3.7", 
})

# resp.to_h outputs the following:
{
  layers: [
    {
      latest_matching_version: {
        compatible_runtimes: [
          "python3.6", 
          "python3.7", 
        ], 
        created_date: Time.parse("2018-11-15T00:37:46.592+0000"), 
        description: "My layer", 
        layer_version_arn: "arn:aws:lambda:us-east-2:123456789012:layer:my-layer:2", 
        version: 2, 
      }, 
      layer_arn: "arn:aws:lambda:us-east-2:123456789012:layer:my-layer", 
      layer_name: "my-layer", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_layers({
  compatible_runtime: "nodejs", # accepts nodejs, nodejs4.3, nodejs6.10, nodejs8.10, nodejs10.x, nodejs12.x, java8, java8.al2, java11, python2.7, python3.6, python3.7, python3.8, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, dotnetcore3.1, nodejs4.3-edge, go1.x, ruby2.5, ruby2.7, provided, provided.al2
  marker: "String",
  max_items: 1,
})

Response structure


resp.next_marker #=> String
resp.layers #=> Array
resp.layers[0].layer_name #=> String
resp.layers[0].layer_arn #=> String
resp.layers[0].latest_matching_version.layer_version_arn #=> String
resp.layers[0].latest_matching_version.version #=> Integer
resp.layers[0].latest_matching_version.description #=> String
resp.layers[0].latest_matching_version.created_date #=> Time
resp.layers[0].latest_matching_version.compatible_runtimes #=> Array
resp.layers[0].latest_matching_version.compatible_runtimes[0] #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.layers[0].latest_matching_version.license_info #=> String

Options Hash (options):

  • :compatible_runtime (String)

    A runtime identifier. For example, go1.x.

  • :marker (String)

    A pagination token returned by a previous call.

  • :max_items (Integer)

    The maximum number of layers to return.

Returns:

See Also:

#list_provisioned_concurrency_configs(options = {}) ⇒ Types::ListProvisionedConcurrencyConfigsResponse

Retrieves a list of provisioned concurrency configurations for a function.

Examples:

Example: To get a list of provisioned concurrency configurations


# The following example returns a list of provisioned concurrency configurations for a function named my-function.

resp = client.list_provisioned_concurrency_configs({
  function_name: "my-function", 
})

# resp.to_h outputs the following:
{
  provisioned_concurrency_configs: [
    {
      allocated_provisioned_concurrent_executions: 100, 
      available_provisioned_concurrent_executions: 100, 
      function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:GREEN", 
      last_modified: Time.parse("2019-12-31T20:29:00+0000"), 
      requested_provisioned_concurrent_executions: 100, 
      status: "READY", 
    }, 
    {
      allocated_provisioned_concurrent_executions: 100, 
      available_provisioned_concurrent_executions: 100, 
      function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:BLUE", 
      last_modified: Time.parse("2019-12-31T20:28:49+0000"), 
      requested_provisioned_concurrent_executions: 100, 
      status: "READY", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_provisioned_concurrency_configs({
  function_name: "FunctionName", # required
  marker: "String",
  max_items: 1,
})

Response structure


resp.provisioned_concurrency_configs #=> Array
resp.provisioned_concurrency_configs[0].function_arn #=> String
resp.provisioned_concurrency_configs[0].requested_provisioned_concurrent_executions #=> Integer
resp.provisioned_concurrency_configs[0].available_provisioned_concurrent_executions #=> Integer
resp.provisioned_concurrency_configs[0].allocated_provisioned_concurrent_executions #=> Integer
resp.provisioned_concurrency_configs[0].status #=> String, one of "IN_PROGRESS", "READY", "FAILED"
resp.provisioned_concurrency_configs[0].status_reason #=> String
resp.provisioned_concurrency_configs[0].last_modified #=> Time
resp.next_marker #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :marker (String)

    Specify the pagination token that\'s returned by a previous request to retrieve the next page of results.

  • :max_items (Integer)

    Specify a number to limit the number of configurations returned.

Returns:

See Also:

#list_tags(options = {}) ⇒ Types::ListTagsResponse

Returns a function's tags. You can also view tags with GetFunction.

Examples:

Example: To retrieve the list of tags for a Lambda function


# The following example displays the tags attached to the my-function Lambda function.

resp = client.list_tags({
  resource: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
})

# resp.to_h outputs the following:
{
  tags: {
    "Category" => "Web Tools", 
    "Department" => "Sales", 
  }, 
}

Request syntax with placeholder values


resp = client.list_tags({
  resource: "FunctionArn", # required
})

Response structure


resp.tags #=> Hash
resp.tags["TagKey"] #=> String

Options Hash (options):

  • :resource (required, String)

    The function\'s Amazon Resource Name (ARN).

Returns:

See Also:

#list_versions_by_function(options = {}) ⇒ Types::ListVersionsByFunctionResponse

Returns a list of versions, with the version-specific configuration of each. Lambda returns up to 50 versions per call.

Examples:

Example: To list versions of a function


# The following example returns a list of versions of a function named my-function

resp = client.list_versions_by_function({
  function_name: "my-function", 
})

# resp.to_h outputs the following:
{
  versions: [
    {
      code_sha_256: "YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=", 
      code_size: 5797206, 
      description: "Process image objects from Amazon S3.", 
      environment: {
        variables: {
          "BUCKET" => "my-bucket-1xpuxmplzrlbh", 
          "PREFIX" => "inbound", 
        }, 
      }, 
      function_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
      function_name: "my-function", 
      handler: "index.handler", 
      kms_key_arn: "arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966", 
      last_modified: Time.parse("2020-04-10T19:06:32.563+0000"), 
      memory_size: 256, 
      revision_id: "850ca006-2d98-4ff4-86db-8766e9d32fe9", 
      role: "arn:aws:iam::123456789012:role/lambda-role", 
      runtime: "nodejs12.x", 
      timeout: 15, 
      tracing_config: {
        mode: "Active", 
      }, 
      version: "$LATEST", 
    }, 
    {
      code_sha_256: "YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=", 
      code_size: 5797206, 
      description: "Process image objects from Amazon S3.", 
      environment: {
        variables: {
          "BUCKET" => "my-bucket-1xpuxmplzrlbh", 
          "PREFIX" => "inbound", 
        }, 
      }, 
      function_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
      function_name: "my-function", 
      handler: "index.handler", 
      kms_key_arn: "arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966", 
      last_modified: Time.parse("2020-04-10T19:06:32.563+0000"), 
      memory_size: 256, 
      revision_id: "b75dcd81-xmpl-48a8-a75a-93ba8b5b9727", 
      role: "arn:aws:iam::123456789012:role/lambda-role", 
      runtime: "nodejs12.x", 
      timeout: 5, 
      tracing_config: {
        mode: "Active", 
      }, 
      version: "1", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_versions_by_function({
  function_name: "NamespacedFunctionName", # required
  marker: "String",
  max_items: 1,
})

Response structure


resp.next_marker #=> String
resp.versions #=> Array
resp.versions[0].function_name #=> String
resp.versions[0].function_arn #=> String
resp.versions[0].runtime #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.versions[0].role #=> String
resp.versions[0].handler #=> String
resp.versions[0].code_size #=> Integer
resp.versions[0].description #=> String
resp.versions[0].timeout #=> Integer
resp.versions[0].memory_size #=> Integer
resp.versions[0].last_modified #=> Time
resp.versions[0].code_sha_256 #=> String
resp.versions[0].version #=> String
resp.versions[0].vpc_config.subnet_ids #=> Array
resp.versions[0].vpc_config.subnet_ids[0] #=> String
resp.versions[0].vpc_config.security_group_ids #=> Array
resp.versions[0].vpc_config.security_group_ids[0] #=> String
resp.versions[0].vpc_config.vpc_id #=> String
resp.versions[0].dead_letter_config.target_arn #=> String
resp.versions[0].environment.variables #=> Hash
resp.versions[0].environment.variables["EnvironmentVariableName"] #=> String
resp.versions[0].environment.error.error_code #=> String
resp.versions[0].environment.error.message #=> String
resp.versions[0].kms_key_arn #=> String
resp.versions[0].tracing_config.mode #=> String, one of "Active", "PassThrough"
resp.versions[0].master_arn #=> String
resp.versions[0].revision_id #=> String
resp.versions[0].layers #=> Array
resp.versions[0].layers[0].arn #=> String
resp.versions[0].layers[0].code_size #=> Integer
resp.versions[0].state #=> String, one of "Pending", "Active", "Inactive", "Failed"
resp.versions[0].state_reason #=> String
resp.versions[0].state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.versions[0].last_update_status #=> String, one of "Successful", "Failed", "InProgress"
resp.versions[0].last_update_status_reason #=> String
resp.versions[0].last_update_status_reason_code #=> String, one of "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.versions[0].file_system_configs #=> Array
resp.versions[0].file_system_configs[0].arn #=> String
resp.versions[0].file_system_configs[0].local_mount_path #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :marker (String)

    Specify the pagination token that\'s returned by a previous request to retrieve the next page of results.

  • :max_items (Integer)

    The maximum number of versions to return.

Returns:

See Also:

#publish_layer_version(options = {}) ⇒ Types::PublishLayerVersionResponse

Creates an AWS Lambda layer from a ZIP archive. Each time you call PublishLayerVersion with the same layer name, a new version is created.

Add layers to your function with CreateFunction or UpdateFunctionConfiguration.

Examples:

Example: To create a Lambda layer version


# The following example creates a new Python library layer version. The command retrieves the layer content a file named layer.zip in the specified S3 bucket.

resp = client.publish_layer_version({
  compatible_runtimes: [
    "python3.6", 
    "python3.7", 
  ], 
  content: {
    s3_bucket: "lambda-layers-us-west-2-123456789012", 
    s3_key: "layer.zip", 
  }, 
  description: "My Python layer", 
  layer_name: "my-layer", 
  license_info: "MIT", 
})

# resp.to_h outputs the following:
{
  compatible_runtimes: [
    "python3.6", 
    "python3.7", 
  ], 
  content: {
    code_sha_256: "tv9jJO+rPbXUUXuRKi7CwHzKtLDkDRJLB3cC3Z/ouXo=", 
    code_size: 169, 
    location: "https://awslambda-us-west-2-layers.s3.us-west-2.amazonaws.com/snapshots/123456789012/my-layer-4aaa2fbb-ff77-4b0a-ad92-5b78a716a96a?versionId=27iWyA73cCAYqyH...", 
  }, 
  created_date: Time.parse("2018-11-14T23:03:52.894+0000"), 
  description: "My Python layer", 
  layer_arn: "arn:aws:lambda:us-west-2:123456789012:layer:my-layer", 
  layer_version_arn: "arn:aws:lambda:us-west-2:123456789012:layer:my-layer:1", 
  license_info: "MIT", 
  version: 1, 
}

Request syntax with placeholder values


resp = client.publish_layer_version({
  layer_name: "LayerName", # required
  description: "Description",
  content: { # required
    s3_bucket: "S3Bucket",
    s3_key: "S3Key",
    s3_object_version: "S3ObjectVersion",
    zip_file: "data",
  },
  compatible_runtimes: ["nodejs"], # accepts nodejs, nodejs4.3, nodejs6.10, nodejs8.10, nodejs10.x, nodejs12.x, java8, java8.al2, java11, python2.7, python3.6, python3.7, python3.8, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, dotnetcore3.1, nodejs4.3-edge, go1.x, ruby2.5, ruby2.7, provided, provided.al2
  license_info: "LicenseInfo",
})

Response structure


resp.content.location #=> String
resp.content.code_sha_256 #=> String
resp.content.code_size #=> Integer
resp.layer_arn #=> String
resp.layer_version_arn #=> String
resp.description #=> String
resp.created_date #=> Time
resp.version #=> Integer
resp.compatible_runtimes #=> Array
resp.compatible_runtimes[0] #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.license_info #=> String

Options Hash (options):

  • :layer_name (required, String)

    The name or Amazon Resource Name (ARN) of the layer.

  • :description (String)

    The description of the version.

  • :content (required, Types::LayerVersionContentInput)

    The function layer archive.

  • :compatible_runtimes (Array<String>)

    A list of compatible function runtimes. Used for filtering with ListLayers and ListLayerVersions.

  • :license_info (String)

    The layer\'s software license. It can be any of the following:

    • An SPDX license identifier. For example, MIT.

    • The URL of a license hosted on the internet. For example, https://opensource.org/licenses/MIT.

    • The full text of the license.

Returns:

See Also:

#publish_version(options = {}) ⇒ Types::FunctionConfiguration

Creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn't change.

AWS Lambda doesn't publish a version if the function's configuration and code haven't changed since the last version. Use UpdateFunctionCode or UpdateFunctionConfiguration to update the function before publishing a version.

Clients can invoke versions directly or with an alias. To create an alias, use CreateAlias.

Examples:

Example: To publish a version of a Lambda function


# This operation publishes a version of a Lambda function

resp = client.publish_version({
  code_sha_256: "", 
  description: "", 
  function_name: "myFunction", 
})

# resp.to_h outputs the following:
{
  code_sha_256: "YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=", 
  code_size: 5797206, 
  description: "Process image objects from Amazon S3.", 
  environment: {
    variables: {
      "BUCKET" => "my-bucket-1xpuxmplzrlbh", 
      "PREFIX" => "inbound", 
    }, 
  }, 
  function_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
  function_name: "my-function", 
  handler: "index.handler", 
  kms_key_arn: "arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966", 
  last_modified: Time.parse("2020-04-10T19:06:32.563+0000"), 
  last_update_status: "Successful", 
  memory_size: 256, 
  revision_id: "b75dcd81-xmpl-48a8-a75a-93ba8b5b9727", 
  role: "arn:aws:iam::123456789012:role/lambda-role", 
  runtime: "nodejs12.x", 
  state: "Active", 
  timeout: 5, 
  tracing_config: {
    mode: "Active", 
  }, 
  version: "1", 
}

Request syntax with placeholder values


resp = client.publish_version({
  function_name: "FunctionName", # required
  code_sha_256: "String",
  description: "Description",
  revision_id: "String",
})

Response structure


resp.function_name #=> String
resp.function_arn #=> String
resp.runtime #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.role #=> String
resp.handler #=> String
resp.code_size #=> Integer
resp.description #=> String
resp.timeout #=> Integer
resp.memory_size #=> Integer
resp.last_modified #=> Time
resp.code_sha_256 #=> String
resp.version #=> String
resp.vpc_config.subnet_ids #=> Array
resp.vpc_config.subnet_ids[0] #=> String
resp.vpc_config.security_group_ids #=> Array
resp.vpc_config.security_group_ids[0] #=> String
resp.vpc_config.vpc_id #=> String
resp.dead_letter_config.target_arn #=> String
resp.environment.variables #=> Hash
resp.environment.variables["EnvironmentVariableName"] #=> String
resp.environment.error.error_code #=> String
resp.environment.error.message #=> String
resp.kms_key_arn #=> String
resp.tracing_config.mode #=> String, one of "Active", "PassThrough"
resp.master_arn #=> String
resp.revision_id #=> String
resp.layers #=> Array
resp.layers[0].arn #=> String
resp.layers[0].code_size #=> Integer
resp.state #=> String, one of "Pending", "Active", "Inactive", "Failed"
resp.state_reason #=> String
resp.state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.last_update_status #=> String, one of "Successful", "Failed", "InProgress"
resp.last_update_status_reason #=> String
resp.last_update_status_reason_code #=> String, one of "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.file_system_configs #=> Array
resp.file_system_configs[0].arn #=> String
resp.file_system_configs[0].local_mount_path #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :code_sha_256 (String)

    Only publish a version if the hash value matches the value that\'s specified. Use this option to avoid publishing a version if the function code has changed since you last updated it. You can get the hash for the version that you uploaded from the output of UpdateFunctionCode.

  • :description (String)

    A description for the version to override the description in the function configuration.

  • :revision_id (String)

    Only update the function if the revision ID matches the ID that\'s specified. Use this option to avoid publishing a version if the function configuration has changed since you last updated it.

Returns:

See Also:

#put_function_concurrency(options = {}) ⇒ Types::Concurrency

Sets the maximum number of simultaneous executions for a function, and reserves capacity for that concurrency level.

Concurrency settings apply to the function as a whole, including all published versions and the unpublished version. Reserving concurrency both ensures that your function has capacity to process the specified number of events simultaneously, and prevents it from scaling beyond that level. Use GetFunction to see the current setting for a function.

Use GetAccountSettings to see your Regional concurrency limit. You can reserve concurrency for as many functions as you like, as long as you leave at least 100 simultaneous executions unreserved for functions that aren't configured with a per-function limit. For more information, see Managing Concurrency.

Examples:

Example: To configure a reserved concurrency limit for a function


# The following example configures 100 reserved concurrent executions for the my-function function.

resp = client.put_function_concurrency({
  function_name: "my-function", 
  reserved_concurrent_executions: 100, 
})

# resp.to_h outputs the following:
{
  reserved_concurrent_executions: 100, 
}

Request syntax with placeholder values


resp = client.put_function_concurrency({
  function_name: "FunctionName", # required
  reserved_concurrent_executions: 1, # required
})

Response structure


resp.reserved_concurrent_executions #=> Integer

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :reserved_concurrent_executions (required, Integer)

    The number of simultaneous executions to reserve for the function.

Returns:

See Also:

#put_function_event_invoke_config(options = {}) ⇒ Types::FunctionEventInvokeConfig

Configures options for asynchronous invocation on a function, version, or alias. If a configuration already exists for a function, version, or alias, this operation overwrites it. If you exclude any settings, they are removed. To set one option without affecting existing settings for other options, use UpdateFunctionEventInvokeConfig.

By default, Lambda retries an asynchronous invocation twice if the function returns an error. It retains events in a queue for up to six hours. When an event fails all processing attempts or stays in the asynchronous invocation queue for too long, Lambda discards it. To retain discarded events, configure a dead-letter queue with UpdateFunctionConfiguration.

To send an invocation record to a queue, topic, function, or event bus, specify a destination. You can configure separate destinations for successful invocations (on-success) and events that fail all processing attempts (on-failure). You can configure destinations in addition to or instead of a dead-letter queue.

Examples:

Example: To configure error handling for asynchronous invocation


# The following example sets a maximum event age of one hour and disables retries for the specified function.

resp = client.put_function_event_invoke_config({
  function_name: "my-function", 
  maximum_event_age_in_seconds: 3600, 
  maximum_retry_attempts: 0, 
})

# resp.to_h outputs the following:
{
  destination_config: {
    on_failure: {
    }, 
    on_success: {
    }, 
  }, 
  function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:$LATEST", 
  last_modified: Time.parse("${timestamp}"), 
  maximum_event_age_in_seconds: 3600, 
  maximum_retry_attempts: 0, 
}

Request syntax with placeholder values


resp = client.put_function_event_invoke_config({
  function_name: "FunctionName", # required
  qualifier: "Qualifier",
  maximum_retry_attempts: 1,
  maximum_event_age_in_seconds: 1,
  destination_config: {
    on_success: {
      destination: "DestinationArn",
    },
    on_failure: {
      destination: "DestinationArn",
    },
  },
})

Response structure


resp.last_modified #=> Time
resp.function_arn #=> String
resp.maximum_retry_attempts #=> Integer
resp.maximum_event_age_in_seconds #=> Integer
resp.destination_config.on_success.destination #=> String
resp.destination_config.on_failure.destination #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (String)

    A version number or alias name.

  • :maximum_retry_attempts (Integer)

    The maximum number of times to retry when the function returns an error.

  • :maximum_event_age_in_seconds (Integer)

    The maximum age of a request that Lambda sends to a function for processing.

  • :destination_config (Types::DestinationConfig)

    A destination for events after they have been sent to a function for processing.

    Destinations .title

    • Function - The Amazon Resource Name (ARN) of a Lambda function.

    • Queue - The ARN of an SQS queue.

    • Topic - The ARN of an SNS topic.

    • Event Bus - The ARN of an Amazon EventBridge event bus.

Returns:

See Also:

#put_provisioned_concurrency_config(options = {}) ⇒ Types::PutProvisionedConcurrencyConfigResponse

Adds a provisioned concurrency configuration to a function's alias or version.

Examples:

Example: To allocate provisioned concurrency


# The following example allocates 100 provisioned concurrency for the BLUE alias of the specified function.

resp = client.put_provisioned_concurrency_config({
  function_name: "my-function", 
  provisioned_concurrent_executions: 100, 
  qualifier: "BLUE", 
})

# resp.to_h outputs the following:
{
  allocated_provisioned_concurrent_executions: 0, 
  last_modified: Time.parse("2019-11-21T19:32:12+0000"), 
  requested_provisioned_concurrent_executions: 100, 
  status: "IN_PROGRESS", 
}

Request syntax with placeholder values


resp = client.put_provisioned_concurrency_config({
  function_name: "FunctionName", # required
  qualifier: "Qualifier", # required
  provisioned_concurrent_executions: 1, # required
})

Response structure


resp.requested_provisioned_concurrent_executions #=> Integer
resp.available_provisioned_concurrent_executions #=> Integer
resp.allocated_provisioned_concurrent_executions #=> Integer
resp.status #=> String, one of "IN_PROGRESS", "READY", "FAILED"
resp.status_reason #=> String
resp.last_modified #=> Time

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (required, String)

    The version number or alias name.

  • :provisioned_concurrent_executions (required, Integer)

    The amount of provisioned concurrency to allocate for the version or alias.

Returns:

See Also:

#remove_layer_version_permission(options = {}) ⇒ Struct

Removes a statement from the permissions policy for a version of an AWS Lambda layer. For more information, see AddLayerVersionPermission.

Examples:

Example: To delete layer-version permissions


# The following example deletes permission for an account to configure a layer version.

resp = client.remove_layer_version_permission({
  layer_name: "my-layer", 
  statement_id: "xaccount", 
  version_number: 1, 
})

Request syntax with placeholder values


resp = client.remove_layer_version_permission({
  layer_name: "LayerName", # required
  version_number: 1, # required
  statement_id: "StatementId", # required
  revision_id: "String",
})

Options Hash (options):

  • :layer_name (required, String)

    The name or Amazon Resource Name (ARN) of the layer.

  • :version_number (required, Integer)

    The version number.

  • :statement_id (required, String)

    The identifier that was specified when the statement was added.

  • :revision_id (String)

    Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#remove_permission(options = {}) ⇒ Struct

Revokes function-use permission from an AWS service or another account. You can get the ID of the statement from the output of GetPolicy.

Examples:

Example: To remove a Lambda function's permissions


# The following example removes a permissions statement named xaccount from the PROD alias of a function named my-function.

resp = client.remove_permission({
  function_name: "my-function", 
  qualifier: "PROD", 
  statement_id: "xaccount", 
})

Request syntax with placeholder values


resp = client.remove_permission({
  function_name: "FunctionName", # required
  statement_id: "NamespacedStatementId", # required
  qualifier: "Qualifier",
  revision_id: "String",
})

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :statement_id (required, String)

    Statement ID of the permission to remove.

  • :qualifier (String)

    Specify a version or alias to remove permissions from a published version of the function.

  • :revision_id (String)

    Only update the policy if the revision ID matches the ID that\'s specified. Use this option to avoid modifying a policy that has changed since you last read it.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#tag_resource(options = {}) ⇒ Struct

Adds tags to a function.

Examples:

Example: To add tags to an existing Lambda function


# The following example adds a tag with the key name DEPARTMENT and a value of 'Department A' to the specified Lambda function.

resp = client.tag_resource({
  resource: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
  tags: {
    "DEPARTMENT" => "Department A", 
  }, 
})

Request syntax with placeholder values


resp = client.tag_resource({
  resource: "FunctionArn", # required
  tags: { # required
    "TagKey" => "TagValue",
  },
})

Options Hash (options):

  • :resource (required, String)

    The function\'s Amazon Resource Name (ARN).

  • :tags (required, Hash<String,String>)

    A list of tags to apply to the function.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#untag_resource(options = {}) ⇒ Struct

Removes tags from a function.

Examples:

Example: To remove tags from an existing Lambda function


# The following example removes the tag with the key name DEPARTMENT tag from the my-function Lambda function.

resp = client.untag_resource({
  resource: "arn:aws:lambda:us-west-2:123456789012:function:my-function", 
  tag_keys: [
    "DEPARTMENT", 
  ], 
})

Request syntax with placeholder values


resp = client.untag_resource({
  resource: "FunctionArn", # required
  tag_keys: ["TagKey"], # required
})

Options Hash (options):

  • :resource (required, String)

    The function\'s Amazon Resource Name (ARN).

  • :tag_keys (required, Array<String>)

    A list of tag keys to remove from the function.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#update_alias(options = {}) ⇒ Types::AliasConfiguration

Updates the configuration of a Lambda function alias.

Examples:

Example: To update a function alias


# The following example updates the alias named BLUE to send 30% of traffic to version 2 and 70% to version 1.

resp = client.update_alias({
  function_name: "my-function", 
  function_version: "2", 
  name: "BLUE", 
  routing_config: {
    additional_version_weights: {
      "1" => 0.7, 
    }, 
  }, 
})

# resp.to_h outputs the following:
{
  alias_arn: "arn:aws:lambda:us-west-2:123456789012:function:my-function:BLUE", 
  description: "Production environment BLUE.", 
  function_version: "2", 
  name: "BLUE", 
  revision_id: "594f41fb-xmpl-4c20-95c7-6ca5f2a92c93", 
  routing_config: {
    additional_version_weights: {
      "1" => 0.7, 
    }, 
  }, 
}

Request syntax with placeholder values


resp = client.update_alias({
  function_name: "FunctionName", # required
  name: "Alias", # required
  function_version: "Version",
  description: "Description",
  routing_config: {
    additional_version_weights: {
      "AdditionalVersion" => 1.0,
    },
  },
  revision_id: "String",
})

Response structure


resp.alias_arn #=> String
resp.name #=> String
resp.function_version #=> String
resp.description #=> String
resp.routing_config.additional_version_weights #=> Hash
resp.routing_config.additional_version_weights["AdditionalVersion"] #=> Float
resp.revision_id #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :name (required, String)

    The name of the alias.

  • :function_version (String)

    The function version that the alias invokes.

  • :description (String)

    A description of the alias.

  • :routing_config (Types::AliasRoutingConfiguration)

    The routing configuration of the alias.

  • :revision_id (String)

    Only update the alias if the revision ID matches the ID that\'s specified. Use this option to avoid modifying an alias that has changed since you last read it.

Returns:

See Also:

#update_event_source_mapping(options = {}) ⇒ Types::EventSourceMappingConfiguration

Updates an event source mapping. You can change the function that AWS Lambda invokes, or pause invocation and resume later from the same location.

The following error handling options are only available for stream sources (DynamoDB and Kinesis):

  • BisectBatchOnFunctionError - If the function returns an error, split the batch in two and retry.

  • DestinationConfig - Send discarded records to an Amazon SQS queue or Amazon SNS topic.

  • MaximumRecordAgeInSeconds - Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires

  • MaximumRetryAttempts - Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires.

  • ParallelizationFactor - Process multiple batches from each shard concurrently.

Examples:

Example: To update a Lambda function event source mapping


# This operation updates a Lambda function event source mapping

resp = client.update_event_source_mapping({
  batch_size: 123, 
  enabled: true, 
  function_name: "myFunction", 
  uuid: "1234xCy789012", 
})

# resp.to_h outputs the following:
{
  batch_size: 123, 
  event_source_arn: "arn:aws:s3:::examplebucket/*", 
  function_arn: "arn:aws:lambda:us-west-2:123456789012:function:myFunction", 
  last_modified: Time.parse("2016-11-21T19:49:20.006+0000"), 
  last_processing_result: "", 
  state: "", 
  state_transition_reason: "", 
  uuid: "1234xCy789012", 
}

Request syntax with placeholder values


resp = client.update_event_source_mapping({
  uuid: "String", # required
  function_name: "FunctionName",
  enabled: false,
  batch_size: 1,
  maximum_batching_window_in_seconds: 1,
  destination_config: {
    on_success: {
      destination: "DestinationArn",
    },
    on_failure: {
      destination: "DestinationArn",
    },
  },
  maximum_record_age_in_seconds: 1,
  bisect_batch_on_function_error: false,
  maximum_retry_attempts: 1,
  parallelization_factor: 1,
  source_access_configurations: [
    {
      type: "BASIC_AUTH", # accepts BASIC_AUTH
      uri: "Arn",
    },
  ],
})

Response structure


resp.uuid #=> String
resp.starting_position #=> String, one of "TRIM_HORIZON", "LATEST", "AT_TIMESTAMP"
resp.starting_position_timestamp #=> Time
resp.batch_size #=> Integer
resp.maximum_batching_window_in_seconds #=> Integer
resp.parallelization_factor #=> Integer
resp.event_source_arn #=> String
resp.function_arn #=> String
resp.last_modified #=> Time
resp.last_processing_result #=> String
resp.state #=> String
resp.state_transition_reason #=> String
resp.destination_config.on_success.destination #=> String
resp.destination_config.on_failure.destination #=> String
resp.topics #=> Array
resp.topics[0] #=> String
resp.queues #=> Array
resp.queues[0] #=> String
resp.source_access_configurations #=> Array
resp.source_access_configurations[0].type #=> String, one of "BASIC_AUTH"
resp.source_access_configurations[0].uri #=> String
resp.maximum_record_age_in_seconds #=> Integer
resp.bisect_batch_on_function_error #=> true/false
resp.maximum_retry_attempts #=> Integer

Options Hash (options):

  • :uuid (required, String)

    The identifier of the event source mapping.

  • :function_name (String)

    The name of the Lambda function.

    Name formats .title

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it\'s limited to 64 characters in length.

  • :enabled (Boolean)

    If true, the event source mapping is active. Set to false to pause polling and invocation.

  • :batch_size (Integer)

    The maximum number of items to retrieve in a single batch.

    • Amazon Kinesis - Default 100. Max 10,000.

    • Amazon DynamoDB Streams - Default 100. Max 1,000.

    • Amazon Simple Queue Service - Default 10. Max 10.

    • Amazon Managed Streaming for Apache Kafka - Default 100. Max 10,000.

  • :maximum_batching_window_in_seconds (Integer) — default: Streams

    The maximum amount of time to gather records before invoking the function, in seconds.

  • :destination_config (Types::DestinationConfig) — default: Streams

    An Amazon SQS queue or Amazon SNS topic destination for discarded records.

  • :maximum_record_age_in_seconds (Integer) — default: Streams

    Discard records older than the specified age. The default value is infinite (-1).

  • :bisect_batch_on_function_error (Boolean) — default: Streams

    If the function returns an error, split the batch in two and retry.

  • :maximum_retry_attempts (Integer) — default: Streams

    Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records will be retried until the record expires.

  • :parallelization_factor (Integer) — default: Streams

    The number of batches to process from each shard concurrently.

  • :source_access_configurations (Array<Types::SourceAccessConfiguration>) — default: MQ

    The Secrets Manager secret that stores your broker credentials. To store your secret, use the following format: { "username": "your username", "password": "your password" }

    To reference the secret, use the following format: [ { "Type": "BASIC_AUTH", "URI": "secretARN" } ]

    The value of Type is always BASIC_AUTH. To encrypt the secret, you can use customer or service managed keys. When using a customer managed KMS key, the Lambda execution role requires kms:Decrypt permissions.

Returns:

See Also:

#update_function_code(options = {}) ⇒ Types::FunctionConfiguration

Updates a Lambda function's code.

The function's code is locked when you publish a version. You can't modify the code of a published version, only the unpublished version.

Examples:

Example: To update a Lambda function's code


# The following example replaces the code of the unpublished ($LATEST) version of a function named my-function with the contents of the specified zip file in Amazon S3.

resp = client.update_function_code({
  function_name: "my-function", 
  s3_bucket: "my-bucket-1xpuxmplzrlbh", 
  s3_key: "function.zip", 
})

# resp.to_h outputs the following:
{
  code_sha_256: "PFn4S+er27qk+UuZSTKEQfNKG/XNn7QJs90mJgq6oH8=", 
  code_size: 308, 
  description: "", 
  function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function", 
  function_name: "my-function", 
  handler: "index.handler", 
  last_modified: Time.parse("2019-08-14T22:26:11.234+0000"), 
  memory_size: 128, 
  revision_id: "873282ed-xmpl-4dc8-a069-d0c647e470c6", 
  role: "arn:aws:iam::123456789012:role/lambda-role", 
  runtime: "nodejs12.x", 
  timeout: 3, 
  tracing_config: {
    mode: "PassThrough", 
  }, 
  version: "$LATEST", 
}

Request syntax with placeholder values


resp = client.update_function_code({
  function_name: "FunctionName", # required
  zip_file: "data",
  s3_bucket: "S3Bucket",
  s3_key: "S3Key",
  s3_object_version: "S3ObjectVersion",
  publish: false,
  dry_run: false,
  revision_id: "String",
})

Response structure


resp.function_name #=> String
resp.function_arn #=> String
resp.runtime #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.role #=> String
resp.handler #=> String
resp.code_size #=> Integer
resp.description #=> String
resp.timeout #=> Integer
resp.memory_size #=> Integer
resp.last_modified #=> Time
resp.code_sha_256 #=> String
resp.version #=> String
resp.vpc_config.subnet_ids #=> Array
resp.vpc_config.subnet_ids[0] #=> String
resp.vpc_config.security_group_ids #=> Array
resp.vpc_config.security_group_ids[0] #=> String
resp.vpc_config.vpc_id #=> String
resp.dead_letter_config.target_arn #=> String
resp.environment.variables #=> Hash
resp.environment.variables["EnvironmentVariableName"] #=> String
resp.environment.error.error_code #=> String
resp.environment.error.message #=> String
resp.kms_key_arn #=> String
resp.tracing_config.mode #=> String, one of "Active", "PassThrough"
resp.master_arn #=> String
resp.revision_id #=> String
resp.layers #=> Array
resp.layers[0].arn #=> String
resp.layers[0].code_size #=> Integer
resp.state #=> String, one of "Pending", "Active", "Inactive", "Failed"
resp.state_reason #=> String
resp.state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.last_update_status #=> String, one of "Successful", "Failed", "InProgress"
resp.last_update_status_reason #=> String
resp.last_update_status_reason_code #=> String, one of "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.file_system_configs #=> Array
resp.file_system_configs[0].arn #=> String
resp.file_system_configs[0].local_mount_path #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :zip_file (IO, String)

    .zip file containing your packaged source code.

  • :s3_bucket (String)

    An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account.

  • :s3_key (String)

    The Amazon S3 key of the deployment package.

  • :s3_object_version (String)

    For versioned objects, the version of the deployment package object to use.

  • :publish (Boolean)

    Set to true to publish a new version of the function after updating the code. This has the same effect as calling PublishVersion separately.

  • :dry_run (Boolean)

    Set to true to validate the request parameters and access permissions without modifying the function code.

  • :revision_id (String)

    Only update the function if the revision ID matches the ID that\'s specified. Use this option to avoid modifying a function that has changed since you last read it.

Returns:

See Also:

#update_function_configuration(options = {}) ⇒ Types::FunctionConfiguration

Modify the version-specific settings of a Lambda function.

When you update a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute. During this time, you can't modify the function, but you can still invoke it. The LastUpdateStatus, LastUpdateStatusReason, and LastUpdateStatusReasonCode fields in the response from GetFunctionConfiguration indicate when the update is complete and the function is processing events with the new configuration. For more information, see Function States.

These settings can vary between versions of a function and are locked when you publish a version. You can't modify the configuration of a published version, only the unpublished version.

To configure function concurrency, use PutFunctionConcurrency. To grant invoke permissions to an account or AWS service, use AddPermission.

Examples:

Example: To update a Lambda function's configuration


# The following example modifies the memory size to be 256 MB for the unpublished ($LATEST) version of a function named my-function.

resp = client.update_function_configuration({
  function_name: "my-function", 
  memory_size: 256, 
})

# resp.to_h outputs the following:
{
  code_sha_256: "PFn4S+er27qk+UuZSTKEQfNKG/XNn7QJs90mJgq6oH8=", 
  code_size: 308, 
  description: "", 
  function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function", 
  function_name: "my-function", 
  handler: "index.handler", 
  last_modified: Time.parse("2019-08-14T22:26:11.234+0000"), 
  memory_size: 256, 
  revision_id: "873282ed-xmpl-4dc8-a069-d0c647e470c6", 
  role: "arn:aws:iam::123456789012:role/lambda-role", 
  runtime: "nodejs12.x", 
  timeout: 3, 
  tracing_config: {
    mode: "PassThrough", 
  }, 
  version: "$LATEST", 
}

Request syntax with placeholder values


resp = client.update_function_configuration({
  function_name: "FunctionName", # required
  role: "RoleArn",
  handler: "Handler",
  description: "Description",
  timeout: 1,
  memory_size: 1,
  vpc_config: {
    subnet_ids: ["SubnetId"],
    security_group_ids: ["SecurityGroupId"],
  },
  environment: {
    variables: {
      "EnvironmentVariableName" => "EnvironmentVariableValue",
    },
  },
  runtime: "nodejs", # accepts nodejs, nodejs4.3, nodejs6.10, nodejs8.10, nodejs10.x, nodejs12.x, java8, java8.al2, java11, python2.7, python3.6, python3.7, python3.8, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, dotnetcore3.1, nodejs4.3-edge, go1.x, ruby2.5, ruby2.7, provided, provided.al2
  dead_letter_config: {
    target_arn: "ResourceArn",
  },
  kms_key_arn: "KMSKeyArn",
  tracing_config: {
    mode: "Active", # accepts Active, PassThrough
  },
  revision_id: "String",
  layers: ["LayerVersionArn"],
  file_system_configs: [
    {
      arn: "FileSystemArn", # required
      local_mount_path: "LocalMountPath", # required
    },
  ],
})

Response structure


resp.function_name #=> String
resp.function_arn #=> String
resp.runtime #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.role #=> String
resp.handler #=> String
resp.code_size #=> Integer
resp.description #=> String
resp.timeout #=> Integer
resp.memory_size #=> Integer
resp.last_modified #=> Time
resp.code_sha_256 #=> String
resp.version #=> String
resp.vpc_config.subnet_ids #=> Array
resp.vpc_config.subnet_ids[0] #=> String
resp.vpc_config.security_group_ids #=> Array
resp.vpc_config.security_group_ids[0] #=> String
resp.vpc_config.vpc_id #=> String
resp.dead_letter_config.target_arn #=> String
resp.environment.variables #=> Hash
resp.environment.variables["EnvironmentVariableName"] #=> String
resp.environment.error.error_code #=> String
resp.environment.error.message #=> String
resp.kms_key_arn #=> String
resp.tracing_config.mode #=> String, one of "Active", "PassThrough"
resp.master_arn #=> String
resp.revision_id #=> String
resp.layers #=> Array
resp.layers[0].arn #=> String
resp.layers[0].code_size #=> Integer
resp.state #=> String, one of "Pending", "Active", "Inactive", "Failed"
resp.state_reason #=> String
resp.state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.last_update_status #=> String, one of "Successful", "Failed", "InProgress"
resp.last_update_status_reason #=> String
resp.last_update_status_reason_code #=> String, one of "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup"
resp.file_system_configs #=> Array
resp.file_system_configs[0].arn #=> String
resp.file_system_configs[0].local_mount_path #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function.

    Name formats .title

    • Function name - my-function.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :role (String)

    The Amazon Resource Name (ARN) of the function\'s execution role.

  • :handler (String)

    The name of the method within your code that Lambda calls to execute your function. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see Programming Model.

  • :description (String)

    A description of the function.

  • :timeout (Integer)

    The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds.

  • :memory_size (Integer)

    The amount of memory that your function has access to. Increasing the function\'s memory also increases its CPU allocation. The default value is 128 MB. The value must be a multiple of 64 MB.

  • :vpc_config (Types::VpcConfig)

    For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets in the VPC. When you connect a function to a VPC, it can only access resources and the internet through that VPC. For more information, see VPC Settings.

  • :environment (Types::Environment)

    Environment variables that are accessible from function code during execution.

  • :runtime (String)

    The identifier of the function\'s runtime.

  • :dead_letter_config (Types::DeadLetterConfig)

    A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. For more information, see Dead Letter Queues.

  • :kms_key_arn (String)

    The ARN of the AWS Key Management Service (AWS KMS) key that\'s used to encrypt your function\'s environment variables. If it\'s not provided, AWS Lambda uses a default service key.

  • :tracing_config (Types::TracingConfig)

    Set Mode to Active to sample and trace a subset of incoming requests with AWS X-Ray.

  • :revision_id (String)

    Only update the function if the revision ID matches the ID that\'s specified. Use this option to avoid modifying a function that has changed since you last read it.

  • :layers (Array<String>)

    A list of function layers to add to the function\'s execution environment. Specify each layer by its ARN, including the version.

  • :file_system_configs (Array<Types::FileSystemConfig>)

    Connection settings for an Amazon EFS file system.

Returns:

See Also:

#update_function_event_invoke_config(options = {}) ⇒ Types::FunctionEventInvokeConfig

Updates the configuration for asynchronous invocation for a function, version, or alias.

To configure options for asynchronous invocation, use PutFunctionEventInvokeConfig.

Examples:

Example: To update an asynchronous invocation configuration


# The following example adds an on-failure destination to the existing asynchronous invocation configuration for a function named my-function.

resp = client.update_function_event_invoke_config({
  destination_config: {
    on_failure: {
      destination: "arn:aws:sqs:us-east-2:123456789012:destination", 
    }, 
  }, 
  function_name: "my-function", 
})

# resp.to_h outputs the following:
{
  destination_config: {
    on_failure: {
      destination: "arn:aws:sqs:us-east-2:123456789012:destination", 
    }, 
    on_success: {
    }, 
  }, 
  function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:$LATEST", 
  last_modified: Time.parse(1573687896.493), 
  maximum_event_age_in_seconds: 3600, 
  maximum_retry_attempts: 0, 
}

Request syntax with placeholder values


resp = client.update_function_event_invoke_config({
  function_name: "FunctionName", # required
  qualifier: "Qualifier",
  maximum_retry_attempts: 1,
  maximum_event_age_in_seconds: 1,
  destination_config: {
    on_success: {
      destination: "DestinationArn",
    },
    on_failure: {
      destination: "DestinationArn",
    },
  },
})

Response structure


resp.last_modified #=> Time
resp.function_arn #=> String
resp.maximum_retry_attempts #=> Integer
resp.maximum_event_age_in_seconds #=> Integer
resp.destination_config.on_success.destination #=> String
resp.destination_config.on_failure.destination #=> String

Options Hash (options):

  • :function_name (required, String)

    The name of the Lambda function, version, or alias.

    Name formats .title

    • Function name - my-function (name-only), my-function:v1 (with alias).

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN - 123456789012:function:my-function.

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • :qualifier (String)

    A version number or alias name.

  • :maximum_retry_attempts (Integer)

    The maximum number of times to retry when the function returns an error.

  • :maximum_event_age_in_seconds (Integer)

    The maximum age of a request that Lambda sends to a function for processing.

  • :destination_config (Types::DestinationConfig)

    A destination for events after they have been sent to a function for processing.

    Destinations .title

    • Function - The Amazon Resource Name (ARN) of a Lambda function.

    • Queue - The ARN of an SQS queue.

    • Topic - The ARN of an SNS topic.

    • Event Bus - The ARN of an Amazon EventBridge event bus.

Returns:

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

  • params (Hash) (defaults to: {})

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:
:function_active#get_function_configuration560
:function_exists#get_function120
:function_updated#get_function_configuration560

Returns:

  • (Array<Symbol>)

    the list of supported waiters.