You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I could find, all of the awsx examples show exposing containers via an ALB on http, but for any real world use case users area really going to want HTTPs. I've noticed the examples in this repo in the examples repo are a bit all over the place, some referencing new AWSX alb package, some referencing the classic awsx ALB, ultimately leading to a lot of confusion for me (some problems with pulumi.ai related to this as well: pulumi/pulumi-ai#85).
Spent a couple of hours getting this worked out and thought I would share the sample code in case it helps other users:
import*asawsfrom"@pulumi/aws";import*aspulumifrom"@pulumi/pulumi"import*asawsxfrom"@pulumi/awsx";import*asdockerBuildfrom"@pulumi/docker-build";constconfig=newpulumi.Config();// Create an ECR repository to store the Docker imageconstrepo=newaws.ecr.Repository("cortex-api-repo");// Grab auth credentials for ECR.constauthToken=aws.ecr.getAuthorizationTokenOutput({registryId: repo.registryId,});constcortexApiImage=newdockerBuild.Image("cortex-api-image",{push: true,context: {location: "../cortex-api",},tags: [pulumi.interpolate`${repo.repositoryUrl}:latest`],platforms: ["linux/amd64","linux/arm64",],registries: [{address: repo.repositoryUrl,password: authToken.password,username: authToken.userName,}]});constcluster=newaws.ecs.Cluster("cortex-cluster");// Create an ACM Certificate for our domain.constcertificate=newaws.acm.Certificate("cortex-cert",{domainName: "*.cortexclick.com",// Replace with your domain namevalidationMethod: "DNS",});constlb=newawsx.lb.ApplicationLoadBalancer("cortex-lb",{defaultTargetGroupPort: 3001,});consthttpsListener=newaws.lb.Listener("app-listener",{loadBalancerArn: lb.loadBalancer.arn,port: 443,protocol: "HTTPS",certificateArn: certificate.arn,defaultActions: [{type: "forward",targetGroupArn: lb.defaultTargetGroup.arn,}],});constservice=newawsx.ecs.FargateService("cortex-api-service",{cluster: cluster.arn,assignPublicIp: true,desiredCount: 2,taskDefinitionArgs: {container: {image: cortexApiImage.ref,name: "cortex-api",cpu: 512,memory: 1024,essential: true,portMappings: [{containerPort: 3001,targetGroup: lb.defaultTargetGroup,},],environment: [{name: "TURBOPUFFER_API_KEY",value: config.require("turbopuffer_api_key"),},{name: "OPENAI_API_KEY",value: config.require("openai_api_key"),},{name: "DATABASE_HOST",value: config.require("database_host"),},{name: "DATABASE_PASSWORD",value: config.require("database_password"),},{name: "DATABASE_USERNAME",value: config.require("database_username"),}]},},});// Export the load balancer's address so that it's easy to access.exportconsturl=lb.loadBalancer.dnsName;
The text was updated successfully, but these errors were encountered:
Thanks a lot @EvanBoyle for bringing this up! I'll generalize it and add it to our examples.
I'll also have a look through our existing examples and clean them up where necessary
From what I could find, all of the awsx examples show exposing containers via an ALB on http, but for any real world use case users area really going to want HTTPs. I've noticed the examples in this repo in the examples repo are a bit all over the place, some referencing new AWSX alb package, some referencing the classic awsx ALB, ultimately leading to a lot of confusion for me (some problems with pulumi.ai related to this as well: pulumi/pulumi-ai#85).
Spent a couple of hours getting this worked out and thought I would share the sample code in case it helps other users:
The text was updated successfully, but these errors were encountered: