https://pulumi.com logo
#general
Title
# general
m

miniature-potato-84713

12/14/2018, 12:15 AM
Problem I have a bunch of static html websites that need hosting. Other infrastructure is already in AWS (S3 buckets or EC2). However, because the web-pages need to respond to the client’s
Accept-Language
header or a saved cookie, I think we’ll have to do some URL rewriting (to ensure transparency and SEO). For example,
foo.bla/site.html
should forward to
foo.bla/en/site.html
by default, or whatever language the header/cookie contained. Solutions 1. Client-side Javascript “cloaking” etc are off the table, I think. Doesn’t play well with SEO and is annoying for clients. 2. Use AWS S3 and web-page redirect: https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html 3. Host the site in a Kubernetes container with nginx/apache. Of 2. and 3. I am leaning towards 2. because it’s probably easiest to set up for now. Both could be implemented using Pūlumi, and that would be the right way to go about it. What are your thoughts, and does Pūlumi handle the redirect configurations for 2.?
w

white-balloon-205

12/14/2018, 12:22 AM
(2) is certainly easier if it will work for all your requirements, so I'd suggest starting with that and then falling back to (3) if you hit some wall (due to potential S3 hosting limitations). Our https://pulumi.io site is actually served from an S3 bucket, using the Pulumi program here (which includes also the Route53, CloudFront, etc. needed for that site's hosting): https://github.com/pulumi/docs/blob/master/infrastructure/index.ts We don't use redirect rules for that site, but they area available via the Pulumi API. See
routingRules
at https://github.com/pulumi/pulumi-aws/blob/master/sdk/nodejs/s3/bucket.ts#L109 and the format of routing rules here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules.html
c

creamy-potato-29402

12/14/2018, 12:48 AM
@miniature-potato-84713 I would actually advise always going with the managed option if you don’t need the flexibility of the orchestrator.
@white-balloon-205 is correct here IMO
m

miniature-potato-84713

12/14/2018, 1:44 AM
Neat, thanks @white-balloon-205 for the links! I’ll get to it this week/end/ish. Before Christmas for sure 😄
@white-balloon-205, looks like the repo that implements
<http://pulumi.io|pulumi.io>
is (very) similar to this example https://github.com/pulumi/examples/tree/master/aws-ts-static-website ?
w

white-balloon-205

12/14/2018, 9:46 PM
Yes - that's right!
👍 1
m

miniature-potato-84713

12/14/2018, 9:48 PM
…and I can tie the Github actions into it as well, so that a push to
master
will update the S3 content objects?
w

white-balloon-205

12/15/2018, 6:10 AM
Yep. You can do something simple and already available like Travis - that’s what the docs site I linked above does - you can see how it’s Travis job deploys to the corresponding stack for some branches (like
master
and
production
). If you have access to Actions, you could do that too in a similar way.
m

miniature-potato-84713

12/19/2018, 12:27 AM
@white-balloon-205, getting started on this now.
pulumi new
is probably best, but the
<https://github.com/pulumi/docs/tree/master/infrastructure>
would be a
aws-typescript
template?