Developer Center / Code Examples ...
Find code examples for the AWS SDKs
Explore and run code examples to manage your AWS resources
actions
Code excerpts that show you how to call individual service functions.
scenarios
Code examples that show you how to accomplish a specific task by calling multiple functions within the same service.
cross-service
Sample applications that work across multiple AWS services.
Filter
Filter
Filter
Filter
Total results: 55
- category
-
Serverless
UpdatedComputeConnecting to an Amazon RDS database in a Lambda function
Amazon RDS | Lambda
Learn how to implement a Lambda function that connects to an RDS database. The function makes a simple database request and returns the result.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedInvoke a Lambda function from an Amazon MSK trigger
Amazon MSK | Lambda
Learn how to implement a Lambda function that receives an event triggered by receiving records from an Amazon MSK cluster. The function retrieves the MSK payload and logs the record contents.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedDatabasesReporting batch item failures for Lambda functions with a DynamoDB trigger
DynamoDB | Lambda
Learn how to implement partial batch response for Lambda functions that receive events from a DynamoDB stream. The function reports the batch item failures in the response, signaling to Lambda to retry those messages later.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedAnalyticsReporting batch item failures for Lambda functions with a Kinesis trigger
Kinesis | Lambda
Learn how to implement partial batch response for Lambda functions that receive events from a Kinesis stream. The function reports the batch item failures in the response, signaling to Lambda to retry those messages later.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedComputeInvoke a Lambda function from an Amazon SNS trigger
Amazon SNS | Lambda
Learn how to implement a Lambda function that receives an event triggered by receiving messages from an SNS topic. The function retrieves the messages from the event parameter and logs the content of each message.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedInvoke a Lambda function from a Amazon DocumentDB trigger
Amazon DocumentDB | Lambda
Learn how to implement a Lambda function that receives an event triggered by receiving records from a DocumentDB change stream. The function retrieves the DocumentDB payload and logs the record contents.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedDatabasesInvoke a Lambda function from a DynamoDB trigger
DynamoDB | Lambda
Learn how to implement a Lambda function that receives an event triggered by receiving records from a DynamoDB stream. The function retrieves the DynamoDB payload and logs the record contents.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedAnalyticsInvoke a Lambda function from a Kinesis trigger
Kinesis | Lambda
Learn how to implement a Lambda function that receives an event triggered by receiving records from a Kinesis stream. The function retrieves the Kinesis payload, decodes from Base64, and logs the record contents.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedComputeInvoke a Lambda function from an Amazon SQS trigger
Amazon SQS | Lambda
Learn how to implement a Lambda function that receives an event triggered by receiving messages from an SQS queue. The function retrieves the messages from the event parameter and logs the content of each message.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedComputeReporting batch item failures for Lambda functions with an Amazon SQS trigger
Amazon SQS | Lambda
Learn how to implement partial batch response for Lambda functions that receive events from an SQS queue. The function reports the batch item failures in the response, signaling to Lambda to retry those messages later.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Serverless
UpdatedComputeInvoke a Lambda function from an Amazon S3 trigger
Amazon S3 | Lambda
Learn how to implement a Lambda function that receives an event triggered by uploading an object to an S3 bucket. The function retrieves the S3 bucket name and object key from the event parameter and calls the Amazon S3 API to retrieve and log the content type of the object.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Scenario
UpdatedDatabasesQuery a table by using batches of PartiQL statements
DynamoDB
- Get a batch of items by running multiple SELECT statements.
- Add a batch of items by running multiple INSERT statements.
- Update a batch of items by running multiple UPDATE statements.
- Delete a batch of items by running multiple DELETE statements.
.NET (v3) | C++ | Go (v2) | Java (v2) | JavaScript (v3) | Kotlin | PHP (v3) | Python (v3) | Ruby (v3)
-
Scenario
UpdatedSecurity, Identity, & ComplianceAutomatically confirm known users with a Lambda function
Amazon Cognito Identity Provider | Lambda
- Configure a user pool to call a Lambda function for the
PreSignUp
trigger. - Sign up a user with Amazon Cognito.
- The Lambda function scans a DynamoDB table and automatically confirms known users.
- Sign in as the new user, then clean up resources.
- Configure a user pool to call a Lambda function for the
-
Scenario
UpdatedGenerative AIInvoke multiple foundation models on Amazon Bedrock
Amazon Bedrock Runtime
Learn how to prepare and send a prompt to a variety of large-language models (LLMs) on Amazon Bedrock
-
Scenario
UpdatedStorageUpload or download large files
Amazon S3
Learn how to upload or download large files to and from Amazon S3.
.NET (v3) | Go (v2) | Java (v2) | JavaScript (v3) | Python (v3) | Rust
-
Scenario
UpdatedDatabasesQuery a table using PartiQL
DynamoDB
- Get an item by running a SELECT statement.
- Add an item by running an INSERT statement.
- Update an item by running an UPDATE statement.
- Delete an item by running a DELETE statement.
.NET (v3) | C++ | Go (v2) | Java (v2) | JavaScript (v3) | Kotlin | PHP (v3) | Python (v3) | Ruby (v3) | Rust
-
Scenario
UpdatedSecurity, Identity, & ComplianceWrite custom activity data with a Lambda function after Amazon Cognito user authentication
Amazon Cognito Identity Provider | Lambda
- Use administrator functions to add a user to a user pool.
- Configure a user pool to call a Lambda function for the
PostAuthentication
trigger. - Sign the new user in to Amazon Cognito.
- The Lambda function writes custom information to CloudWatch Logs and to an DynamoDB table.
- Get and display custom data from the DynamoDB table, then clean up resources.