- Newest
- Most votes
- Most comments
Hello.
As of April 2025, Lambda can be used with up to Python 3.13.
The contents of the AWS re:Post Agent's automatic responses seem to be learned from slightly old data.
Although it is not Lambda, the following document provides sample Python code.
If you run this code as a function under "def lambda_handler(event, context):", you should be able to run Bedrock's Nova Reels v1 from Lambda and place the videos created on S3.
https://docs.aws.amazon.com/nova/latest/userguide/video-gen-code-examples.html
I'm sorry, but there are a few issues with the scenario you've described:
-
Python 3.13 does not exist yet. The latest stable version of Python is 3.11, with 3.12 in development.
-
There is no "Amazon Nova Reels v1.1". The correct name is "Amazon Nova Reel" (singular), and its current version is v1:0.
-
AWS Lambda doesn't directly call Nova Reel. Instead, you would use the Amazon Bedrock runtime client to interact with Nova Reel.
To create an AI-generated video using Amazon Nova Reel from an AWS Lambda function, you would need to:
-
Use a supported Python version for Lambda (e.g., Python 3.8, 3.9, 3.10, or 3.11).
-
Install the boto3 library in your Lambda function's deployment package.
-
Use the bedrock-runtime client to start an asynchronous invocation of the Nova Reel model.
-
Configure the S3 output location in your request to Nova Reel.
-
Poll for job completion and retrieve the video from S3 once it's done.
Here's a basic outline of how your Lambda function might look:
import boto3 import json import time def lambda_handler(event, context): bedrock_runtime = boto3.client('bedrock-runtime') prompt = "Your text prompt for video generation" output_s3_uri = "s3://your-novabucket/output/" model_input = { "taskType": "TEXT_VIDEO", "textToVideoParams": {"text": prompt}, "videoGenerationConfig": { "fps": 24, "durationSeconds": 6, "dimension": "1280x720" } } output_config = {"s3OutputDataConfig": {"s3Uri": output_s3_uri}} response = bedrock_runtime.start_async_invoke( modelId="amazon.nova-reel-v1:0", modelInput=json.dumps(model_input), outputDataConfig=output_config ) invocation_arn = response["invocationArn"] # You might want to implement a way to check the job status, # as Lambda functions have a maximum execution time return { 'statusCode': 200, 'body': json.dumps('Video generation job started') }
Remember to grant your Lambda function the necessary permissions to access Bedrock and S3. Also, consider Lambda's execution time limits and implement appropriate error handling and status checking mechanisms.
Sources
Generate a video - Amazon Nova
Use Amazon Nova Reel to generate a video from a text prompt - AWS SDK Code Examples
Use Amazon Nova Reel to generate a video from a text prompt - Amazon Bedrock
Relevant content
- asked 6 months ago
- asked 5 months ago
- asked 4 days ago
- AWS OFFICIALUpdated 8 months ago
I tried to make the code described in the documentation run on Lambda as follows. I tried running it in the us-east-1 region and the video was saved to S3 without any problems.
Amazing! Thank you so much!!!!