LoginSignup
0
1

More than 3 years have passed since last update.

[やってみた]AWS EC2にCloudMapperを構築

Posted at

環境

AWS EC2 Amazon Linux 2 AMI

構築手順

アクセスキーの取得

[IAM]-[ユーザ]-[ユーザ名]-[認証情報]より、アクセスキーを作成し、アクセスキーとシークレットアクセスキーを控える

CloudMapperの取得と配置

$ sudo yum install git -y
$ git clone https://github.com/duo-labs/cloudmapper.git

$ sudo yum install autoconf automake libtool python34-devel jq -y
$ sudo yum install python3.x86_64 python3-tkinter.x86_64  python3-devel.x86_64 python3-pip.noarch -y

nginxのインストール

$ sudo amazon-linux-extras install nginx1.12 -y
$ sudo systemctl enable nginx
$ sudo systemctl start nginx

Pythonモジュールのインストール

$ sudo pip3 install pyyaml
$ sudo pip3 install parliament
$ sudo pip3 install pyjq
$ sudo pip3 install netaddr
$ sudo pip3 install policyuniverse
$ sudo pip3 install jinja2

AWS CLIの環境設定

$ aws configure
AWS Access Key ID [None]: アクセスキー
AWS Secret Access Key [None]: シークレットアクセスキー
Default region name [None]: リージョン名(英語)
Default output format [None]: json

リージョン、アベイラビリティーゾーン、および ローカルゾーン

CloudMapperの初期設定

$ cd cloudmapper
$ AWS_ID=$(aws sts get-caller-identity \
    --query "Account" \
    --output text) \
    && echo ${AWS_ID}

$ python3 cloudmapper.py configure add-account --config-file config.json --name dev.io --id ${AWS_ID} --default DEFAULT
$ python3 cloudmapper.py configure add-account --config-file config.json --name demodemo --id ${AWS_ID}

利用方法

構成情報の取得

$ python3 cloudmapper.py collect --config config.json --account demodemo
$ python3 cloudmapper.py prepare --config config.json --account demodemo

アクセス

http://ec2-xxx.xxx.xxx.xxx.ap-northeast-1.compute.amazonaws.com/
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1