Skip to content

LambdaClient#

Index > Lambda > LambdaClient

Auto-generated documentation for Lambda type annotations stubs module mypy-boto3-lambda.

LambdaClient#

Type annotations and code completion for boto3.client("lambda"). boto3 documentation

# LambdaClient usage example

from boto3.session import Session
from mypy_boto3_lambda.client import LambdaClient

def get_lambda_client() -> LambdaClient:
    return Session().client("lambda")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("lambda").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("lambda")

try:
    do_something(client)
except (
    client.exceptions.ClientError,
    client.exceptions.CodeSigningConfigNotFoundException,
    client.exceptions.CodeStorageExceededException,
    client.exceptions.CodeVerificationFailedException,
    client.exceptions.EC2AccessDeniedException,
    client.exceptions.EC2ThrottledException,
    client.exceptions.EC2UnexpectedException,
    client.exceptions.EFSIOException,
    client.exceptions.EFSMountConnectivityException,
    client.exceptions.EFSMountFailureException,
    client.exceptions.EFSMountTimeoutException,
    client.exceptions.ENILimitReachedException,
    client.exceptions.InvalidCodeSignatureException,
    client.exceptions.InvalidParameterValueException,
    client.exceptions.InvalidRequestContentException,
    client.exceptions.InvalidRuntimeException,
    client.exceptions.InvalidSecurityGroupIDException,
    client.exceptions.InvalidSubnetIDException,
    client.exceptions.InvalidZipFileException,
    client.exceptions.KMSAccessDeniedException,
    client.exceptions.KMSDisabledException,
    client.exceptions.KMSInvalidStateException,
    client.exceptions.KMSNotFoundException,
    client.exceptions.PolicyLengthExceededException,
    client.exceptions.PreconditionFailedException,
    client.exceptions.ProvisionedConcurrencyConfigNotFoundException,
    client.exceptions.RecursiveInvocationException,
    client.exceptions.RequestTooLargeException,
    client.exceptions.ResourceConflictException,
    client.exceptions.ResourceInUseException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.ResourceNotReadyException,
    client.exceptions.ServiceException,
    client.exceptions.SnapStartException,
    client.exceptions.SnapStartNotReadyException,
    client.exceptions.SnapStartTimeoutException,
    client.exceptions.SubnetIPAddressLimitReachedException,
    client.exceptions.TooManyRequestsException,
    client.exceptions.UnsupportedMediaTypeException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_lambda.client import Exceptions

def handle_error(exc: Exceptions.ClientError) -> None:
    ...

Methods#

add_layer_version_permission#

Adds permissions to the resource-based policy of a version of an Lambda layer.

Type annotations and code completion for boto3.client("lambda").add_layer_version_permission method. boto3 documentation

# add_layer_version_permission method definition

def add_layer_version_permission(
    self,
    *,
    LayerName: str,
    VersionNumber: int,
    StatementId: str,
    Action: str,
    Principal: str,
    OrganizationId: str = ...,
    RevisionId: str = ...,
) -> AddLayerVersionPermissionResponseTypeDef:  # (1)
    ...
  1. See AddLayerVersionPermissionResponseTypeDef
# add_layer_version_permission method usage example with argument unpacking

kwargs: AddLayerVersionPermissionRequestRequestTypeDef = {  # (1)
    "LayerName": ...,
    "VersionNumber": ...,
    "StatementId": ...,
    "Action": ...,
    "Principal": ...,
}

parent.add_layer_version_permission(**kwargs)
  1. See AddLayerVersionPermissionRequestRequestTypeDef

add_permission#

Grants an Amazon Web Service, Amazon Web Services account, or Amazon Web Services organization permission to use a function.

Type annotations and code completion for boto3.client("lambda").add_permission method. boto3 documentation

# add_permission method definition

def add_permission(
    self,
    *,
    FunctionName: str,
    StatementId: str,
    Action: str,
    Principal: str,
    SourceArn: str = ...,
    SourceAccount: str = ...,
    EventSourceToken: str = ...,
    Qualifier: str = ...,
    RevisionId: str = ...,
    PrincipalOrgID: str = ...,
    FunctionUrlAuthType: FunctionUrlAuthTypeType = ...,  # (1)
) -> AddPermissionResponseTypeDef:  # (2)
    ...
  1. See FunctionUrlAuthTypeType
  2. See AddPermissionResponseTypeDef
# add_permission method usage example with argument unpacking

kwargs: AddPermissionRequestRequestTypeDef = {  # (1)
    "FunctionName": ...,
    "StatementId": ...,
    "Action": ...,
    "Principal": ...,
}

parent.add_permission(**kwargs)
  1. See AddPermissionRequestRequestTypeDef

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("lambda").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("lambda").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

create_alias#

Creates an alias for a Lambda function version.

Type annotations and code completion for boto3.client("lambda").create_alias method. boto3 documentation

# create_alias method definition

def create_alias(
    self,
    *,
    FunctionName: str,
    Name: str,
    FunctionVersion: str,
    Description: str = ...,
    RoutingConfig: AliasRoutingConfigurationTypeDef = ...,  # (1)
) -> AliasConfigurationResponseTypeDef:  # (2)
    ...
  1. See AliasRoutingConfigurationTypeDef
  2. See AliasConfigurationResponseTypeDef
# create_alias method usage example with argument unpacking

kwargs: CreateAliasRequestRequestTypeDef = {  # (1)
    "FunctionName": ...,
    "Name": ...,
    "FunctionVersion": ...,
}

parent.create_alias(**kwargs)
  1. See CreateAliasRequestRequestTypeDef

create_code_signing_config#

Creates a code signing configuration.

Type annotations and code completion for boto3.client("lambda").create_code_signing_config method. boto3 documentation

# create_code_signing_config method definition

def create_code_signing_config(
    self,
    *,
    AllowedPublishers: AllowedPublishersTypeDef,  # (1)
    Description: str = ...,
    CodeSigningPolicies: CodeSigningPoliciesTypeDef = ...,  # (2)
) -> CreateCodeSigningConfigResponseTypeDef:  # (3)
    ...
  1. See AllowedPublishersTypeDef
  2. See CodeSigningPoliciesTypeDef
  3. See CreateCodeSigningConfigResponseTypeDef
# create_code_signing_config method usage example with argument unpacking

kwargs: CreateCodeSigningConfigRequestRequestTypeDef = {  # (1)
    "AllowedPublishers": ...,
}

parent.create_code_signing_config(**kwargs)
  1. See CreateCodeSigningConfigRequestRequestTypeDef

create_event_source_mapping#

Creates a mapping between an event source and an Lambda function.

Type annotations and code completion for boto3.client("lambda").create_event_source_mapping method. boto3 documentation

# create_event_source_mapping method definition

def create_event_source_mapping(
    self,
    *,
    FunctionName: str,
    EventSourceArn: str = ...,
    Enabled: bool = ...,
    BatchSize: int = ...,
    FilterCriteria: FilterCriteriaTypeDef = ...,  # (1)
    MaximumBatchingWindowInSeconds: int = ...,
    ParallelizationFactor: int = ...,
    StartingPosition: EventSourcePositionType = ...,  # (2)
    StartingPositionTimestamp: Union[datetime, str] = ...,
    DestinationConfig: DestinationConfigTypeDef = ...,  # (3)
    MaximumRecordAgeInSeconds: int = ...,
    BisectBatchOnFunctionError: bool = ...,
    MaximumRetryAttempts: int = ...,
    TumblingWindowInSeconds: int = ...,
    Topics: Sequence[str] = ...,
    Queues: Sequence[str] = ...,
    SourceAccessConfigurations: Sequence[SourceAccessConfigurationTypeDef] = ...,  # (4)
    SelfManagedEventSource: SelfManagedEventSourceTypeDef = ...,  # (5)
    FunctionResponseTypes: Sequence[FunctionResponseTypeType] = ...,  # (6)
    AmazonManagedKafkaEventSourceConfig: AmazonManagedKafkaEventSourceConfigTypeDef = ...,  # (7)
    SelfManagedKafkaEventSourceConfig: SelfManagedKafkaEventSourceConfigTypeDef = ...,  # (8)
    ScalingConfig: ScalingConfigTypeDef = ...,  # (9)
    DocumentDBEventSourceConfig: DocumentDBEventSourceConfigTypeDef = ...,  # (10)
) -> EventSourceMappingConfigurationResponseTypeDef:  # (11)
    ...
  1. See FilterCriteriaTypeDef
  2. See EventSourcePositionType
  3. See DestinationConfigTypeDef
  4. See SourceAccessConfigurationTypeDef
  5. See SelfManagedEventSourceTypeDef
  6. See FunctionResponseTypeType
  7. See AmazonManagedKafkaEventSourceConfigTypeDef
  8. See SelfManagedKafkaEventSourceConfigTypeDef
  9. See ScalingConfigTypeDef
  10. See DocumentDBEventSourceConfigTypeDef
  11. See EventSourceMappingConfigurationResponseTypeDef
# create_event_source_mapping method usage example with argument unpacking

kwargs: CreateEventSourceMappingRequestRequestTypeDef = {  # (1)
    "FunctionName": ...,
}

parent.create_event_source_mapping(**kwargs)
  1. See CreateEventSourceMappingRequestRequestTypeDef

create_function#

Creates a Lambda function.

Type annotations and code completion for boto3.client("lambda").create_function method. boto3 documentation

# create_function method definition

def create_function(
    self,
    *,
    FunctionName: str,
    Role: str,
    Code: FunctionCodeTypeDef,  # (1)
    Runtime: RuntimeType = ...,  # (2)
    Handler: str = ...,
    Description: str = ...,
    Timeout: int = ...,
    MemorySize: int = ...,
    Publish: bool = ...,
    VpcConfig: VpcConfigTypeDef = ...,  # (3)
    PackageType: PackageTypeType = ...,  # (4)
    DeadLetterConfig: DeadLetterConfigTypeDef = ...,  # (5)
    Environment: EnvironmentTypeDef = ...,  # (6)
    KMSKeyArn: str = ...,
    TracingConfig: TracingConfigTypeDef = ...,  # (7)
    Tags: Mapping[str, str] = ...,
    Layers: Sequence[str] = ...,
    FileSystemConfigs: Sequence[FileSystemConfigTypeDef] = ...,  # (8)
    ImageConfig: ImageConfigTypeDef = ...,  # (9)
    CodeSigningConfigArn: str = ...,
    Architectures: Sequence[ArchitectureType] = ...,  # (10)
    EphemeralStorage: EphemeralStorageTypeDef = ...,  # (11)
    SnapStart: SnapStartTypeDef = ...,  # (12)
    LoggingConfig: LoggingConfigTypeDef = ...,  # (13)
) -> FunctionConfigurationResponseTypeDef:  # (14)
    ...
  1. See FunctionCodeTypeDef
  2. See RuntimeType
  3. See VpcConfigTypeDef
  4. See PackageTypeType
  5. See DeadLetterConfigTypeDef
  6. See EnvironmentTypeDef
  7. See TracingConfigTypeDef
  8. See FileSystemConfigTypeDef
  9. See ImageConfigTypeDef
  10. See ArchitectureType
  11. See EphemeralStorageTypeDef
  12. See SnapStartTypeDef
  13. See LoggingConfigTypeDef
  14. See FunctionConfigurationResponseTypeDef
# create_function method usage example with argument unpacking

kwargs: CreateFunctionRequestRequestTypeDef = {  # (1)
    "FunctionName": ...,
    "Role": ...,
    "Code": ...,
}

parent.create_function(**kwargs)
  1. See CreateFunctionRequestRequestTypeDef

create_function_url_config#

Creates a Lambda function URL with the specified configuration parameters.

Type annotations and code completion for boto3.client("lambda").create_function_url_config method. boto3 documentation

# create_function_url_config method definition

def create_function_url_config(
    self,
    *,
    FunctionName: str,
    AuthType: FunctionUrlAuthTypeType,  # (1)
    Qualifier: str = ...,
    Cors: CorsTypeDef = ...,  # (2)
    InvokeMode: InvokeModeType = ...,  # (3)
) -> CreateFunctionUrlConfigResponseTypeDef:  # (4)
    ...
  1. See FunctionUrlAuthTypeType
  2. See CorsTypeDef
  3. See InvokeModeType
  4. See CreateFunctionUrlConfigResponseTypeDef
# create_function_url_config method usage example with argument unpacking

kwargs: CreateFunctionUrlConfigRequestRequestTypeDef = {  # (1)
    "FunctionName": ...,
    "AuthType": ...,
}

parent.create_function_url_config(**kwargs)
  1. See CreateFunctionUrlConfigRequestRequestTypeDef

delete_alias#

Deletes a Lambda function alias.

Type annotations and code completion for boto3.client("lambda").delete_alias method. boto3 documentation

# delete_alias method definition

def delete_alias(
    self,
    *,
    FunctionName: str,
    Name: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_alias method usage example with argument unpacking

kwargs: DeleteAliasRequestRequestTypeDef = {  # (1)
    "FunctionName": ...,
    "Name": ...,
}

parent.delete_alias(**kwargs)
  1. See DeleteAliasRequestRequestTypeDef

delete_code_signing_config#

Deletes the code signing configuration.

Type annotations and code completion for boto3.client("lambda").delete_code_signing_config method.