Deploying to Amazon

Hey. I’m thinking about deploying my ember app on Amazon AWS. It seems that it would be a good thing to deploy the build files to S3 storage, and use the static websites option.

My question is, how will routing work? Is the use of hashtags mandatory? (which I absolutely do not want to use). Does anybody have any experience with this? Or should I just use an EC2?

Where should I deploy my backend API and where should I put the actual ember app? I’m looking for a little bit of guidance. Thanks so much.

Well, I don’t have any specific experience with S3 hosting of Ember apps, I’ve used Firebase’s static hosting and I did have to use /#/. It looks like there are some url re-write abilities for S3, but I don’t know much about it.

GitHub - ember-cli-deploy/ember-cli-deploy: A deployment pipeline for Ember CLI apps is one way to do it. I think it includes an S3 adapter for the index.html too so you could serve the whole thing from cloudfront.

There are a couple of options for avoiding the hashtags in an Amazon S3 hosted Ember.js app.

  • Make index.html the S3 ErrorDocument
  • Editing the S3 Redirection Rules

More detail in S3 Static Website Hosting Route All Paths to Index.html on StackOverflow.

The alternative is to continue serving your assets (CSS, JS, Fonts etc.) out of an S3 bucket but serve up the index.html file from your backend (using your backend as a proxy for the S3 stored index.html). The README for ember-cli-deploy goes into detail about the ‘canonical’ approach and Kerry Gallagher writes specifically about the index from S3 in this blog post, Deploying an ember-cli application to Amazon S3.

What back-end are you using @tehmaestro?

1 Like

Cool. Thanks. I’m using PHP as a backend, deployed with EBS.

Nice. So if I assume correctly, you’ll have access to the file system. Therefore one way to go about it would be to fetch the index.html from S3, write it to EBS and serve it from your backend.

There’s now a section in the REAME of ember-deploy-s3-index on how to setup Redirection Rules to use History API when deploying to S3:

https://github.com/Kerry350/ember-deploy-s3-index#using-history-location

The workaround with the error.html → index.html is not that great of an idea because it throws 404 errors all over the place and according to stack overflow may also hurt your google search rank if that happens too often.

@LevelbossMike Not sure where you got the impression that it throw 404 errors. What it should do is fire a 301 redirect.

I’ve been working on an Angular2 website @ http://dev.evanplaice.com.

AFAIK, the hash url is required but it should be possible for the router to rewrite a clean history. Besides, the redirect is only necessary on inbound linking. Once the app loads, everything works as one would expect from a SPA.