AWS
Terraform
om732
1. Terraform
2.
3.
AWSをテラフォーミングする会(Terraformハンズオン)
AWSをテラフォーミングする会(Terraformハンズオン)
4 VPC
4 InternetGateway
4 Subnet
4 RouteTable
4 SecurityGroup
4 EC2
4 ELB
Terraform
AWS IaaS/PaaS/SaaS
Terraform
Infrastructure as Code
4
4
4
4
Github
>
>
Terraform>
Github CI
4 terraform =
Terraform
4 dry-run
$ terraform plan
4
$ terraform apply
2
( )
Terraform
HCL JSON
.tf
4 terraform
4 AWS
terraform
$ terraform version
Terraform v0.7.4
AWS
1. IAM
2.
IAM
AWSをテラフォーミングする会(Terraformハンズオン)
AWSをテラフォーミングする会(Terraformハンズオン)
AWSをテラフォーミングする会(Terraformハンズオン)
AWSをテラフォーミングする会(Terraformハンズオン)
AWSをテラフォーミングする会(Terraformハンズオン)
AWSをテラフォーミングする会(Terraformハンズオン)
Terraform
AWSをテラフォーミングする会(Terraformハンズオン)
AWSをテラフォーミングする会(Terraformハンズオン)
AWSをテラフォーミングする会(Terraformハンズオン)
( )
terraform-handson ( )
tf
https://github.com/om732/terraform-handson
1.
2. terraform plan
3.
4. terraform apply
5. AWS
OK
VPC
1.
2. VPC
3. InternetGateway
4. Subnet
5. RouteTable
EC2
1. SecurityGroup
2. EC2
3. ELB
aws.tf
provider "aws" {
access_key = "xxxxxxxxxxxxxxxxxxxx"
secret_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
region = "ap-northeast-1"
}
VPC
vpc.tf
resource "aws_vpc" "terraform_handson_vpc" {
cidr_block = "10.100.0.0/16"
tags {
Name = "terraform_handson_vpc"
}
}
InternetGateway
internet-gateway.tf
resource "aws_internet_gateway" "terraform_handson_igw" {
vpc_id = "${aws_vpc.terraform_handson_vpc.id}"
tags {
Name = "terraform_handson_igw"
}
}
Subnet
subnet.tf
resource "aws_subnet" "terraform_handson_public_subnet_a" {
vpc_id = "${aws_vpc.terraform_handson_vpc.id}"
availability_zone = "ap-northeast-1a"
cidr_block = "10.100.1.0/24"
tags {
Name = "terraform_handson_subnet_a"
}
}
resource "aws_subnet" "terraform_handson_public_subnet_c" {
vpc_id = "${aws_vpc.terraform_handson_vpc.id}"
availability_zone = "ap-northeast-1c"
cidr_block = "10.100.2.0/24"
tags {
Name = "terraform_handson_subnet_c"
}
}
RouteTable
routetable.tf
resource "aws_route_table" "terraform_handson_public_rt" {
vpc_id = "${aws_vpc.terraform_handson_vpc.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.terraform_handson_igw.id}"
}
tags {
Name = "terraform_handson_public_rt"
}
}
resource "aws_route_table_association" "terraform_handson_public_rtassoc_a" {
subnet_id = "${aws_subnet.terraform_handson_public_subnet_a.id}"
route_table_id = "${aws_route_table.terraform_handson_public_rt.id}"
}
resource "aws_route_table_association" "terraform_handson_public_rtassoc_c" {
subnet_id = "${aws_subnet.terraform_handson_public_subnet_c.id}"
route_table_id = "${aws_route_table.terraform_handson_public_rt.id}"
}
VPC
EC2
SecurityGroup
security_group.tf
resource "aws_security_group" "terrafom_handson_instance_sg" {
name = "terraform_handson_instance_sg"
description = "TerraformHandson: instance"
vpc_id = "${aws_vpc.terraform_handson_vpc.id}"
ingress {
protocol = "tcp"
from_port = 22
to_port = 22
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
protocol = "tcp"
from_port = 80
to_port = 80
cidr_blocks = ["0.0.0.0/0"]
}
egress {
protocol = "-1"
from_port = 0
to_port = 0
cidr_blocks = ["0.0.0.0/0"]
}
tags {
Name = "terraform_handson_instance_sg"
}
}
resource "aws_security_group" "terraform_handson_elb_sg" {
name = "terraform_handson_elb_sg"
description = "TerraformHandson: elb"
vpc_id = "${aws_vpc.terraform_handson_vpc.id}"
ingress {
protocol = "tcp"
from_port = 80
to_port = 80
cidr_blocks = ["0.0.0.0/0"]
}
egress {
protocol = "-1"
from_port = 0
to_port = 0
cidr_blocks = ["0.0.0.0/0"]
}
tags {
Name = "terraform_handson_elb_sg"
}
}
EC2
ec2.tf
resource "aws_instance" "terraform_handson_instance_a" {
ami = "ami-374db956"
instance_type = "t2.micro"
key_name = "terraform"
vpc_security_group_ids = ["${aws_security_group.terrafom_handson_instance_sg.id}"]
subnet_id = "${aws_subnet.terraform_handson_public_subnet_a.id}"
associate_public_ip_address = true
root_block_device {
volume_type = "gp2"
volume_size = 8
}
tags {
Name = "terraform_handson_instance_a"
}
user_data = <<EOF
#!/bin/bash
yum install nginx -y
uname -n > /usr/share/nginx/html/index.html
service nginx start
EOF
}
resource "aws_instance" "terraform_handson_instance_c" {
ami = "ami-374db956"
instance_type = "t2.micro"
key_name = "terraform"
vpc_security_group_ids = ["${aws_security_group.terrafom_handson_instance_sg.id}"]
subnet_id = "${aws_subnet.terraform_handson_public_subnet_c.id}"
associate_public_ip_address = true
root_block_device {
volume_type = "gp2"
volume_size = 8
}
tags {
Name = "terraform_handson_instance_c"
}
user_data = <<EOF
#!/bin/bash
yum install nginx -y
uname -n > /usr/share/nginx/html/index.html
service nginx start
EOF
}
ELB
elb.tf
resource "aws_elb" "terraform_handson_elb" {
name = "terraform-handson-elb"
subnets = [
"${aws_subnet.terraform_handson_public_subnet_a.id}",
"${aws_subnet.terraform_handson_public_subnet_c.id}"
]
security_groups = ["${aws_security_group.terraform_handson_elb_sg.id}"]
listener {
instance_port = 80
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
health_check {
healthy_threshold = 3
unhealthy_threshold = 3
timeout = 10
target = "HTTP:80/"
interval = 30
}
instances = [
"${aws_instance.terraform_handson_instance_a.id}",
"${aws_instance.terraform_handson_instance_c.id}"
]
cross_zone_load_balancing = true
idle_timeout = 60
connection_draining = true
connection_draining_timeout = 300
tags {
Name = "terraform_handson_elb"
}
}
$ terraform plan -destroy
$ terraform destroy
plan
4 AWS git
4 OS
tf
4 credentials
4
4 state
4 terraform
4
4 terraform
AWSをテラフォーミングする会(Terraformハンズオン)

More Related Content

PPTX
Testing Terraform
PPTX
Infrastructure as Code: Introduction to Terraform
PDF
Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)
DOCX
Nginx 0.9.x 安装手册
PDF
Learning Dtrace
PDF
Infrastructure as Code with Terraform
PDF
SDPHP - Percona Toolkit (It's Basically Magic)
PDF
SSH I/O Streaming via Redis-based Persistent Message Queue -Mani Tadayon
Testing Terraform
Infrastructure as Code: Introduction to Terraform
Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)
Nginx 0.9.x 安装手册
Learning Dtrace
Infrastructure as Code with Terraform
SDPHP - Percona Toolkit (It's Basically Magic)
SSH I/O Streaming via Redis-based Persistent Message Queue -Mani Tadayon

What's hot (20)

PDF
Node.js Event Loop & EventEmitter
PDF
Better detection of what modules are used by some Perl 5 code
DOCX
Antivirus Bypass Techniques - 2016
PPT
2016年のPerl (Long version)
PDF
Release with confidence
DOC
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
PDF
Unix executable buffer overflow
PPTX
Fun with exploits old and new
PDF
Przemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy Terraform
PDF
Autotools
PDF
History & Practices for UniRx(EN)
PDF
Refactoring Infrastructure Code
PDF
TDOH x 台科 pwn課程
PDF
Awesome_fuzzing_for _pentester_red-pill_2017
PDF
The need for speed uk fest
PDF
Umbraco - DUUGFest 17 -The need for speed
PDF
Building and Testing Puppet with Docker
PDF
How to deploy node to production
PPTX
One Click Ownage
Node.js Event Loop & EventEmitter
Better detection of what modules are used by some Perl 5 code
Antivirus Bypass Techniques - 2016
2016年のPerl (Long version)
Release with confidence
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
Unix executable buffer overflow
Fun with exploits old and new
Przemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy Terraform
Autotools
History & Practices for UniRx(EN)
Refactoring Infrastructure Code
TDOH x 台科 pwn課程
Awesome_fuzzing_for _pentester_red-pill_2017
The need for speed uk fest
Umbraco - DUUGFest 17 -The need for speed
Building and Testing Puppet with Docker
How to deploy node to production
One Click Ownage
Ad

Viewers also liked (20)

PDF
とりあえずはじめるChatOps
PPTX
みんなのTerraformで AWSをテラフォーミングさせるぜ
PDF
sensuのちょっと進んだ使い方
PDF
アルゴリズム+データ構造勉強会(15)
PDF
アルゴリズム+データ構造勉強会(11)
PDF
アルゴリズム+データ構造勉強会(10)
PDF
アルゴリズム+データ構造勉強会(14)
PDF
Code igniterを初めて使うときにはまった4つのポイント(ノーマル版)
PDF
アルゴリズム+データ構造勉強会(12)
PDF
Study 20131009
PDF
アルゴリズム+データ構造勉強会(13)
PDF
アルゴリズム+データ構造勉強会(5)
PDF
アルゴリズム+データ構造勉強会(6)
PDF
Code igniterを初めて使うときにはまった4つのポイント
PPTX
PostgreSQL使いのエンジニアから見たMySQL
PPTX
Riotjsハンズオン
PPTX
Unity + AndroidでモバイルVRハンズオン
PPTX
バッチ高速化のあゆみ
PPTX
[D3]サーバーレスでサービスを作ってみた話
PPT
PowerShell DSC と連携して監視を効率化してみる
とりあえずはじめるChatOps
みんなのTerraformで AWSをテラフォーミングさせるぜ
sensuのちょっと進んだ使い方
アルゴリズム+データ構造勉強会(15)
アルゴリズム+データ構造勉強会(11)
アルゴリズム+データ構造勉強会(10)
アルゴリズム+データ構造勉強会(14)
Code igniterを初めて使うときにはまった4つのポイント(ノーマル版)
アルゴリズム+データ構造勉強会(12)
Study 20131009
アルゴリズム+データ構造勉強会(13)
アルゴリズム+データ構造勉強会(5)
アルゴリズム+データ構造勉強会(6)
Code igniterを初めて使うときにはまった4つのポイント
PostgreSQL使いのエンジニアから見たMySQL
Riotjsハンズオン
Unity + AndroidでモバイルVRハンズオン
バッチ高速化のあゆみ
[D3]サーバーレスでサービスを作ってみた話
PowerShell DSC と連携して監視を効率化してみる
Ad

Similar to AWSをテラフォーミングする会(Terraformハンズオン) (20)

PDF
A Hands-on Introduction on Terraform Best Concepts and Best Practices
PDF
Terraform in deployment pipeline
PDF
Terraform for GCP resources deployment demo
PDF
Terraform: An Overview & Introduction
PDF
Terraform 0.9 + good practices
PDF
DevOps Enabling Your Team
PDF
Terraform introduction
PDF
Declarative & workflow based infrastructure with Terraform
PPTX
Terraform day02
PDF
CDK Meetup: Rule the World through IaC
PPTX
Final terraform
PPTX
Terraform at Scale
PDF
Terraform in action
PDF
Building infrastructure with Terraform (Google)
PDF
Workshop Infrastructure as Code - Suestra
PDF
AWS DevOps - Terraform, Docker, HashiCorp Vault
PDF
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
PDF
Infrastructure as Code with Terraform
PDF
Terraform Introduction
PDF
A Hands-on Introduction on Terraform Best Concepts and Best Practices
Terraform in deployment pipeline
Terraform for GCP resources deployment demo
Terraform: An Overview & Introduction
Terraform 0.9 + good practices
DevOps Enabling Your Team
Terraform introduction
Declarative & workflow based infrastructure with Terraform
Terraform day02
CDK Meetup: Rule the World through IaC
Final terraform
Terraform at Scale
Terraform in action
Building infrastructure with Terraform (Google)
Workshop Infrastructure as Code - Suestra
AWS DevOps - Terraform, Docker, HashiCorp Vault
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
Infrastructure as Code with Terraform
Terraform Introduction

Recently uploaded (20)

PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
STKI Israel Market Study 2025 version august
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
CloudStack 4.21: First Look Webinar slides
PPTX
Tartificialntelligence_presentation.pptx
PPTX
Chapter 5: Probability Theory and Statistics
DOCX
search engine optimization ppt fir known well about this
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Unlock new opportunities with location data.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Hindi spoken digit analysis for native and non-native speakers
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
NewMind AI Weekly Chronicles – August ’25 Week III
STKI Israel Market Study 2025 version august
1 - Historical Antecedents, Social Consideration.pdf
CloudStack 4.21: First Look Webinar slides
Tartificialntelligence_presentation.pptx
Chapter 5: Probability Theory and Statistics
search engine optimization ppt fir known well about this
Benefits of Physical activity for teenagers.pptx
Developing a website for English-speaking practice to English as a foreign la...
Unlock new opportunities with location data.pdf
Enhancing emotion recognition model for a student engagement use case through...
sustainability-14-14877-v2.pddhzftheheeeee
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Final SEM Unit 1 for mit wpu at pune .pptx
Taming the Chaos: How to Turn Unstructured Data into Decisions
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
Zenith AI: Advanced Artificial Intelligence
Hindi spoken digit analysis for native and non-native speakers

AWSをテラフォーミングする会(Terraformハンズオン)