Deploying Angular 2 application into AWS Elastic B

2019-07-23 02:47发布

问题:

I am now developing a front-end application using angular 2. This id for communicating with another micro services deploying in cloud. In this angular 2 application I am not using database interaction. I need to deploy this angular 2 application in elastic beanstalk (AWS PaaS). What are the important procedure that I need to follow for deploying into cloud? I am new to angular framework and cloud platforms. Can anyone help guide me to deploy my angular 2 application into AWS Elastic Beanstalk?

Also CAn anyone share any useful documentations for doing this?

回答1:

Do you need exactly to elastic beanstalk or you need just deploy to AWS using any suggested solutions?

If second - simplest way is to deploy Angular2 to S3 bucket, configured to serve static files:

  • Go to S3
  • Create new bucket
  • Open bucket
  • Go to "Properties" tab
  • Select "Static website hosting"
  • Check "Use this bucket to host a website" and provide "index.html" for both index and error pages
  • Build solutions using "ng build"
  • Copy build results from "build" folder into this bucket
  • Navigate to links, displayed in "Static website hosting" section


回答2:

I think it's got something to do with the aws-sdk imported requiring a node runtime environment to execute properly. So the EBS machine and EC2 instances work for that specific use case as hosting a SPA via s3 does not have a nodejs runtime environment.