lib/ide-services-stack.ts (55 lines of code) (raw):

import * as cdk from 'aws-cdk-lib'; import {Construct} from 'constructs'; import {IdeServicesResources} from "./ide-services-resources"; import {IdeServicesCloudfront} from "./ide-services-cloudfront"; import {IdeServicesApp} from "./ide-services-app"; import {IdeServicesCognito} from "./ide-services-cognito"; import {IdeServicesConfigMap} from "./ide-services-config-map"; export class IdeServicesStack extends cdk.Stack { constructor(scope: Construct, id: string, props?: cdk.StackProps) { super(scope, id, props) // Deploy resources for an application const resources = new IdeServicesResources(this, `${id}-resources`); // Deploy application const app = new IdeServicesApp(this, `${id}-app`, { cluster: resources.cluster, externalSecret: resources.externalSecret, mellumExternalSecret: resources.mellumExternalSecret, dataBucket: resources.dataBucket, serviceAccount: resources.serviceAccount, }); app.addDependency(resources) // Deploy cloudfront distribution const cloudfront = new IdeServicesCloudfront(this, `${id}-cloudfront`, { cluster: resources.cluster, ideServicesChart: app.ideServicesChart }); cloudfront.addDependency(app) // Deploy Cognito for authorization const cognito = new IdeServicesCognito(this, `${id}-cognito`, { deploymentUrl: cloudfront.deploymentUrl }) // Deploy ConfigMap for application configuration new IdeServicesConfigMap(this, 'IdeServicesConfigMap', { cluster: resources.cluster, serviceAccount: resources.serviceAccount, deploymentUrl: cloudfront.deploymentUrl, cognitoConfig: cognito.config }); // Output the CloudFront distribution domain name new cdk.CfnOutput(this, 'DeploymentURL', { value: cloudfront.deploymentUrl, description: 'The application URL', }); // Output the EKS cluster name new cdk.CfnOutput(this, 'EksClusterName', { value: resources.cluster.clusterName, description: 'The EKS cluster name', }); // Output the EKS cluster configuration new cdk.CfnOutput(this, 'AwsEksClusterConfig', { value: `aws eks update-kubeconfig --name ${resources.cluster.clusterName} --region ${this.region}`, description: 'The EKS cluster name', }); // Output the Bedrock access key ID new cdk.CfnOutput(this, 'BedrockAccessKey', { value: resources.bedrockAccessKey.ref, description: 'The Bedrock access key', }); // Output the Bedrock secret access key new cdk.CfnOutput(this, 'BedrockSecretKey', { value: resources.bedrockAccessKey.attrSecretAccessKey, description: 'The Bedrock secret key', }); } }