Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iknowjavascript/terraform-aws-stable-diffusion
This project sets up an AWS infrastructure to deploy a Stable Diffusion model using AWS Lambda, EC2, S3, and API Gateway. The Lambda function triggers an EC2 instance to run the Stable Diffusion model and store the generated images in an S3 bucket.
https://github.com/iknowjavascript/terraform-aws-stable-diffusion
ai aws infrastructure-as-code nvidia stable-diffusion
Last synced: 12 days ago
JSON representation
This project sets up an AWS infrastructure to deploy a Stable Diffusion model using AWS Lambda, EC2, S3, and API Gateway. The Lambda function triggers an EC2 instance to run the Stable Diffusion model and store the generated images in an S3 bucket.
- Host: GitHub
- URL: https://github.com/iknowjavascript/terraform-aws-stable-diffusion
- Owner: iKnowJavaScript
- License: mit
- Created: 2024-12-11T11:07:05.000Z (13 days ago)
- Default Branch: main
- Last Pushed: 2024-12-11T11:52:39.000Z (13 days ago)
- Last Synced: 2024-12-11T12:36:23.980Z (13 days ago)
- Topics: ai, aws, infrastructure-as-code, nvidia, stable-diffusion
- Language: HCL
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stable Diffusion AWS Deployment
This project sets up an AWS infrastructure to deploy a Stable Diffusion model using AWS Lambda, EC2, S3, and API Gateway. The Lambda function triggers an EC2 instance to run the Stable Diffusion model and store the generated images in an S3 bucket.
## Prerequisites
- AWS CLI configured with appropriate permissions
- Terraform installed
- Python 3.8 installed## Project Structure
```
.DS_Store
.gitignore
infra/
api-gateway.tf
ec2.tf
inputs.tf
kms.tf
lambda.tf
main.tf
s3.tf
lambda/
lambda_function.py
LICENSE
README.md
```## Setup Instructions
### Step 1: Create Lambda Zip Package
From the root folder, run the following command to create a zip package for the Lambda function:
```sh
zip -r ./lambda.zip ./lambda
```### Step 2: Initialize and Apply Terraform Configuration
1. Navigate to the
infra
directory:
```sh
cd infra
```2. Initialize Terraform:
```sh
terraform init
```3. Apply the Terraform configuration:
```sh
terraform apply
```Confirm the apply action when prompted.
## Lambda Function
The Lambda function is defined in
lambda_function.py
. It triggers an EC2 instance to run the Stable Diffusion model and stores the generated image in an S3 bucket.
## Terraform Configuration
The Terraform configuration is located in the
infra
Includes:## API Gateway
The API Gateway is configured to invoke the Lambda function via an HTTP POST request. The configuration is defined in
## IAM Roles and Policies
The necessary IAM roles and policies are defined in the Terraform configuration to allow the Lambda function and EC2 instance to perform their required actions.
## S3 Bucket
An S3 bucket is created to store the generated images. The configuration is defined in
## EC2 Instance
An EC2 instance is configured to run the Stable Diffusion model. The configuration is defined in
## License
This project is licensed under the MIT License. See the
LICENSE
file for details.
## Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
## Contact
For any questions or support, please open an issue in the repository.
Feel free to check repo https://github.com/iKnowJavaScript/stable-diffusion-docker.git for commands and how the model works