diff --git a/README.md b/README.md index 35a6b45..5d3b288 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ ServerlessWebappStarterKitStack.FrontendDomainName = https://web.exmaple.com Opening the URL in `FrontendDomainName` output, you can now try the sample app on your browser. +> **Note:** The deployment also outputs operational commands for database management. `DatabasePortForwardCommand` establishes a local connection to your RDS database on port 5433, and `DatabaseSecretsCommand` retrieves database credentials from AWS Secrets Manager. + ### WebApp Deployment The Next.js webapp is built and deployed during the CDK deployment process using [deploy-time-build](https://github.com/tmokmss/deploy-time-build). This approach ensures your application is containerized and deployed to AWS Lambda as part of the infrastructure deployment. See the [implementation](./cdk/lib/constructs/webapp.ts) for details. diff --git a/cdk/lib/constructs/database.ts b/cdk/lib/constructs/database.ts index 80cbc1c..3f9cdf9 100644 --- a/cdk/lib/constructs/database.ts +++ b/cdk/lib/constructs/database.ts @@ -67,7 +67,7 @@ export class Database extends Construct implements ec2.IConnectable { host.instanceId } --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters '{"portNumber":["${ cluster.clusterEndpoint.port - }"], "localPortNumber":["${cluster.clusterEndpoint.port}"], "host": ["${cluster.clusterEndpoint.hostname}"]}'`, + }"], "localPortNumber":["5433"], "host": ["${cluster.clusterEndpoint.hostname}"]}'`, }); new CfnOutput(this, 'DatabaseSecretsCommand', { value: `aws secretsmanager get-secret-value --secret-id ${cluster.secret!.secretName} --region ${ diff --git a/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit-without-domain.test.ts.snap b/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit-without-domain.test.ts.snap index 437e0f3..4c6b442 100644 --- a/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit-without-domain.test.ts.snap +++ b/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit-without-domain.test.ts.snap @@ -338,14 +338,7 @@ exports[`Snapshot test 2`] = ` "Endpoint.Port", ], }, - ""], "localPortNumber":["", - { - "Fn::GetAtt": [ - "DatabaseCluster5B53A178", - "Endpoint.Port", - ], - }, - ""], "host": ["", + ""], "localPortNumber":["5433"], "host": ["", { "Fn::GetAtt": [ "DatabaseCluster5B53A178", diff --git a/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit.test.ts.snap b/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit.test.ts.snap index 70d718a..4cb5db9 100644 --- a/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit.test.ts.snap +++ b/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit.test.ts.snap @@ -372,14 +372,7 @@ exports[`Snapshot test 2`] = ` "Endpoint.Port", ], }, - ""], "localPortNumber":["", - { - "Fn::GetAtt": [ - "DatabaseCluster5B53A178", - "Endpoint.Port", - ], - }, - ""], "host": ["", + ""], "localPortNumber":["5433"], "host": ["", { "Fn::GetAtt": [ "DatabaseCluster5B53A178",