[AWS] Using AWS Elastic Beanstalk
Elastic Beanstalk is a powerful Development Operations tool (Dev Ops) to deploy your code to AWS services and infrastructure with minimal effort.
EB CLI
We'll be using the Command Line Interface to work with Elastic Beanstalk. This will provide us with a set of commands to create new applications and deploy code to these systems. Before continuing, you must install the EB CLI by reading the AWS Doc Instructions for Install for your platform.
Run:
eb --version
eb init
After running the eb init
command and following the guided setup will create a new directory in our project named .elasticbeanstalk
. Within this configuration file, there is a configuration file named config.yml
. This is the set of instructions Elastic Beanstalk will follow when provisioning your AWS infrastructure and deploying your code.
config.yml:
Add following code to the file:
branch-defaults: default: ... deploy: artifact: ./www/Archive.zip global:
ElasticBeanstalk only interests in source code, put all the code into zip with package.json.
You can also upload zip using mangement console.
Creating Deployable Build Archives and Deploying
Now that you have a running Beanstalk instance, we must package our code into a format that is usable by Elastic Beanstalk. We do this by transpiring our typescript into javascript and then zipping the contents into a single file which we can upload. NPM allows us to define simple script commands in the package.json
file. As described in the video, we've included the build
command to perform these steps for us.
"clean": "rimraf www/ || true",
"build": "npm run clean && tsc && cp -rf src/config www/config && cp .npmrc www/.npmrc && cp package.json www/package.json && cd www && zip -r Archive.zip . && cd ..",
Run:
npm run build
It creates `/www` folder and `Archive.zip`.
Deploy to AWS
Runing:
eb create
Choose:
Environment Name, DNS CNAME prefix, load balance type: 2) application Spot Fleet request: N
After successfully deploy to Elastic Beanstalk, open AWS Management Console -> Elastic Beanstalk -> Configuration -> Software -> Edit button
Add all necessary Environment properties.
In "Configuration" -> "Security", can see that it is using
Need to assign: AmazonRDSDataFullAccess, AmazonS3FullAccess, AdministratorAccess-AWSElasticBeanstalk and AWSElasticBeanstalkReadOnly.
Since we need to modify s3, database, and ElasticBeanstalk needs to setup EC2 and load balancer.
After the settings, application should work
相关文章
- “ZETA+AWS Industrial AI”物联监测方案,实现楼宇预测性维护
- [工作随笔]Python 和AWS CDK的aws-route53那些事
- 从AWS自研交换机的初心看背锅侠的未来
- MySQL Error number: MY-011421; Symbol: ER_KEYRING_AWS_INVALID_DATA_FILE_PATH; SQLSTATE: HY000 报错 故障修复 远程处理
- 清除AWS实例和卷详解程序员
- Amazon AWS 常用服务及常见问题汇总(AWS架构师面试必备)架构师
- 长达三周的亚马逊 re:Invent,CEO 披露了 AWS 业务现状并“疯狂”输出 27 款新发布
- 狼来了!AWS宁夏区域可能6、7月份投入运营
- 如何评价 MXNet 被亚马逊AWS 选为官方深度学习平台
- Apple的MacOS首次出现在云端,AWS EC2实例迎来大更新
- 使用甲骨文云服务半年后,AWS宣布其仍是Zoom的首选云服务商
- 年收入540亿美元,AWS带来8字『中国战略』
- AWS改变MySQL配置,创建更加美好的未来(aws改mysql配置)
- 使用AWS同步构建MySQL数据库环境(aws同步mysql)
- 实现高可用性的AWS与MySQL复制(aws mysql 复制)
- AWS MySQL备份确保数据安全(aws mysql 备份)
- 深入探索AWS与Oracle的强强合作(aws与oracle)
- 利用AWS拉取MySQL日志,轻松掌控数据安全(aws拉取mysql日志)
- 探索Oracle云和AWS的全新世界(oracle云和aws)
- Redis实现从AWS迁移简化(redis迁移aws)
- 亚马逊云服务CEO劝合作伙伴:别想着一脚踏两船,专心和我们合作就好 | AWS re:Invent 大会