π Case-by-case Teraform Usage Repository
Case | Link | Note |
---|---|---|
S3+CDN μ μ μΉνμ΄μ§ λ°°ν¬ | s3-cloudfront-deploy | -------- |
μ€ν μΈμ€ν΄μ€ νΈμΆ(μΌνμ±) | spot-instance | -------- |
MySQL DB μμ± | rds-mysql-database | -------- |
Lambda+API Gateway(REST API) μμ± | rest-api-lambda-api-gateway | -------- |
νμΌ μ λ‘λμ© S3 λ²ν· μμ± | file-upload-s3 | -------- |
# Unix/Linux
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
export AWS_REGION=""
# Windows
SET AWS_ACCESS_KEY_ID=
SET AWS_SECRET_ACCESS_KEY=
SET AWS_REGION=
terraform {
backend "s3" {
bucket = "<s3-bucket-name>" # s3 λ²ν·λͺ
key = "<service-key>/terraform.tfstate" # tfstate μ μ₯ κ²½λ‘
region = "ap-northeast-2"
dynamodb_table = "terraform-tfstate-lock" # dynamodb table μ΄λ¦
}
}
provider "aws" {}
provider "aws" {
alias = "virginia"
region = "us-east-1"
}
terraform init
terraform plan
terraform apply
terraform destroy