diff --git a/scripts/aws/README.ja.md b/scripts/aws/README.ja.md index 01fb1ae42..f7f093394 100644 --- a/scripts/aws/README.ja.md +++ b/scripts/aws/README.ja.md @@ -1,6 +1,9 @@ # Langflow on AWS -Langflow on AWS では、 Langflow を AWS 上にデプロイする方法を学べます。 +**想定時間**: 30 分 + +## 説明 +Langflow on AWS では、 AWS Cloud Development Kit (CDK) を用いて Langflow を AWS 上にデプロイする方法を学べます。 このチュートリアルは、AWS アカウントと AWS に関する基本的な知識を有していることを前提としています。 作成するアプリケーションのアーキテクチャです。 @@ -11,7 +14,7 @@ Fargate のタスクはフロントエンドとバックエンドに分かれて リソースをデプロイするだけであれば、上記の各サービスについて深い知識は必要ありません。 # 環境構築とデプロイ方法 -1. [CloudShell](https://us-east-1.console.aws.amazon.com/cloudshell/home?region=us-east-1)を開きます。 +1. [AWS CloudShell](https://us-east-1.console.aws.amazon.com/cloudshell/home?region=us-east-1)を開きます。 1. 以下のコマンドを実行します。 ```shell @@ -20,7 +23,7 @@ Fargate のタスクはフロントエンドとバックエンドに分かれて ./bin/bootstrap ``` -1. `Done!` と表示されたら [Cloud9](https://us-east-1.console.aws.amazon.com/cloud9control/home?region=us-east-1#/) から `cloud9-for-prototyping` を開きます。 +1. `Done!` と表示されたら [AWS Cloud9](https://us-east-1.console.aws.amazon.com/cloud9control/home?region=us-east-1#/) から `cloud9-for-prototyping` を開きます。 ![make-cloud9](./img/langflow-cloud9.png) 1. 以下のコマンドを実行します。 @@ -43,10 +46,9 @@ Fargate のタスクはフロントエンドとバックエンドに分かれて # 環境の削除 1. `Cloud9` で以下のコマンドを実行します。 ```shell - cdk destroy - bash delete-ecr.sh + bash delete-resources.sh ``` -1. [CloudFormation](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/getting-started)を開き、`aws-cloud9-cloud9-for-prototyping-XXXX` を選択して削除します。 +1. [AWS CloudFormation](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/getting-started)を開き、`aws-cloud9-cloud9-for-prototyping-XXXX` を選択して削除します。 ![delete-cfn](./img/langflow-cfn.png) \ No newline at end of file diff --git a/scripts/aws/README.md b/scripts/aws/README.md index 48fcb33de..384b755fe 100644 --- a/scripts/aws/README.md +++ b/scripts/aws/README.md @@ -1,7 +1,9 @@ # Deploy Langflow on AWS -In this tutorial, you will learn how to deploy langflow on AWS using CDK. +**Duraration**: 30 minutes +## Introduction +In this tutorial, you will learn how to deploy langflow on AWS using AWS Cloud Development Kit (CDK). This tutorial assumes you have an AWS account and basic knowledge of AWS. The architecture of the application to be created: @@ -13,14 +15,14 @@ The Fargate task is divided into a frontend and a backend, which communicate thr If you just want to deploy resources, you do not need in-depth knowledge of each of the above services. # How to set up your environment and deploy langflow -1. Open [CloudShell](https://us-east-1.console.aws.amazon.com/cloudshell/home?region=us-east-1). +1. Open [AWS CloudShell](https://us-east-1.console.aws.amazon.com/cloudshell/home?region=us-east-1). 1. Run the following commands in Cloudshell: ```shell git clone https://github.com/aws-samples/cloud9-setup-for-prototyping cd cloud9-setup-for-prototyping ./bin/bootstrap ``` -1. When you see `Done!` in Cloudshell, open `cloud9-for-prototyping` from [Cloud9](https://us-east-1.console.aws.amazon.com/cloud9control/home?region=us-east-1#/). +1. When you see `Done!` in Cloudshell, open `cloud9-for-prototyping` from [AWS Cloud9](https://us-east-1.console.aws.amazon.com/cloud9control/home?region=us-east-1#/). ![make-cloud9](./img/langflow-cloud9-en.png) 1. Run the following command in the Cloud9 terminal. ```shell @@ -42,8 +44,7 @@ If you just want to deploy resources, you do not need in-depth knowledge of each # Cleanup 1. Run the following command in the Cloud9 terminal. ```shell - cdk destroy - bash delete-ecr.sh + bash delete-resources.sh ``` -1. Open [CloudFormation](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/getting-started), select `aws-cloud9-cloud9-for-prototyping-XXXX` and delete it. +1. Open [AWS CloudFormation](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/getting-started), select `aws-cloud9-cloud9-for-prototyping-XXXX` and delete it. ![delete-cfn](./img/langflow-cfn.png) \ No newline at end of file diff --git a/scripts/aws/delete-ecr.sh b/scripts/aws/delete-resources.sh similarity index 51% rename from scripts/aws/delete-ecr.sh rename to scripts/aws/delete-resources.sh index 8e3b6a261..e299165bf 100644 --- a/scripts/aws/delete-ecr.sh +++ b/scripts/aws/delete-resources.sh @@ -1,4 +1,4 @@ -# aws cloudformation delete-stack --stack-name LangflowAppStack +aws cloudformation delete-stack --stack-name LangflowAppStack aws ecr delete-repository --repository-name langflow-backend-repository --force aws ecr delete-repository --repository-name langflow-frontend-repository --force -aws ecr describe-repositories --output json | jq -re ".repositories[].repositoryName" \ No newline at end of file +# aws ecr describe-repositories --output json | jq -re ".repositories[].repositoryName" \ No newline at end of file diff --git a/scripts/aws/img/langflow-archi.png b/scripts/aws/img/langflow-archi.png index c46ae811d..3064a562e 100644 Binary files a/scripts/aws/img/langflow-archi.png and b/scripts/aws/img/langflow-archi.png differ diff --git a/scripts/aws/lib/construct/db.ts b/scripts/aws/lib/construct/db.ts index 8be1f5212..34cb8a482 100644 --- a/scripts/aws/lib/construct/db.ts +++ b/scripts/aws/lib/construct/db.ts @@ -1,6 +1,7 @@ import { Construct } from 'constructs'; import * as ec2 from 'aws-cdk-lib/aws-ec2' import * as rds from "aws-cdk-lib/aws-rds"; +import * as cdk from 'aws-cdk-lib'; interface RdsProps { vpc: ec2.Vpc @@ -20,7 +21,7 @@ export class Rds extends Construct{ const rdsCredentials = rds.Credentials.fromGeneratedSecret('db_user',{ secretName: 'langflow-DbSecret', }) - + // DB クラスターのパラメータグループ作成 const clusterParameterGroup = new rds.ParameterGroup(scope, 'ClusterParameterGroup',{ engine: rds.DatabaseClusterEngine.auroraMysql({