我在两个可用区启动了两个 EC2 实例,我需要使用 Terraform 在两个实例中安装 EFS。
resource "aws_efs_file_system" "magento-efs" {
creation_token = "efs-demo"
performance_mode = "generalPurpose"
throughput_mode = "bursting"
encrypted = "true"
tags = {
Name = "Magento-EFS"
}
}
resource "aws_efs_mount_target" "efs-mount" {
file_system_id = "${aws_efs_file_system.magento-efs.id}"
subnet_id = "${aws_subnet.public_subnet.0.id}"
security_groups = ["${aws_security_group.efs-sg.id}"]
}
使用上面的代码,我可以在 us-east-1a 中创建 EFS。我需要在 us-east-1a 和 us-east-1b 中都提供它。