我目前正在使用 CloudFormation 开发一个 AWS Batch 处理系统,需要分析 CFT 的总成本,包括 EC2 实例和来自 EBS 卷的任何 IOPS。我正在根据实例上的标签和批处理使用的任何资源执行此分析。但是,我的卷没有被标记为与实例标记相同的标记。Batch 有没有办法在创建时自动标记这些卷以进行成本分析?下面是创建计算实例的 CFT 中的 JSON blob。
"ComputeSpot": {
"Type": "AWS::Batch::ComputeEnvironment",
"Properties": {
"Type": "Managed",
"ServiceRole": {
"Ref": "BatchServiceRole"
},
"ComputeResources": {
"MaxvCpus": 500,
"DesiredvCpus": 0,
"MinvCpus": 0,
"BidPercentage" : 50,
"SpotIamFleetRole": { "Ref": "SpotIamFleetRole" },
"SecurityGroupIds": [
{
"Ref": "SecurityGroup"
}
],
"Type": "SPOT",
"Subnets": [
{ "Fn::Join": [",", {"Ref": "Subnets"}]}
],
"ImageId": {
"Ref": "AMI"
},
"InstanceRole": {
"Ref": "IamInstanceProfile"
},
"InstanceTypes": [
"c3","c5","m5"
],
"Ec2KeyPair": {
"Ref": "Ec2KeyPair"
},
"Tags": {
"Project": { "Ref": "ProjectTag" },
"CostRun": { "Ref": "CostRunTag" },
"Name": {"Fn::Join": ["-", [ { "Ref": "AWS::StackName" }, "ComputeSpot" ] ] }
}
},
"State": "ENABLED"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "ff02a948-912b-4906-9a71-21774f459e87"
}
}
}