【发布时间】:2019-10-19 10:07:28
【问题描述】:
使用 AWS CDK 创建 FargateService 时,我收到以下错误:
子网最多可以有 16 个项目。
我有这个代码来创建服务:
var ecsService = new FargateService(this, $"{serviceNameHyphen}-service", new FargateServiceProps
{
TaskDefinition = taskDefinition,
AssignPublicIp = false,
Cluster = infrastructureStack.EcsCluster,
CloudMapOptions = new CloudMapOptions
{
Name = serviceName,
DnsRecordType = DnsRecordType.A,
DnsTtl = Duration.Seconds(60),
FailureThreshold = 2d
},
DesiredCount = 1,
HealthCheckGracePeriod = Duration.Seconds(60),
MaxHealthyPercent = 200,
MinHealthyPercent = 100,
PlatformVersion = FargatePlatformVersion.LATEST,
ServiceName = $"{serviceNameHyphen}-service",
SecurityGroup = albSecurityGroup,
VpcSubnets = new SubnetSelection
{
OnePerAz = true,
SubnetType = SubnetType.PUBLIC,
}
});
可以过滤子网吗?
或者,SubnetSelection 类具有 SubnetGroup 属性 - 我知道某些 AWS 服务允许创建子网组,但我看不到如何创建任意子网组以用于 Fargate 服务。
更新 我现在在 VPC 中只有 15 个子网,但我仍然收到相同的错误消息。
【问题讨论】:
-
您要导入现有的 VPC 吗?
-
是的,导入现有 VPC。目前,我正在努力将 VPC 中的子网数量减少到 16 个以下的限制
标签: aws-cdk