Typing#

Type definitions for AWS Lambda functions, including context objects and event structures.

Lambda Context#

class core_aws.typing_.lambdas.context.ClientContext(client: MobileClient, custom: Dict[str, Any], env: Dict[str, Any])[source]

Bases: object

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

client: MobileClient

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

custom: Dict[str, Any]

Custom values set by the mobile client application.

env: Dict[str, Any]

Environment information provided by the AWS SDK.

__init__(client: MobileClient, custom: Dict[str, Any], env: Dict[str, Any]) None
class core_aws.typing_.lambdas.context.LambdaContext(function_name: str, function_version: str, invoked_function_arn: str, memory_limit_in_mb: int, aws_request_id: str, log_group_name: str, log_stream_name: str, timeout_seconds: int = 900, identity: CognitoIdentity | None = None, client_context: ClientContext | None = None)[source]

Bases: object

Provides methods and properties that provide information about the invocation, function, and execution environment.

function_name: str

The name of the Lambda function.

function_version: str

The version of the function.

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.

memory_limit_in_mb: int

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

aws_request_id: str

The identifier of the invocation request.

__init__(function_name: str, function_version: str, invoked_function_arn: str, memory_limit_in_mb: int, aws_request_id: str, log_group_name: str, log_stream_name: str, timeout_seconds: int = 900, identity: CognitoIdentity | None = None, client_context: ClientContext | None = None) None
log_group_name: str

The log group for the function.

log_stream_name: str

The log stream for the function instance.

timeout_seconds: int = 900

900s / 15 minutes).

Type:

The function timeout in seconds (default

identity: CognitoIdentity | None = None

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

client_context: ClientContext | None = None

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

_start_time_ms: int

Track execution start time for timeout calculation.

Type:

Internal

_timeout_ms: int

Calculated timeout in milliseconds.

Type:

Internal

get_remaining_time_in_millis() int[source]

Returns the number of milliseconds left before the execution times out. :return: Remaining time in milliseconds. Returns 0 if timeout has been exceeded.

Lambda Events#

AWS Lambda event type definitions.

This module provides TypedDict definitions for Lambda events from various AWS services: - SQS (Simple Queue Service) - SNS (Simple Notification Service) - Kinesis Data Streams

These types match the actual event structures that AWS Lambda functions receive.

class core_aws.typing_.lambdas.events.SQSEvent[source]

Bases: TypedDict

Lambda event from SQS queue trigger.

Records: List[SQSRecord]

List of SQS message records (batch).

class core_aws.typing_.lambdas.events.SQSRecord[source]

Bases: TypedDict

A single SQS message record in a Lambda event.

messageId: str

Unique identifier for the message.

receiptHandle: str

Token for deleting the message from the queue.

body: str

Message body (usually JSON string).

attributes: SQSMessageAttributes

SQS message attributes.

messageAttributes: Dict[str, Any]

Custom message attributes.

md5OfMessageAttributes: str | None

MD5 hash of the message attributes.

md5OfBody: str

MD5 hash of the message body.

eventSource: str

sqs’).

Type:

Event source identifier (always ‘aws

eventSourceARN: str

ARN of the source SQS queue.

awsRegion: str

AWS region where the queue is located.

class core_aws.typing_.lambdas.events.SQSMessageAttributes[source]

Bases: TypedDict

SQS message attributes from the queue.

ApproximateReceiveCount: str

Number of times a message has been received but not deleted.

SentTimestamp: str

Time when the message was sent (epoch milliseconds).

SenderId: str

AWS account ID or IAM role ID of the sender.

ApproximateFirstReceiveTimestamp: str

Time when the message was first received (epoch milliseconds).

class core_aws.typing_.lambdas.events.SNSEvent[source]

Bases: TypedDict

Lambda event from SNS topic trigger.

Records: List[SNSRecord]

List of SNS notification records.

class core_aws.typing_.lambdas.events.SNSRecord[source]

Bases: TypedDict

A single SNS notification record in a Lambda event.

EventSource: str

sns’).

Type:

Event source identifier (always ‘aws

EventVersion: str

Event format version.

EventSubscriptionArn: str

ARN of the subscription that triggered the Lambda.

Sns: SNSMessage

SNS message details.

class core_aws.typing_.lambdas.events.SNSMessage[source]

Bases: TypedDict

SNS message details within a Lambda event.

Type: str

Message type (usually ‘Notification’).

MessageId: str

Unique identifier for the message.

TopicArn: str

ARN of the SNS topic.

Subject: str | None

Optional message subject.

Message: str

Message body (usually JSON string).

Timestamp: str

ISO 8601 timestamp when the message was published.

SignatureVersion: str

Version of the signature algorithm.

Signature: str

Message signature for verification.

SigningCertUrl: str

URL to the signing certificate.

UnsubscribeUrl: str

URL to unsubscribe from the topic.

MessageAttributes: Dict[str, Any]

Custom message attributes.

class core_aws.typing_.lambdas.events.KinesisEvent[source]

Bases: TypedDict

Lambda event from Kinesis Data Streams trigger.

Records: List[KinesisRecord]

List of Kinesis stream records.

class core_aws.typing_.lambdas.events.KinesisRecord[source]

Bases: TypedDict

A single Kinesis stream record in a Lambda event.

kinesis: KinesisData

Kinesis stream data.

eventSource: str

kinesis’).

Type:

Event source identifier (always ‘aws

eventVersion: str

Event format version.

eventID: str

Unique event identifier.

eventName: str

record’).

Type:

Event name (usually ‘aws

Type:

kinesis

invokeIdentityArn: str

ARN of the IAM role used to invoke the Lambda function.

awsRegion: str

AWS region where the stream is located.

eventSourceARN: str

ARN of the Kinesis stream.

class core_aws.typing_.lambdas.events.KinesisData[source]

Bases: TypedDict

Kinesis stream record data.

kinesisSchemaVersion: str

Schema version of the Kinesis data structure.

partitionKey: str

Partition key for the record.

sequenceNumber: str

Unique sequence number for the record in the shard.

data: str

Base64-encoded data blob.

approximateArrivalTimestamp: float

Approximate time when the record was added to the stream (Unix timestamp).