![](/img/trans.png)
[英]AWS CDK: Cognito with ApplicationLoadBalancedFargateService
[英]How do I enable deletion protection for load balancer using ApplicationLoadBalancedFargateService cdk construct
我使用 ApplicationLoadBalancedFargateService CDK 構造創建了一個在 ECS 集群上運行的 Fargate 服務,該集群由一個應用程序負載均衡器作為前端。
cluster,
memoryLimitMiB: 1024,
desiredCount: 1,
cpu: 512,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
},
});
沒有啟用刪除保護的道具。 誰能從他的經歷中看出?
如果任何高級構造沒有參數,CDK 提供 Escape Hatches 功能以使用 Clouformation Props。
// Create a load-balanced Fargate service and make it public
var loadBalancedService = new ecs_patterns.ApplicationLoadBalancedFargateService(this, `${ENV_NAME}-pgadmin4`, {
cluster: cluster, // Required
cpu: 512, // Default is 256
desiredCount: 1, // Default is 1
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('image'),
environment: {}
},
memoryLimitMiB: 1024, // Default is 512
assignPublicIp: true
});
// Get the CloudFormation resource
const cfnLB = loadBalancedService.loadBalancer.node.defaultChild as elbv2.CfnLoadBalancer;
cfnLB.loadBalancerAttributes = [{
key: 'deletion_protection.enabled',
value: 'true',
},
];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.