0你好,我想启动EC2车队时只使用随需应变的实例,并且我希望它们能够分布在可用性区域。不幸的是,我无法找到这样的方法,所有的实例都是在一个AZ中启动的。
这并不是spot实例的问题,因为它们在所有AZ中生成。
我试图尝试不同的分配策略和优先次序,但没有任何帮助。我试图在AWS中这样做,同时使用CfnEC2Fleet 链接和CfnSpotFleet 链接。贝娄是我的密码。
是否有办法实现这一点,还是我需要使用其他东西?我知道我可以实现同样的结果,使用自动缩放组,我只是想知道我是否可以使用车队获得这一功能。
谢谢。
const spotFleet = new CfnSpotFleet(stack, 'EC2-Fleet', {
spotFleetRequestConfigData: {
allocationStrategy: 'lowestPrice',
targetCapacity: 8,
iamFleetRole: fleetRole.roleArn,
spotMaintenanceStrategies: {
capacityRebalance: {
replacementStrategy: 'launch-before-terminate',
terminationDelay: 120,
}
},
onDemandTargetCapacity: 4,
instancePoolsToUseCount: stack.availabilityZones.length,
launchTemplateConfigs: [{
launchTemplateSpecification: {
launchTemplateId: launchTemplate.launchTemplateId,
version: launchTemplate.latestVersionNumber,
},
overrides: privateSubnets.map(subnet => ({
availabilityZone: subnet.subnetAvailabilityZone,
subnetId: subnet.subnetId,
})),
}],
}
});
const ec2Fleet = new CfnEC2Fleet(stack, 'EC2-EcFleet', {
targetCapacitySpecification: {
totalTargetCapacity: 6,
onDemandTargetCapacity: 6,
defaultTargetCapacityType: 'on-demand',
},
replaceUnhealthyInstances: true,
onDemandOptions: {
allocationStrategy: 'prioritized',
},
launchTemplateConfigs: [{
launchTemplateSpecification: {
launchTemplateId: launchTemplate.launchTemplateId,
version: launchTemplate.latestVersionNumber,
},
overrides: privateSubnets.map(subnet => ({
availabilityZone: subnet.subnetAvailabilityZone,
subnetId: subnet.subnetId,
})),
}]
});发布于 2022-06-17 09:18:43
您可以通过创建跨多个AZ的布局组和使用这个布局组的启动模板来实现这一点。我真的不知道这是否是你想要的解决方案。但我想说的是ASG是什么应该使用,如果你没有需要某种类型的安置,你得到的安置小组。我敢肯定这件事不可能以任何其他方式来完成。
https://stackoverflow.com/questions/72656446
复制相似问题