pulumi-aws icon indicating copy to clipboard operation
pulumi-aws copied to clipboard

Route53 + S3 zoneId not being respected

Open sarink opened this issue 2 years ago • 3 comments

What happened?

It is impossible to create a route53 alias that points to an s3 bucket.

The expected result is achieved immediately by manually creating the record in the UI.

Steps to reproduce

    const rootDomain = 'my-domain.com';

    const zoneId = aws.route53
      .getZone({ name: rootDomain }, { async: true })
      .then((zone) => zone.zoneId);

    const bucket = new aws.s3.Bucket(rootDomain, {
      bucket: rootDomain,
      hostedZoneId: zoneId,
      acl: aws.s3.PrivateAcl,
    });

    // This breaks
    new aws.route53.Record(rootDomain, {
      name: rootDomain,
      zoneId,
      type: 'A',
      aliases: [
        {
          zoneId: bucket.hostedZoneId,
          name: bucket.bucketDomainName,
          evaluateTargetHealth: false,
        },
      ],
    });

Expected Behavior

I expected a route53 alias in my custom zone to be created which points to the s3 bucket

Actual Behavior

[Tried to create an alias that targets my-domain.com.s3.amazonaws.com.,
type A in zone 1234, but the alias target name does not lie within the target zone]

Output of pulumi about

CLI          
Version      3.52.1
Go Version   go1.19.5
Go Compiler  gc

Plugins
NAME    VERSION
nodejs  unknown

Host     
OS       darwin
Version  12.6
Arch     arm64

Additional context

Attempting to do this: https://aws.amazon.com/blogs/aws/root-domain-website-hosting-for-amazon-s3/ but it doesn't seem possible with pulumi

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

sarink avatar Jan 23 '23 03:01 sarink

Thanks for logging this, and for the concise explanation of what you're trying to do ⭐ We'll have a look into it.

squaremo avatar Jan 25 '23 13:01 squaremo

any update on that one? I have the same issue with Bucket v2

RomainSF avatar May 20 '24 07:05 RomainSF

Please remember to upvote the issue if it is important to you as it helps our team prioritize!

t0yv0 avatar Jun 13 '24 23:06 t0yv0

Having a quick look again here, I believe it's entirely possible to host a static website on S3 with Pulumi. Please check out the https://github.com/pulumi/examples/blob/master/aws-ts-static-website/index.ts example. This example involves a CloudFront configuration which is recommended, but may not be required.

Please have a look at https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucketwebsiteconfigurationv2/ that is definitely required in a complete setup.

t0yv0 avatar Oct 23 '24 21:10 t0yv0