728x90
## 키페어 생성
## 테라폼 양식 확인
provider "aws" {
access_key = "ACCESS_KEY_HERE"
secret_key = "SECRET_KEY_HERE"
region = "us-east-1"
}
resource "aws_instance" "example" {
ami = "ami-066663db63b3aa675"
instance_type = "t2.micro"
key_name = "terraform-key"
security_groups = ["${aws_security_group.allow_rdp.name}"]
}
resource "aws_security_group" "allow_rdp" {
name = "allow_rdp"
description = "Allow rdp traffic"
ingress {
from_port = 3389 # By default, the windows server listens on TCP port 3389 for RDP
to_port = 3389
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
## ec2.tf 생성
## terraform init (테라폼 초기화)
## terraform apply
## 윈도우 EC2 생성
## terraform destory
https://github.com/ravsau/aws-labs/tree/master/terraform-aws
728x90
'[Terraform]' 카테고리의 다른 글
Terraform: AWS에서 EC2 프로비저닝 (0) | 2023.01.06 |
---|