1 # 디렉터리 생성 mkdir -p global/s3 && cd global/s3 2 # S3 버킷 이름은 고유해야되어서 자신의 NICKNAME NICKNAME=masterseo 3 # 코드 파일 생성 cat < main.tf provider "aws" { region = "ap-northeast-2" } resource "aws_s3_bucket" "mys3bucket" { bucket = "$NICKNAME-t101study-tfstate-week3-files" } # Enable versioning so you can see the full revision history of your state files resource "aws_s3_bucket_versioning" "mys3bucket_versioning" { bucket = aws_s3_bucket.mys3bucket.id versioning_configuration { status = "Enabled" } } resource "aws_dynamodb_table" "mydynamodbtable" { name = "terraform-locks-week3-files" billing_mode = "PAY_PER_REQUEST" hash_key = "LockID" attribute { name = "LockID" type = "S" } } EOT 4 cat < outputs.tf output "s3_bucket_arn" { value = aws_s3_bucket.mys3bucket.arn description = "The ARN of the S3 bucket" } output "dynamodb_table_name" { value = aws_dynamodb_table.mydynamodbtable.name description = "The name of the DynamoDB table" } EOT 5 # 배포 terraform init && terraform plan && terraform apply -auto-approve 5 # 배포 확인 terraform state list [root@ip-172-31-61-209 s3]# terraform state list aws_dynamodb_table.mydynamodbtable aws_s3_bucket.mys3bucket aws_s3_bucket_versioning.mys3bucket_versioning 6 aws s3 ls masterseo-t101study-tfstate-week3-files 7 aws dynamodb list-tables --output text TABLENAMES terraform-locks-week3-files 8 # 기존 작업 디렉터리로 이동 cd 감사합니다.