[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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2020-03-24 [Angular Unit Testing] Testing Component with ChangeDetectionStrategy.OnPush
2019-03-24 [Functional Programming] Arrow contramap vs map and promap
2015-03-24 [React ] React Fundamentals: Component Lifecycle - Mounting Usage
2015-03-24 [React] React Fundamentals: Component Lifecycle - Mounting Basics
2015-03-24 [React] React Fundamentals: transferPropsTo
2015-03-24 [React] React Fundamentals: Add-on ClassSet() for ClassName
2015-03-24 [React] React Fundamentals: Accessing Child Properties