Demo site #2

Merged
vignesh merged 4 commits from beta into main 2026-09-10 13:13:23 +00:00
Showing only changes of commit d02c8907a6 - Show all commits

View file

@ -20,27 +20,19 @@ export class BetaSupplierSiteStack extends cdk.Stack {
encryption: s3.BucketEncryption.S3_MANAGED,
});
const ec2Origin = new origins.HttpOrigin('api.tipro.in', {
const ec2Origin = new origins.HttpOrigin('api.tradhox.com', {
protocolPolicy: cloudfront.OriginProtocolPolicy.HTTP_ONLY,
httpPort: 8080,
});
// Look up the tipro.in hosted zone
const zone = route53.HostedZone.fromLookup(this, 'TiproZone', {
domainName: 'tipro.in',
});
// Create Route53 A Record for the EC2 API server
// This allows us to use an IP address indirectly, by mapping api.tipro.in to it.
new route53.ARecord(this, 'ApiRecord', {
recordName: 'api.tipro.in',
target: route53.RecordTarget.fromIpAddresses('16.113.57.127'),
zone
// Look up the tradhox.com hosted zone
const zone = route53.HostedZone.fromLookup(this, 'TradhoxZone', {
domainName: 'tradhox.com',
});
// Create a certificate in us-east-1 for CloudFront
const certificate = new acm.DnsValidatedCertificate(this, 'SiteCertificate', {
domainName: 'partners.tipro.in',
domainName: 'betapartners.tradhox.com',
hostedZone: zone,
region: 'us-east-1', // CloudFront requires certificates to be in us-east-1
});
@ -49,7 +41,7 @@ export class BetaSupplierSiteStack extends cdk.Stack {
// origins.S3BucketOrigin.withOriginAccessControl will automatically create an Origin Access Control (OAC)
// and update the S3 bucket policy to allow access only from this CloudFront distribution.
const distribution = new cloudfront.Distribution(this, 'BetaSupplierSiteDistribution', {
domainNames: ['partners.tipro.in'],
domainNames: ['betapartners.tradhox.com'],
certificate: certificate,
defaultRootObject: 'index.html',
defaultBehavior: {
@ -97,7 +89,7 @@ export class BetaSupplierSiteStack extends cdk.Stack {
// 3. Create Route53 A Record to point to the CloudFront Distribution
new route53.ARecord(this, 'SiteAliasRecord', {
recordName: 'partners.tipro.in',
recordName: 'betapartners.tradhox.com',
target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)),
zone
});