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:
objectClient context that’s provided to Lambda by the client application.
- client: MobileClient
Client context that’s provided to Lambda by the client application.
- 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:
objectProvides 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
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:
TypedDictLambda event from SQS queue trigger.
- class core_aws.typing_.lambdas.events.SQSRecord[source]
Bases:
TypedDictA 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.
- 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:
TypedDictSQS 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:
TypedDictLambda event from SNS topic trigger.
- class core_aws.typing_.lambdas.events.SNSRecord[source]
Bases:
TypedDictA 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:
TypedDictSNS 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.
- 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.
- class core_aws.typing_.lambdas.events.KinesisEvent[source]
Bases:
TypedDictLambda event from Kinesis Data Streams trigger.
- Records: List[KinesisRecord]
List of Kinesis stream records.
- class core_aws.typing_.lambdas.events.KinesisRecord[source]
Bases:
TypedDictA 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.
- 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:
TypedDictKinesis 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).