Slide 44
Slide 44 text
Infracost
44
● 想定使用量を指定して試算
$ cat vpc.tf
provider "aws" {
region = "ap-northeast-1"
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
name = "my-vpc"
cidr = "10.0.0.0/16"
azs = ["ap-northeast-1a", "ap-northeast-1c", "ap-northeast-1d"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
enable_nat_gateway = true
}
$ cat infracost-usage.yml
version: 0.1
resource_type_default_usage:
aws_nat_gateway:
monthly_data_processed_gb: 1000
$ infracost breakdown --path . --usage-file infracost-usage.yml
Evaluating Terraform directory at .
✔ Downloading Terraform modules
✔ Evaluating Terraform directory
✔ Retrieving cloud prices to calculate costs
Project: .
Name Monthly Qty Unit Monthly Cost
module.vpc.aws_nat_gateway.this[0]
├─ NAT gateway 730 hours $45.26
└─ Data processed 1,000 GB $62.00
module.vpc.aws_nat_gateway.this[1]
├─ NAT gateway 730 hours $45.26
└─ Data processed 1,000 GB $62.00
module.vpc.aws_nat_gateway.this[2]
├─ NAT gateway 730 hours $45.26
└─ Data processed 1,000 GB $62.00
OVERALL TOTAL $321.78