継続は力なり

タイトル通り定期的な更新を心掛けるブログです。

【18日目】CloudMapperに入門した

毎日更新する勉強日記の更新が滞っていました。。。

今回は前々から気になっていたCloudMapperについてまとめていきます。

CloudMapperとは

CloudMapperは、OSSのソフトウェアで、AWS環境のネットワーク構成図をブラウザで管理できます。

CloudMapper helps you analyze your Amazon Web Services (AWS) environments. The original purpose was to generate network diagrams and display them in your browser. It now contains much more functionality.

duo.com github.com

利用条件

利用条件として、以下の引用にもあるように、Python3で、pipとvirtualenvの他に、jq、pyjqも必要とあります。

python 3 (3.7.0rc1 is known to work), pip, and virtualenv

You will also need jq (https://stedolan.github.io/jq/) and the library pyjq (https://github.com/doloopwhile/pyjq), which require some additional tools installed that will be show

セットアップ

MacOSと、Linux向けのセットアップがまとめられていたので、以下に転記します。 僕の端末はMacなんで、Macのセットアップを実行しています。

for MacOS

# clone the repo
git clone git@github.com:duo-labs/cloudmapper.git
# Install pre-reqs for pyjq
brew install autoconf automake libtool jq awscli python3
cd cloudmapper/
pipenv install --skip-lock
pipenv shell

for Linux

# clone the repo
git clone git@github.com:duo-labs/cloudmapper.git
# (AWS Linux, Centos, Fedora, RedHat etc.):
# sudo yum install autoconf automake libtool python3-devel.x86_64 python3-tkinter jq awscli
# (Debian, Ubuntu etc.):
# You may additionally need "build-essential"
sudo apt-get install autoconf automake libtool python3-dev python3-tk jq awscli
cd cloudmapper/
pipenv install --skip-lock
pipenv shell

セットアップが完了したらMacではこんな状態になりました。

» pipenv shell
Launching subshell in virtual environment…
 . /Users/tada/.local/share/virtualenvs/cloudmapper-V_CzBNi6/bin/activate
xxxxxx :: ~/cloudmapper »  . /Users/tada/.local/share/virtualenvs/cloudmapper-V_CzBNi6/bin/activate
(cloudmapper-V_CzBNi6) xxxxx :: ~/cloudmapper »

デモ実行

デモの環境も用意されているため、まずはデモ環境を動かしてみます。

(cloudmapper-V_CzBNi6) xxxxx :: ~/cloudmapper » python cloudmapper.py prepare --config config.json.demo --account demo
Building data for account demo (123456789012)
- 0 nodes built in region ap-south-1
- 0 nodes built in region eu-west-3
- 0 nodes built in region eu-west-2
- 0 nodes built in region eu-west-1
- 0 nodes built in region ap-northeast-2
- 2 nodes built in region ap-northeast-1
- 0 nodes built in region sa-east-1
- 0 nodes built in region ca-central-1
- 0 nodes built in region ap-southeast-1
- 0 nodes built in region ap-southeast-2
- 0 nodes built in region eu-central-1
- 0 nodes built in region us-east-1
- 0 nodes built in region us-east-2
- 0 nodes built in region us-west-1
- 0 nodes built in region us-west-2
- 2 external CIDRs built
- 4 connections built
(cloudmapper-V_CzBNi6) xxxxx :: ~/cloudmapper » python cloudmapper.py webserver
CloudMapper serving on 127.0.0.1:8000

この状態になったら、ブラウザから「http://127.0.0.1:8000」にアクセスします。 f:id:sadayoshi_tada:20181008165448p:plain

デモ環境の確認ができたので、自分の環境を見えるようにしてみたいと思います。

自分の環境のセットアップ

まとめ

今回CloudMapperの導入と、自分の環境のネットワーク構成図を表示させるところまでやってみました。