https://github.com/yhidetoshi/python-awscli-tool
pythonで自作aws-cli-tools作ってみた
https://github.com/yhidetoshi/python-awscli-tool
aws boto3 cli python
Last synced: 5 months ago
JSON representation
pythonで自作aws-cli-tools作ってみた
- Host: GitHub
- URL: https://github.com/yhidetoshi/python-awscli-tool
- Owner: yhidetoshi
- Created: 2018-05-05T06:28:49.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-14T08:26:30.000Z (about 8 years ago)
- Last Synced: 2025-09-30T07:02:12.556Z (9 months ago)
- Topics: aws, boto3, cli, python
- Language: Python
- Homepage:
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README

- [Pythonについて]
- Python 3.6.5 と boto3(1.7.11)実装
- Python 3x系だと動くと思います
#### [準備]
- python 3系をインストール
- `$ git clone https://github.com/yhidetoshi/python-awscli-tool`
- `$ cd python-awscli-tool`
- `$ pip install prettytable click boto3 json tqdm`
- awscli.pyをコマンドオプションをつけて実行する(実行オプションは以下に記載)
#### [参考]
- boto3
- https://boto3.readthedocs.io/en/latest/
- click
- http://click.pocoo.org/5/api/
- aws-sdk-goで独自実装した版はこちら
- https://github.com/yhidetoshi/go-awscli-tool
#### [コマンド help1]
- **`$ ./awscli.py --help`**
```
Usage: awscli.py [OPTIONS] COMMAND [ARGS]...
Subcommand click CLI
Options:
-p, --profile TEXT
--help Show this message and exit.
Commands:
asg AutoScaling API
ec2 EC2 API
rds RDS API
route53 Route53 API
s3 S3 API
```
#### [コマンド help2]
- **`$ ./awscli.py ec2 --help`**
```
Usage: awscli.py ec2 [OPTIONS] COMMAND [ARGS]...
EC2 API
Options:
--help Show this message and exit.
Commands:
create_ami Amazon Linux Image Create API
delete_ami Amazon Linux Image Delete API
describe_ami Amazon Linux Image List API
describe_instances EC2 DescribeInstances API
start_instances EC2 RunInstances API
stop_instances EC2 StopInstances API
terminate_instances EC2 TerminateInstances API
```
### EC2
```
■ Instance一覧
> $ ./awscli.py ec2 describe_instances
■ profileの場合
> $ ./awscli.py -p ec2 describe_instances
■ Instance起動
> $ ./awscli.py ec2 run_instances --instance-id=i-xxxxxxxxxxx
■ Instance停止
> $ ./awscli.py ec2 stop_instances --instance-id=i-xxxxxxxxxxx
■ Instance削除
> $ ./awscli.py ec2 terminate_instances --instance-id=i-xxxxxxxxxxx
■ AMI一覧(作成順にソート)
> $ ./awscli.py ec2 describe_ami
■ AMI作成(Register)
> $ ./awscli.py ec2 create_ami --imageid=ami-xxxxxxx --aminame=NAME
■ AMI削除(Deregister)
> $ ./awscli.py ec2 delete_ami --imageid=ami-xxxxxxx
```
### AutoScaling
```
■ AutoScaling情報一覧
> $ ./awscli.py asg describe_asg
■ AutoScaling Maxの変更
> $ ./awscli.py asg update_max --asgname=ASGNAME --max=NUM
■ AutoScaling Minの変更
> $ ./awscli.py asg update_min --asgname=ASGNAME --min=NUM
■ AutoScaling Desireの変更
> $ ./awscli.py asg update_desire --asgname=ASGNAME --desire=NUM
```
### RDS
```
■ インスタンス一覧
> $ ./awscli.py rds describe_instances
■ インスタンス起動
> $ ./awscli.py rds start_instances --name={DBInstanceIdentifier}
■ インスタンス停止
> $ ./awscli.py rds stop_instances --name={DBInstanceIdentifier}
```
### Route53
```
■ Zone一覧
> $ ./awscli.py route53 describe_zones
■ Zoneid指定のレコード情報取得
> $ ./awscli.py route53 describe_records --zone-id=ID
```
### S3
```
■ バケット一覧
> $ ./awscli.py s3 list_buckets
```