<2> Local 실습 해보자. 1 다운로드 mkdir local cd local git clone https://github.com/hashicorp/learn-terraform-modules-create.git cd learn-terraform-modules-create tree 2 서울 리전으로 변경 버킷 이름 변경 # sed -i -e 's/"us-west-2a", "us-west-2b", "us-west-2c"/"ap-northeast-2a", "ap-northeast-2c"/g' variables.tf sed -i -e 's/us-west-2/ap-northeast-2/g' main.tf sed -i -e 's/ami-0c5204531f799e0c6/ami-09cf633fe86e51bf0/g' main.tf # 버킷 이름 변경 NICKNAME=masterseo sed -i -e "s/robin-test-dec-17-2019/$NICKNAME-t101-s3/g" main.tf 3 terraform init tree .terraform # (옵션) NATGW 제거 export TF_VAR_vpc_enable_nat_gateway=false # macOS/Linux terraform plan && terraform apply -auto-approve terraform state list 4 aws s3 cp modules/aws-s3-static-website-bucket/www/ s3://$(terraform output -raw website_bucket_name)/ --recursive # curl 혹은 웹 브라우저에서 S3 버킷 접속 curl -s http://$NICKNAME-t101-s3.s3-website.ap-northeast-2.amazonaws.com/ 5 브라우저로 확인 http://masterseo-t101-s3.s3-website.ap-northeast-2.amazonaws.com/ 6 삭제 aws s3 rm s3://$(terraform output -raw website_bucket_name)/ --recursive terraform destroy -auto-approve