大地形态aws_spot_fleet_request iam_instance_profile



我从这里阅读了Terraform现货舰队示例用法。

"iam_instance_profile_arn"的意义是什么,它在示例 1 中有什么作用?

在某些情况下,我收到错误"launch_specification.0:无效或未知的键:标签",而在其他情况下则没有,所以我认为这可能与iam_profile有关。

iam_instance_profile_arn  = "${aws_iam_instance_profile.example.arn}"

示例 1:

# Request a Spot fleet
resource "aws_spot_fleet_request" "cheap_compute" {
iam_fleet_role      = "arn:aws:iam::12345678:role/spot-fleet"
spot_price          = "0.03"
allocation_strategy = "diversified"
target_capacity     = 6
valid_until         = "2019-11-04T20:44:20Z"
launch_specification {
instance_type             = "m4.10xlarge"
ami                       = "ami-1234"
spot_price                = "2.793"
placement_tenancy         = "dedicated"
iam_instance_profile_arn  = "${aws_iam_instance_profile.example.arn}"
}
launch_specification {
instance_type             = "m4.4xlarge"
ami                       = "ami-5678"
key_name                  = "my-key"
spot_price                = "1.117"
iam_instance_profile_arn  = "${aws_iam_instance_profile.example.arn}"
availability_zone         = "us-west-1a"
subnet_id                 = "subnet-1234"
weighted_capacity         = 35
root_block_device {
volume_size = "300"
volume_type = "gp2"
}
tags {
Name = "spot-fleet-example"
}
}
}

示例 2:

resource "aws_spot_fleet_request" "foo" {
iam_fleet_role  = "arn:aws:iam::12345678:role/spot-fleet"
spot_price      = "0.005"
target_capacity = 2
valid_until     = "2019-11-04T20:44:20Z"
launch_specification {
instance_type     = "m1.small"
ami               = "ami-d06a90b0"
key_name          = "my-key"
availability_zone = "us-west-2a"
}
launch_specification {
instance_type     = "m3.large"
ami               = "ami-d06a90b0"
key_name          = "my-key"
availability_zone = "us-west-2a"
}
depends_on = ["aws_iam_policy_attachment.test-attach"]
}

实例配置文件与错误无关。错误是这样说的:

tags {
Name = "spot-fleet-example"
}

无法识别第一个示例的一部分。您可以在此处阅读有关实例配置文件的信息:

实例配置文件是 IAM 角色的容器,可用于 在实例启动时将角色信息传递给 EC2 实例。

相关内容

  • 没有找到相关文章

最新更新