<h1>AWS Simple EC2 CLI</h1>
<h4>A CLI tool that simplifies the process of launching, connecting and terminating an EC2 instance.</h4>
<p>
<a href="https://golang.org/doc/go1.15">
<img src="https://img.shields.io/github/go-mod/go-version/aws/amazon-ec2-metadata-mock?color=blueviolet" alt="go-version">
</a>
<a href="https://opensource.org/licenses/Apache-2.0">
<img src="https://img.shields.io/badge/License-Apache%202.0-ff69b4.svg?color=orange" alt="license">
</a>
<a href="https://goreportcard.com/report/github.com/awslabs/aws-simple-ec2-cli">
<img src="https://goreportcard.com/badge/github.com/awslabs/aws-simple-ec2-cli" alt="go-report-card">
</a>
</p>
<div>
<hr>
</div>
## Summary
In order to launch a new EC2 instance, customers need to specify a lot of options, and it can be a slow and overwhelming task. It requires users to have an initial network stack (VPC-Id/Subnet-Id/Security-Groups), remote login, and many more. Often times, we require EC2 instance for adhoc testing for a short period of time without requiring complex networking infrastructure in place. AWS Simple EC2 CLI aims to solve this issue and make it easier for users to launch, connect and terminate EC2 instances with a single command
## Major Features
- Launch an instance using single command
- Connect to an instance using single command
- Terminate an instance using single command
- Interactive mode that help users to decide parameters to use
- Config file for more convenient launch
## Installation and Configuration
### Install AWS CLI
To execute the CLI, you will need AWS credentials configured. Take a look at the [AWS CLI configuration documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#config-settings-and-precedence) for details on the various ways to configure credentials. Alternatively, you can try out the AWS Simple EC2 CLI by populating following environment variables:
```
export AWS_ACCESS_KEY_ID="..."
export AWS_SECRET_ACCESS_KEY="..."
# Set default Region (optional)
export AWS_REGION="us-east-1"
```
### Install w/ Homebrew
```
brew tap aws/tap
brew install aws-simple-ec2-cli
```
### Install w/ Curl
#### MacOS/Linux
```
curl -Lo simple-ec2 https://github.com/awslabs/aws-simple-ec2-cli/releases/download/v0.7.0/simple-ec2-`uname | tr '[:upper:]' '[:lower:]'`-amd64
chmod +x simple-ec2
```
#### ARM Linux
```
curl -Lo simple-ec2 https://github.com/awslabs/aws-simple-ec2-cli/releases/download/v0.7.0/simple-ec2-linux-arm
```
```
curl -Lo simple-ec2 https://github.com/awslabs/aws-simple-ec2-cli/releases/download/v0.7.0/simple-ec2-linux-arm64
```
#### Windows
```
curl -Lo simple-ec2 https://github.com/awslabs/aws-simple-ec2-cli/releases/download/v0.7.0/simple-ec2-windows-amd64.exe
```
## Examples
### Launch
**All CLI Options**
```
$ simple-ec2 launch -h
Launch an Amazon EC2 instance with the default configurations. All configurations can be overridden by configurations provided by configuration files or user input.
Usage:
simple-ec2 launch [flags]
Flags:
-a, --auto-termination-timer int The auto-termination timer for the instance in minutes
-b, --boot-script string The absolute filepath to a bash script passed to the instance and executed after the instance starts (user data)
-h, --help help for launch
-p, --iam-instance-profile string The profile containing an IAM role to attach to the instance
-m, --image-id string The image id of the AMI used to launch the instance
-t, --instance-type string The instance type of the instance
-i, --interactive Interactive mode
-k, --keep-ebs Keep EBS volumes after instance termination
-l, --launch-template-id string The launch template id with which the instance will be launched
-v, --launch-template-version string The launch template version with which the instance will be launched
-r, --region string The region where the instance will be launched
-c, --save-config Save config as a JSON config file
-g, --security-group-ids strings The security groups with which the instance will be launched
-s, --subnet-id string The subnet id in which the instance will be launched
--tags stringToString The tags applied to instances and volumes at launch (Example: tag1=val1,tag2=val2) (default [])
```
**Single Command Launch**
```
$ simple-ec2 launch
+--------------------------------------+--------------------------+
| Region | us-east-1 |
+--------------------------------------+--------------------------+
| VPC | vpc-example |
+--------------------------------------+--------------------------+
| Subnet | subnet-example |
+--------------------------------------+--------------------------+
| Instance Type | t1.micro |
+--------------------------------------+--------------------------+
| Image | ami-047a51fa27710816e |
+--------------------------------------+--------------------------+
| Security Group | sg-example |
+--------------------------------------+--------------------------+
| Keep EBS Volume(s) After Termination | false |
+--------------------------------------+--------------------------+
| Auto Termination Timer in Minutes | None |
+--------------------------------------+--------------------------+
| EBS Volumes | /dev/xvda(gp2): 8 GiB |
+--------------------------------------+--------------------------+
[ yes / no ]
Please confirm if you would like to launch instance with following options: yes
Options confirmed! Launching instance...
Launch Instance Success!
Instance ID: i-123example
```
**Single Command Launch With Flags**
```
$ simple-ec2 launch -r us-east-2 -m ami-123example -t t2.micro -s subnet-123example -g sg-123example
+--------------------------------------+--------------------------+
| Region | us-east-2 |
+--------------------------------------+--------------------------+
| VPC | vpc-example |
+--------------------------------------+--------------------------+
| Subnet | subnet-123example |
+--------------------------------------+--------------------------+
| Instance Type | t1.micro |
+--------------------------------------+--------------------------+
| Image | ami-123example |
+--------------------------------------+--------------------------+
| Security Group | sg-123example |
+--------------------------------------+--------------------------+
| Keep EBS Volume(s) After Termination | false |
+--------------------------------------+--------------------------+
| Auto Termination Timer in Minutes | None |
+--------------------------------------+--------------------------+
| EBS Volumes | /dev/xvda(gp2): 8 GiB |
+--------------------------------------+--------------------------+
[ yes / no ]
Please confirm if you would like to launch instance with following options: yes
Options confirmed! Launching instance...
Launch Instance Success!
Instance ID: i-123example
```
**Interactive Mode Launch**
```
$ simple-ec2 launch -i
+--------+----------------+---------------------------+
| OPTION | REGION | DESCRIPTION |
+--------+----------------+---------------------------+
| 1. | ap-northeast-1 | Asia Pacific (Tokyo) |
+--------+----------------+---------------------------+
| 2. | ap-northeast-2 | Asia
没有合适的资源?快使用搜索试试~ 我知道了~
aws-simple-ec2-cli:一个CLI工具,可简化启动,连接和终止EC2实例的过程
共75个文件
go:37个
md:5个
json:4个
5星 · 超过95%的资源 需积分: 15 1 下载量 113 浏览量
2021-05-22
20:36:31
上传
评论
收藏 126KB ZIP 举报
温馨提示
AWS Simple EC2 CLI 一个CLI工具,可简化启动,连接和终止EC2实例的过程。 概括 为了启动新的EC2实例,客户需要指定很多选项,这可能是一项缓慢而繁重的任务。 它要求用户具有初始网络堆栈(VPC-Id / Subnet-Id / Security-Groups),远程登录等。 通常,我们需要在短时间内进行EC2实例的临时测试,而无需使用复杂的网络基础架构。 AWS Simple EC2 CLI旨在解决此问题,并使用户可以通过单个命令更轻松地启动,连接和终止EC2实例 主要特点 使用单个命令启动实例 使用单个命令连接到实例 使用单个命令终止实例 交互式模式,可帮助用户确定要使用的参数 配置文件,更方便启动 安装与配置 安装AWS CLI 要执行CLI,您将需要配置AWS凭证。 请参阅以了解有关配置凭证的各种方法的详细信息。 或者,您可以通过填充以下环境变量来试用AWS
资源详情
资源评论
资源推荐
收起资源包目录
aws-simple-ec2-cli-main.zip (75个子文件)
aws-simple-ec2-cli-main
go.mod 372B
pkg
question
question_test.go 26KB
question.go 35KB
ec2instanceconnecthelper
ec2instanceconnecthelper_test.go 3KB
ec2instanceconnecthelper.go 5KB
tag
tag_test.go 2KB
tag.go 1KB
table
table.go 6KB
table_test.go 6KB
config
config_test.go 5KB
config.go 5KB
ec2helper
ec2helper.go 34KB
types.go 3KB
ec2helper_test.go 31KB
cli
cli_test.go 1KB
cli.go 2KB
iamhelper
iamhelper.go 968B
cfn
template.go 2KB
cfn_test.go 7KB
types.go 1KB
cfn.go 6KB
template_test.go 1KB
main.go 839B
.github
PULL_REQUEST_TEMPLATE.md 164B
workflows
ci.yaml 2KB
go.sum 16KB
Config 607B
Dockerfile 756B
scripts
build-binaries 2KB
draft-release-notes 1KB
sync-to-aws-homebrew-tap 7KB
build-docker-images 2KB
prepare-for-release 9KB
create-local-tag-for-release 4KB
upload-resources-to-github 2KB
cloudformation_template.json 4KB
CONTRIBUTING.md 3KB
.travis.yml 480B
LICENSE 10KB
test
readme-test
rundoc-Dockerfile 106B
run-readme-codeblocks 2KB
readme-codeblocks.go 2KB
run-readme-spellcheck 517B
spellcheck-Dockerfile 98B
testhelper
cfn_mock.go 2KB
selector_mock.go 943B
ec2helper_mock.go 10KB
iam_mock.go 1KB
testhelper.go 3KB
go-report-card-test
run-report-card-test.sh 728B
Dockerfile 333B
license-test
gen-license-report.sh 386B
run-license-test.sh 703B
license-config.hcl 336B
Dockerfile 186B
shellcheck
run-shellcheck 818B
manual.go 472B
e2e
e2e-connect-test
cloudformation_template.json 3KB
e2e_connect_test.go 4KB
e2e-cfn-test
e2e_cfn_test.go 2KB
cloudformation_template.json 5KB
e2e-ec2helper-test
e2e_ec2helper_test.go 12KB
cloudformation_template.json 4KB
README.md 28KB
Makefile 6KB
NOTICE 67B
BUILD.md 1KB
CODE_OF_CONDUCT.md 308B
THIRD_PARTY_LICENSES 17KB
.gitignore 35B
cmd
flags.go 837B
terminate.go 4KB
connect.go 4KB
launch.go 20KB
root.go 1KB
共 75 条
- 1
dongyuwu
- 粉丝: 39
- 资源: 4559
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1