Skip to content

Typing

Typing for developer ease in the IDE

Usage Documentation

Typing

CLASS DESCRIPTION
LambdaContext

The LambdaContext static object can be used to ease the development by providing the IDE type hints.

LambdaContext ¶

The LambdaContext static object can be used to ease the development by providing the IDE type hints.

Example

A Lambda function using LambdaContext

1
2
3
4
5
6
>>> from typing import Any
>>> from aws_lambda_powertools.utilities.typing import LambdaContext
>>>
>>> def handler(event: dict[str, Any], context: LambdaContext) -> dict[str, Any]:
>>>     # Insert business logic
>>>     return event
METHOD DESCRIPTION
get_remaining_time_in_millis

Returns the number of milliseconds left before the execution times out.

ATTRIBUTE DESCRIPTION
aws_request_id

The identifier of the invocation request.

TYPE: str

client_context

(mobile apps) Client context that's provided to Lambda by the client application.

TYPE: LambdaClientContext

function_name

The name of the Lambda function.

TYPE: str

function_version

The version of the function.

TYPE: str

identity

(mobile apps) Information about the Amazon Cognito identity that authorized the request.

TYPE: LambdaCognitoIdentity

invoked_function_arn

The Amazon Resource Name (ARN) that's used to invoke the function. Indicates if the invoker specified a

TYPE: str

log_group_name

The log group for the function.

TYPE: str

log_stream_name

The log stream for the function instance.

TYPE: str

memory_limit_in_mb

The amount of memory that's allocated for the function.

TYPE: int

aws_request_id property ¶

aws_request_id: str

The identifier of the invocation request.

client_context property ¶

client_context: LambdaClientContext

(mobile apps) Client context that's provided to Lambda by the client application.

function_name property ¶

function_name: str

The name of the Lambda function.

function_version property ¶

function_version: str

The version of the function.

identity property ¶

identity: LambdaCognitoIdentity

(mobile apps) Information about the Amazon Cognito identity that authorized the request.

invoked_function_arn property ¶

invoked_function_arn: str

The Amazon Resource Name (ARN) that's used to invoke the function. Indicates if the invoker specified a version number or alias.

log_group_name property ¶

log_group_name: str

The log group for the function.

log_stream_name property ¶

log_stream_name: str

The log stream for the function instance.

memory_limit_in_mb property ¶

memory_limit_in_mb: int

The amount of memory that's allocated for the function.

get_remaining_time_in_millis staticmethod ¶

get_remaining_time_in_millis() -> int

Returns the number of milliseconds left before the execution times out.

Source code in aws_lambda_powertools/utilities/typing/lambda_context.py
86
87
88
89
@staticmethod
def get_remaining_time_in_millis() -> int:
    """Returns the number of milliseconds left before the execution times out."""
    return 0

lambda_client_context ¶

CLASS DESCRIPTION
LambdaClientContext

LambdaClientContext ¶

ATTRIBUTE DESCRIPTION
client

Client context that's provided to Lambda by the client application.

TYPE: LambdaClientContextMobileClient

custom

A dict of custom values set by the mobile client application.

TYPE: dict[str, Any]

env

A dict of environment information provided by the AWS SDK.

TYPE: dict[str, Any]

client property ¶

client: LambdaClientContextMobileClient

Client context that's provided to Lambda by the client application.

custom property ¶

custom: dict[str, Any]

A dict of custom values set by the mobile client application.

env property ¶

env: dict[str, Any]

A dict of environment information provided by the AWS SDK.

lambda_client_context_mobile_client ¶

CLASS DESCRIPTION
LambdaClientContextMobileClient

Mobile Client context that's provided to Lambda by the client application.

LambdaClientContextMobileClient ¶

Mobile Client context that's provided to Lambda by the client application.

lambda_cognito_identity ¶

CLASS DESCRIPTION
LambdaCognitoIdentity

Information about the Amazon Cognito identity that authorized the request.

LambdaCognitoIdentity ¶

Information about the Amazon Cognito identity that authorized the request.

ATTRIBUTE DESCRIPTION
cognito_identity_id

The authenticated Amazon Cognito identity.

TYPE: str

cognito_identity_pool_id

The Amazon Cognito identity pool that authorized the invocation.

TYPE: str

cognito_identity_id property ¶

cognito_identity_id: str

The authenticated Amazon Cognito identity.

cognito_identity_pool_id property ¶

cognito_identity_pool_id: str

The Amazon Cognito identity pool that authorized the invocation.

lambda_context ¶

CLASS DESCRIPTION
LambdaContext

The LambdaContext static object can be used to ease the development by providing the IDE type hints.

LambdaContext ¶

The LambdaContext static object can be used to ease the development by providing the IDE type hints.

Example

A Lambda function using LambdaContext

1
2
3
4
5
6
>>> from typing import Any
>>> from aws_lambda_powertools.utilities.typing import LambdaContext
>>>
>>> def handler(event: dict[str, Any], context: LambdaContext) -> dict[str, Any]:
>>>     # Insert business logic
>>>     return event
METHOD DESCRIPTION
get_remaining_time_in_millis

Returns the number of milliseconds left before the execution times out.

ATTRIBUTE DESCRIPTION
aws_request_id

The identifier of the invocation request.

TYPE: str

client_context

(mobile apps) Client context that's provided to Lambda by the client application.

TYPE: LambdaClientContext

function_name

The name of the Lambda function.

TYPE: str

function_version

The version of the function.

TYPE: str

identity

(mobile apps) Information about the Amazon Cognito identity that authorized the request.

TYPE: LambdaCognitoIdentity

invoked_function_arn

The Amazon Resource Name (ARN) that's used to invoke the function. Indicates if the invoker specified a

TYPE: str

log_group_name

The log group for the function.

TYPE: str

log_stream_name

The log stream for the function instance.

TYPE: str

memory_limit_in_mb

The amount of memory that's allocated for the function.

TYPE: int

aws_request_id property ¶

aws_request_id: str

The identifier of the invocation request.

client_context property ¶

client_context: LambdaClientContext

(mobile apps) Client context that's provided to Lambda by the client application.

function_name property ¶

function_name: str

The name of the Lambda function.

function_version property ¶

function_version: str

The version of the function.

identity property ¶

identity: LambdaCognitoIdentity

(mobile apps) Information about the Amazon Cognito identity that authorized the request.

invoked_function_arn property ¶

invoked_function_arn: str

The Amazon Resource Name (ARN) that's used to invoke the function. Indicates if the invoker specified a version number or alias.

log_group_name property ¶

log_group_name: str

The log group for the function.

log_stream_name property ¶

log_stream_name: str

The log stream for the function instance.

memory_limit_in_mb property ¶

memory_limit_in_mb: int

The amount of memory that's allocated for the function.

get_remaining_time_in_millis staticmethod ¶

get_remaining_time_in_millis() -> int

Returns the number of milliseconds left before the execution times out.

Source code in aws_lambda_powertools/utilities/typing/lambda_context.py
86
87
88
89
@staticmethod
def get_remaining_time_in_millis() -> int:
    """Returns the number of milliseconds left before the execution times out."""
    return 0