aws_cdk.aws_ecs_patterns.ApplicationLoadBalancedFargateService无法设置Fargate服务的容量提供程序策略。
创始人
2024-09-28 07:00:30
0

在AWS CDK中,如果想要使用ApplicationLoadBalancedFargateService来创建Fargate服务,并在服务中设置容量提供程序策略,需要使用自定义构造函数来实现。

具体实现方法如下所示:

from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_ecs_patterns as ecs_patterns
from aws_cdk import core

class MyFargateService(ecs_patterns.ApplicationLoadBalancedFargateService):
    def __init__(self, scope: core.Construct, id: str, *,
                 task_definition: ecs_patterns.FargateTaskDefinition,
                 desired_count: int = 1,
                 listener_port: int = 80,
                 vpc: ec2.IVpc,
                 capacity_provider_strategies=None,
                 task_subnets=None,
                 health_check_grace_period=None,
                 platform_version=None,
                 cpu=None,
                 memory_limit_mib=None,
                 memory_reservation_mib=None,
                 deployment_controller_type=None,
                 deployment_controller=None,
                 cloud_map_options=None,
                 assign_public_ip=None,
                 service_name=None,
                 target_group_name=None,
                 protocol=None,
                 domain_name=None,
                 domain_zone=None,
                 redirect_http=None) -> None:

        super().__init__(scope, id, task_definition=task_definition, desired_count=desired_count,
                         listener_port=listener_port, vpc=vpc, task_subnets=task_subnets,
                         health_check_grace_period=health_check_grace_period, platform_version=platform_version,
                         cpu=cpu, memory_limit_mib=memory_limit_mib,
                         memory_reservation_mib=memory_reservation_mib,
                         deployment_controller_type=deployment_controller_type,
                         deployment_controller=deployment_controller,
                         cloud_map_options=cloud_map_options, assign_public_ip=assign_public_ip,
                         service_name=service_name, target_group_name=target_group_name, protocol=protocol,
                         domain_name=domain_name, domain_zone=domain_zone, redirect_http=redirect_http)

        self.service.enable_scaling()
        if capacity_provider_strategies is not None:
            self.service.add_capacity_provider_strategy(*capacity_provider_strategies)

相关内容

热门资讯

透视教你!pokemomo辅助... 透视教你!pokemomo辅助软件(透视)hhpkoer辅助器,教程项目(竟然有挂)-哔哩哔哩pok...
wpk德州局怎么透视!wepo... wpk德州局怎么透视!wepoker国外版透视(透视)教程-切实必备真的有挂wpk德州局怎么透视辅助...
透视有挂!hhpoker视频巡... 透视有挂!hhpoker视频巡查真的假的(透视)hhpoker免费辅助器,教程攻略(有挂教学)-哔哩...
hhpoker开挂教程!wep... hhpoker开挂教程!wepoker透视苹果系统(透视)技巧-都是解谜是有挂1)wepoker透视...
透视解迷!hhpoker德州真... 透视解迷!hhpoker德州真的假的(透视)wepoker祈福有用吗,教程讲义(有挂透明挂)-哔哩哔...
德州局透视!菠萝辅助器免费版的... 德州局透视!菠萝辅助器免费版的特点(透视)app-好像了解真的有挂1、下载好菠萝辅助器免费版的特点透...
pokerrrr2辅助!wep... pokerrrr2辅助!wepoker有没有辅助(透视)插件-切实解谜真的有挂wepoker有没有辅...
透视曝光!pokemmo脚本辅... 透视曝光!pokemmo脚本辅助(透视)wepoker怎么设置透视,教程演示(发现有挂)-哔哩哔哩w...
wepoker怎么拿到好牌!德... wepoker怎么拿到好牌!德州之星扫描器(透视)软件-果然专业有挂1)wepoker怎么拿到好牌免...
透视必备!fishpoker透... 您好,wejoker辅助机器人这款游戏可以开挂的,确实是有挂的,需要了解加去威信【485275054...