tyabu12 / isucon-aws-terraform

Create ISUCON environment on AWS via Terraform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

isucon-aws-terraform

これはなに?

ISUCON環境をAWS EC2へ構築するためのTerraformモジュール郡です。

詳細と利用方法を記載した記事ページ

https://qiita.com/momotaro98/items/24cec11fc050c014057f

設定する必要がある項目

EC2へのSSH用Key生成とPublic Keyの設定

専用鍵がなければ以下のようにして鍵を生成する。

ssh-keygen -t rsa -b 4096 -C "isucon key" -f isucon_id_rsa

公開鍵をisucon_id_rsa.pubの名前で以下の場所に置く。

modules/credential/isucon_id_rsa.pub

terraformで構築後、以下のような設定でEC2へSSHできる。

~/.ssh/config

Host isucon-practice-ec2
  HostName your_EC2_public_name
  Port 22
  User ubuntu
  IdentityFile ~/.ssh/isucon_id_rsa
  IdentitiesOnly yes
  RequestTTY yes
  RemoteCommand sudo su - isucon

login

ssh isucon-practice-ec2
isucon@ip-10-2-0-25:~$ ls
bench  env.sh  go  local  webapp

パラメータ設定

ファイルの優先順位

  1. terraform.tfvars.json => .gitignoreしていますので、利用者がファイルをローカル上で作成する必要があります。
  2. variables.tf => デフォルト値を指定しています。

パラメータ設定マニュアル

こちらを参照してください。

Run terraform

初回

terraform init

初回以降

terraform plan
terraform apply
terraform destroy

ファイルフォーマット、バリデーション

terraform fmt -recursive
terraform validate

About

Create ISUCON environment on AWS via Terraform


Languages

Language:HCL 100.0%