EB CLI 是 Elastic Beanstalk 的命令行界面,它提供了可简化从本地存储库创建、更新和监控环境的交互式命令。将 EB CLI 用作每日开发和测试周期的一部分,取代 AWS 管理控制台。
Prerequisites
Larger than Python 2.7 or Python3.4
安装EB CLI
1 2 3 4 5 6 7
| pip install awsebcli
export PATH=LOCAL_PATH:$PATH source ~/.bashrc
eb --version
|
配置 EB CLI
1 2 3 4 5 6 7 8 9 10 11 12 13
| cd my-app && mvnw clean package -Dmaven.test.skip=true
eb init
eb create
eb deploy
eb logs
|
配置示例(cat .elasticbeanstalk/config.yml)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| branch-defaults: master: environment: my-app-dev group_suffix: null release: environment: my-app-dev group_suffix: null deploy: artifact: target/my-app.war global: application_name: my-app branch: null default_ec2_keyname: mypem default_platform: Java 8 default_region: us-east-1 include_git_submodules: true instance_profile: null platform_name: null platform_version: null profile: eb-cli repository: null sc: git workspace_type: Application
|
反向代理配置
1 2 3 4 5 6 7 8 9 10
| #### Nginx配置如何生效 - 目录结构如下: my-app.war |-- .ebextensions | `-- nginx | `nginx.conf | `agent_deny `-- org `--META-INF `--WEB-INF
|
Pom.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <finalName>${project.artifactId}</finalName> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> <webResources> <resource> <directory>src/main/ebextensions</directory> <targetPath>.ebextensions</targetPath> <filtering>true</filtering> </resource> </webResources> </configuration> </plugin> </plugins> </build>
|
参考链接