将战争从S3部署到AWS Elastic Beanstalk [英] Deploy war from S3 to AWS Elastic Beanstalk
问题描述
我有2台AWS机器, 1.dev(ec2)2. prod(弹性beantalk)
。每次提交后,我都会在dev(machine1)上构建并部署,该提交会生成war文件(该文件也将使用s3cmd工具上传到S3存储桶中)。然后,我在dev机器上测试了新部署的war,如果一切正常,则从dev(ec2)下载了war,然后将其上传到prod机器(Elastic beanstalk)。
I have 2 AWS machines, 1.dev (ec2) 2. prod (elastic beanstalk)
. I build and deploy on dev (machine1) after every commit which results into a war file (which will also be uploaded on an S3 bucket using s3cmd tool). Then I test the newly deployed war on dev machine, if it seems fine, then I download the war from dev(ec2) and then upload it to the prod machine (Elastic beanstalk).
是否有一种方法可以使弹性豆荚直接从S3存储桶中发动战争,而不是从ec2中下载然后再将其上传到弹性豆荚中?
Is there a way to make elastic beanstalk to take the war directly from the S3 bucket, rather than downloading it from ec2 and then uploading it to elastic beanstalk?
我尝试创建新的环境,然后为应用程序版本提供了s3存储桶路径,但是它不起作用。 (出现一些错误,说这只能在VPC中完成。)
I tried creating new environment and then gave s3 bucket path for application version, but it din't work. (gave some error saying "this can only be done in VPC").
推荐答案
我在此帖子:
使用AWS CLI需要3个简单步骤:
it requires 3 simple steps using AWS CLI:
- 上传到S3存储桶: aws s3 cp /var/lib/tomcat7/webapps/ROOT.war s3:// elasticbeanstalk-ap-southeast-1- xxxxxx / myROOT.war
- 创建应用程序版本: aws elasticbeanstalk创建应用程序版本-应用程序名称您的应用名称 --version-label 您的version_label --source-bundle S3Bucket = elasticbeanstalk-ap-southeast-1- xxxxxx ,S3Key = myROOT.war
- 更新您的环境: aws elasticbeanstalk更新环境-环境名称您的环境名称 --version-label 您的版本_标签
- Upload to S3 bucket: aws s3 cp /var/lib/tomcat7/webapps/ROOT.war s3://elasticbeanstalk-ap-southeast-1-xxxxxx/myROOT.war
- Create application version: aws elasticbeanstalk create-application-version --application-name your_app_name --version-label your_version_label --source-bundle S3Bucket=elasticbeanstalk-ap-southeast-1-xxxxxx,S3Key=myROOT.war
- Update your environment: aws elasticbeanstalk update-environment --environment-name your_environment_name --version-label your_version_label
我创建了 bash脚本 ,上述所有步骤仅需3秒。请通过链接获取更多描述性答案。
I have created a bash script, which takes just 3 seconds for all the above steps. Do go through the link for more descriptive answer.
这篇关于将战争从S3部署到AWS Elastic Beanstalk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!