Deploy Dify Enterprise on AWS using CDK.
Component | Helm Chart Value | Count | vCPU | Memory (GB) | Storage (GB) | Notes |
---|---|---|---|---|---|---|
S3 | persistence | 1 | ||||
Redis DB | externalRedis | 1 | 2 | 6.38 | ||
RDS Postgres DB | externalPostgres | 2 | 2 | 8 | ||
K8S Worker Node | 1 | 4 | 16 | 100 | ||
EC2 (for Vector DB) | vectorDB | 1 | 4 | 8 | 100 |
Component | Helm Chart Value | Count | vCPU | Memory (GB) | Storage (GB) | Notes |
---|---|---|---|---|---|---|
S3 | persistence | 1 | ||||
Redis DB | externalRedis | 1 | 2 | 12.93 | ||
RDS Postgres DB | externalPostgres | 1 | 4 | 32 | ||
K8S Worker Node | 6 | 8 | 32 | 100 | ||
EC2 (for Vector DB) | vectorDB | 3 | 16 | 64 | 100 |
-
Install NodeJS Dependencies:
npm install
-
Configure AWS CLI:
Install and configure the AWS CLI:
aws configure
-
Clone this repository:
git clone https://github.com/langgenius/aws-cdk-for-dify.git
-
Configure environment variables:
cp env.example .env
Modify the environment variable values in the
.env
file.Note:
- If you are using the AWS China region, you need to configure the
AWS_LOAD_BALANCER_REPO
for proper functionality. - It is recommended to use an existing VPC for easier resource access.
- If you are using the AWS China region, you need to configure the
-
CDK Bootstrap:
Initialize the CDK environment:
npm run init
-
CDK Deploy:
-
Deploy the Testing environment:
npm run deploy-test
-
Deploy the Production environment:
npm run deploy-prod
-
-
Update AWS EKS Access Permissions:
- Navigate to the EKS Cluster panel, select the "Access" menu, and click on "Manage access":
- In the "Manage access" dialog, select "EKS API and ConfigMap," then click "Save Changes."
- In the IAM Access Entries panel, click "Create access entry":
- Add your IAM user and assign the following permissions:
AmazonEKSAdminPolicy
AmazonEKSAdminViewPolicy
AmazonEKSClusterAdminPolicy
-
Configure kubeconfig to access the K8S cluster locally:
aws eks update-kubeconfig --region <cn-northwest-1> --name <Dify-Testing-DifyStackTest-EKS>
Adjust the
region
andname
according to your deployment:- region: The deployment region.
- name: The EKS cluster name (
Dify-Testing-DifyStackTest-EKS
|Dify-Production-DifyStackProd-EKS
).
-
CDK Destroy:
To destroy the stack:
npm run destroy