Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /ai-preview path, routing to the AI app stack #9695

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion infrastructure/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const config = {
setRootRecord: stackConfig.get("setRootRecord") || undefined,
};

const aiAppStack = new pulumi.StackReference('pulumi/pulumi-ai-app-infra/prod');
const previewAiAppDomain = aiAppStack.requireOutput('previewAiAppDistributionDomain');

// originBucketName is the name of the S3 bucket to use as the CloudFront origin for the
// website. This bucket is presumed to exist prior to the Pulumi run; if it doesn't, this
// program will fail.
Expand Down Expand Up @@ -129,7 +132,7 @@ if (config.makeFallbackBucket) {
);
}

// We deny the s3:ListBucket permission to anyone but account users to prevent unintended
// We deny the s3:ListBucket permission to anyone but account users to prevent unintended
// disclosure of the bucket's contents.
const originBucketPolicy = new aws.s3.BucketPolicy("origin-bucket-policy", {
bucket: originBucket.bucket,
Expand Down Expand Up @@ -265,6 +268,16 @@ const distributionArgs: aws.cloudfront.DistributionArgs = {
httpsPort: 443,
originSslProtocols: ["TLSv1.2"],
},
},
{
originId: previewAiAppDomain,
domainName: previewAiAppDomain,
customOriginConfig: {
originProtocolPolicy: "https-only",
httpPort: 80,
httpsPort: 443,
originSslProtocols: ["TLSv1.2"],
},
}
],

Expand Down Expand Up @@ -394,6 +407,24 @@ const distributionArgs: aws.cloudfront.DistributionArgs = {
minTtl: 0,
maxTtl: 0,
},

// AI app, preview, with caching handled by the app
{
...baseCacheBehavior,
targetOriginId: previewAiAppDomain,
pathPattern: '/ai-preview',
defaultTtl: 0,
minTtl: 0,
maxTtl: 0,
},
{
...baseCacheBehavior,
targetOriginId: previewAiAppDomain,
pathPattern: '/ai-preview/*',
defaultTtl: 0,
minTtl: 0,
maxTtl: 0,
}
],

// "All" is the most broad distribution, and also the most expensive.
Expand Down