Deploying Angular to AWS - S3 or Elastic Beanstalk?

2,343 views
Skip to first unread message

William Saxton

unread,
Oct 17, 2017, 2:32:53 AM10/17/17
to Angular and AngularJS discussion
I'd like to use AWS to host my Angular web app, as well as use all of the Amazon cloud services as necessary (DynamoDB, ElasticCache, etc).  I planned on using Elastic Beanstalk because I have experience with Heroku so I assumed it was similar.

But now I see a lot of advice to deploy apps to AWS via S3 instead.  Is this only for stack sites with static pages?  Can you still deploy your site to S3 and interact with other AWS services, such as authentication, web services, etc?  I don't see ANY examples of people deploying Angular to Elastic Beanstalk, so I'm wondering if that's because S3 is the best way to do it.

Sander Elias

unread,
Oct 17, 2017, 3:40:56 AM10/17/17
to Angular and AngularJS discussion
Hi William,

Well, as I said, you can host an Angular app anywhere you can host a static website. So you can host it anywhere that lets you serve HTML. That does include EB. Interacting with other AWS services is not tied to the place of hosting. I have done a number of those and never ran into any problem that was related to the place of hosting. 

TLDR: Nope, you are free to host wherever you fancy!
Most people fancy S3 because it's cheaper to host stuff on there. You build on your dev machine and deploy the build by simply uploading your dist folder. (or you arrange that in you CI pipeline). If you want to build on the deployment server, EB might help.

Regards
Sander

Charles Jackson

unread,
Oct 18, 2017, 11:20:14 AM10/18/17
to Angular and AngularJS discussion
Hey,

I host on S3, deployed through a code pipeline on commit. The backend is a docker swarm hosted on several EC2 instances. Works like a charm.

Zlatko Đurić

unread,
Oct 19, 2017, 3:11:18 AM10/19/17
to Angular and AngularJS discussion
Hi William,


On Tuesday, October 17, 2017 at 8:32:53 AM UTC+2, William Saxton wrote:
I'd like to use AWS to host my Angular web app, as well as use all of the Amazon cloud services as necessary (DynamoDB, ElasticCache, etc).  I planned on using Elastic Beanstalk because I have experience with Heroku so I assumed it was similar.

But now I see a lot of advice to deploy apps to AWS via S3 instead.  Is this only for stack sites with static pages?  Can you still deploy your site to S3 and interact with other AWS services, such as authentication, web services, etc?  I don't see ANY examples of people deploying Angular to Elastic Beanstalk, so I'm wondering if that's because S3 is the best way to do it.


You can deploy a static site on S3 (and then put Cloudfront in front of it, that's the usual way). As for interacting with other AWS services, it depends on services themselves and the design of your system. An Angular app can, from the client directly (e.g. browser) you can access AWS services using AWS Cognito or similar. E.g. for DynamoDB you'd use AWS JavaScript SDK which can sign your requests etc. The SDK will encrypt your payload etc. Other services, you might need to also deploy some sort of API or proxy, usually on ElasticBeanstalk or you can use an AWS Lambda function.

The benefits of this direct approach is that you have no "backend" to maintain. The disadvantage is that each and all of your clients must what your datastructures look like, constrains etc.


Reply all
Reply to author
Forward
0 new messages