AWS CloudFormation
User Guide (API Version 2010-05-15)
AWS 服务或AWS文档中描述的功能,可能因地区/位置而异。请点击 Amazon AWS 入门,可查看中国地区的具体差异

AWS::EC2::SpotFleet

AWS::EC2::SpotFleet 资源创建对竞价型实例集合的请求。竞价型队列尝试启动此数量的竞价型实例,以满足您指定的目标容量。有关更多信息,请参阅 Amazon EC2 用户指南(适用于 Linux 实例) 中的竞价型实例

语法

要在 AWS CloudFormation 模板中声明此实体,请使用以下语法:

JSON

{ "Type" : "AWS::EC2::SpotFleet", "Properties" : { "SpotFleetRequestConfigData" : SpotFleetRequestConfigData } }

YAML

Type: "AWS::EC2::SpotFleet" Properties: SpotFleetRequestConfigData: SpotFleetRequestConfigData

属性

SpotFleetRequestConfigData

竞价型队列请求的配置。

Required: Yes

类型Amazon EC2 SpotFleet SpotFleetRequestConfigData

更新要求时而中断

返回值

Ref

当该资源的逻辑 ID 提供给 Ref内部函数时,Ref 将返回资源名称。

有关使用 Ref 功能的更多信息,请参阅参考

示例

下面的示例创建带有两个启动说明的竞价型队列。由于权重容量相同,Amazon EC2 会为每个说明启动相同数量的实例。有关更多信息,请参阅 Amazon EC2 用户指南(适用于 Linux 实例) 中的竞价型队列的工作方式

JSON

"SpotFleet": { "Type": "AWS::EC2::SpotFleet", "Properties": { "SpotFleetRequestConfigData": { "IamFleetRole": { "Fn::GetAtt": [ "IAMFleetRole", "Arn"] }, "SpotPrice": "1000", "TargetCapacity": { "Ref": "TargetCapacity" }, "LaunchSpecifications": [ { "EbsOptimized": "false", "InstanceType": { "Ref": "InstanceType" }, "ImageId": { "Fn::FindInMap": [ "AWSRegionArch2AMI", { "Ref": "AWS::Region" }, { "Fn::FindInMap": [ "AWSInstanceType2Arch", { "Ref": "InstanceType" }, "Arch" ] } ]}, "SubnetId": { "Ref": "Subnet1" }, "WeightedCapacity": "8" }, { "EbsOptimized": "true", "InstanceType": { "Ref": "InstanceType" }, "ImageId": { "Fn::FindInMap": [ "AWSRegionArch2AMI", { "Ref": "AWS::Region" }, { "Fn::FindInMap": [ "AWSInstanceType2Arch", { "Ref": "InstanceType" }, "Arch" ] } ]}, "Monitoring": { "Enabled": "true" }, "SecurityGroups": [ { "GroupId": { "Fn::GetAtt": [ "SG0", "GroupId" ] } } ], "SubnetId": { "Ref": "Subnet0" }, "IamInstanceProfile": { "Arn": { "Fn::GetAtt": [ "RootInstanceProfile", "Arn" ] } }, "WeightedCapacity": "8" } ] } } }

YAML

SpotFleet: Type: AWS::EC2::SpotFleet Properties: SpotFleetRequestConfigData: IamFleetRole: !GetAtt [IAMFleetRole, Arn] SpotPrice: '1000' TargetCapacity: Ref: TargetCapacity LaunchSpecifications: - EbsOptimized: 'false' InstanceType: Ref: InstanceType ImageId: Fn::FindInMap: - AWSRegionArch2AMI - Ref: AWS::Region - Fn::FindInMap: - AWSInstanceType2Arch - Ref: InstanceType - Arch SubnetId: Ref: Subnet1 WeightedCapacity: '8' - EbsOptimized: 'true' InstanceType: Ref: InstanceType ImageId: Fn::FindInMap: - AWSRegionArch2AMI - Ref: AWS::Region - Fn::FindInMap: - AWSInstanceType2Arch - Ref: InstanceType - Arch Monitoring: Enabled: 'true' SecurityGroups: - GroupId: Fn::GetAtt: - SG0 - GroupId SubnetId: Ref: Subnet0 IamInstanceProfile: Arn: Fn::GetAtt: - RootInstanceProfile - Arn WeightedCapacity: '8'

相关资源

要使用 Application Auto Scaling 扩展 Amazon ECS 服务以响应 CloudWatch 警报,请使用 AWS::ApplicationAutoScaling::ScalableTargetAWS::ApplicationAutoScaling::ScalingPolicy 资源。