简体   繁体   English

将 Angular 2 应用程序部署到 AWS Elastic Beanstalk

[英]Deploying Angular 2 application into AWS Elastic Beanstalk

I am now developing a front-end application using angular 2. This id for communicating with another micro services deploying in cloud.我现在正在使用 angular 2 开发一个前端应用程序。这个 id 用于与另一个部署在云中的微服务进行通信。 In this Angular 2 application I am not using database interaction.在这个 Angular 2 应用程序中,我没有使用数据库交互。

I need to deploy this Angular 2 application in elastic beanstalk (AWS PaaS).我需要在弹性 beantalk (AWS PaaS) 中部署这个 Angular 2 应用程序。 What are the important procedure that I need to follow for deploying into cloud?部署到云中需要遵循哪些重要程序? I am new to angular framework and cloud platforms.我是 Angular 框架和云平台的新手。 How can I deploy my Angular 2 application into AWS Elastic Beanstalk?如何将我的 Angular 2 应用程序部署到 AWS Elastic Beanstalk 中?

Do you need exactly to elastic beanstalk or you need just deploy to AWS using any suggested solutions?您是完全需要弹性 beanstalk 还是只需要使用任何建议的解决方案部署到 AWS?

If second - simplest way is to deploy Angular2 to S3 bucket, configured to serve static files:如果第二种 - 最简单的方法是将 Angular2 部署到 S3 存储桶,配置为提供静态文件:

  • Go to S3前往 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选中“使用此存储桶托管网站”并为索引和错误页面提供“index.html” 在此处输入图片说明
  • Build solutions using "ng build"使用“ng build”构建解决方案
  • Copy build results from "build" folder into this bucket将“build”文件夹中的构建结果复制到此存储桶中
  • Navigate to links, displayed in "Static website hosting" section导航到链接,显示在“静态网站托管”部分

I think it's got something to do with the aws-sdk imported requiring a node runtime environment to execute properly.我认为这与导入的 aws-sdk 需要节点运行时环境才能正确执行有关。 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.因此 EBS 机器和 EC2 实例适用于该特定用例,因为通过 s3 托管 SPA 没有 nodejs 运行时环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM