ecs_composex.elbv2 package

Submodules

ecs_composex.elbv2.elbv2_ecs module

ecs_composex.elbv2.elbv2_ecs. define_service_target_group ( resource , service , family , resources_root_stack , target_definition ) [source]

Function to create the elbv2 target group :param ecs_composex.elbv2.elbv2_stack.Elbv2 resource: :param ecs_composex.common.compose_services.ComposeService service: :param ecs_composex.common.compose_services.ComposeFamily family: :param ecs_composex.common.stacks.ComposeXStack resources_root_stack: :param dict target_definition: :return: the target group :rtype: troposphere.elasticloadbalancingv2.TargetGroup

ecs_composex.elbv2.elbv2_ecs. define_service_target_group_definition ( resource , service , family , target_def , resources_root_stack ) [source]

Function to create the new service TGT Group

Parameters
Returns

ecs_composex.elbv2.elbv2_ecs. elbv2_to_ecs ( resources , services_stack , res_root_stack , settings ) [source]

Entrypoint function to map services, targets, listeners and ACM together

Parameters
Returns

ecs_composex.elbv2.elbv2_ecs. fix_nlb_settings ( props ) [source]
ecs_composex.elbv2.elbv2_ecs. handle_path_settings ( props , path_raw ) [source]

Function to set the path and codes properties

Parameters
  • props ( dict ) –

  • path_raw ( str ) –

Returns

ecs_composex.elbv2.elbv2_ecs. handle_ping_settings ( props , ping_raw ) [source]

Function to setup the “ping” settings

Parameters
  • props ( dict ) –

  • ping_raw ( str ) –

Returns

ecs_composex.elbv2.elbv2_ecs. handle_services_association ( resource , res_root_stack , settings ) [source]

Function to handle association of listeners and targets to the LB

Parameters
Returns

ecs_composex.elbv2.elbv2_ecs. handle_sg_lb_ingress_to_service ( resource , family , resources_stack ) [source]

Function to add ingress from the LB to Target if using ALB :param resource: :param family: :param resources_stack: :return:

ecs_composex.elbv2.elbv2_ecs. set_healthcheck_definition ( props , target_definition ) [source]
Parameters
  • props ( dict ) –

  • target_definition ( dict ) –

Returns

ecs_composex.elbv2.elbv2_ecs. validate_attributes ( target_definition ) [source]

Function to validate services attributes :param dict target_definition: :return:

ecs_composex.elbv2.elbv2_ecs. validate_props_and_service_definition ( props , service ) [source]

Function to validate that the defined settings are valid according to the service definition. :param props: :param ecs_composex.common.compose_services.ComposeService service: :return:

ecs_composex.elbv2.elbv2_ecs. validate_tcp_health_counts ( props ) [source]

ecs_composex.elbv2.elbv2_params module

ecs_composex.elbv2.elbv2_stack module

Module to handle elbv2.

class ecs_composex.elbv2.elbv2_stack. ComposeListener ( lb , definition ) [source]

Bases: troposphere.elasticloadbalancingv2.Listener

attributes = ['Condition', 'CreationPolicy', 'DeletionPolicy', 'DependsOn', 'Metadata', 'UpdatePolicy', 'UpdateReplacePolicy']
define_default_actions ( template ) [source]

If DefaultTarget is set it will set it if not a service, otherwise at the service level. If not defined, and there is more than one service, it will fail. If not defined and there is only one service defined, it will skip

handle_certificates ( settings , listener_stack ) [source]

Method to handle certificates

Parameters
Returns

map_services ( lb ) [source]

Map Services defined in LB definition to Targets

Parameters

lb ( ecs_composex.elbv2.elbv2_stack.Elbv2 ) –

targets_keys = 'Targets'
validate_mapping ( lb , t_targets , l_targets ) [source]

Method to validate the services mapping

Parameters
Returns

class ecs_composex.elbv2.elbv2_stack. Elbv2 ( name , definition , module_name , settings ) [source]

Bases: ecs_composex.common.compose_resources.XResource

Class to handle ELBv2 creation and mapping to ECS Services

associate_to_template ( template ) [source]

Method to associate all resources to the template

Parameters

template ( troposphere.Template ) –

Returns

define_override_subnets ( subnets , settings ) [source]

Method to define the subnets overrides to use for the LB

Parameters
Returns

the subnet name to use

Return type

str

init_outputs ( ) [source]
is_alb ( ) [source]
is_nlb ( ) [source]
parse_attributes_settings ( ) [source]

Method to parse pre-defined settings for shortcuts

Returns

the lb attributes mappings

Return type

list

set_eips ( settings ) [source]
Parameters

settings ( ecs_composex.common.settings.ComposeXSettings ) –

Returns

set_lb_attributes ( ) [source]

Method to define the LB attributes

Returns

List of LB Attributes

Return type

list

set_lb_definition ( settings ) [source]

Function to parse the LB settings and properties and build the LB object

Parameters
set_listeners ( template ) [source]

Method to define the listeners :return:

set_services_targets ( settings ) [source]

Method to map services and families targets of the services defined. TargetStructure: (family, family_wide, services[], access)

Parameters

settings ( ecs_composex.common.settings.ComposeXSettings ) –

Returns

set_subnet_mappings ( settings ) [source]
set_subnets ( settings ) [source]

Method to define which subnets to use for the :param ecs_composex.common.settings.ComposeXSettings settings: :return:

sort_alb_ingress ( settings , stack_template ) [source]

Method to handle Ingress to ALB

sort_props ( ) [source]
sort_sg ( ) [source]
subnets_param = <ecs_composex.common.cfn_params.Parameter object>
validate_services ( ) [source]
class ecs_composex.elbv2.elbv2_stack. XStack ( title , settings , ** kwargs ) [source]

Bases: ecs_composex.common.stacks.ComposeXStack

Class to handle ELBv2 resources

ecs_composex.elbv2.elbv2_stack. add_acm_certs_arn ( listener , src_value , settings , listener_stack ) [source]

Function to add Certificate to Listener with input from manual ARN entry :param listener: :param str src_value: :param settings: :param listener_stack: :return:

ecs_composex.elbv2.elbv2_stack. add_extra_certificate ( listener , cert_arn ) [source]

Function to add Certificates to listener

Parameters
  • listener ( troposphere.elasticloadbalancingv2.Listener ) –

  • cert_arn

Returns

ecs_composex.elbv2.elbv2_stack. add_listener_certificate_via_arn ( listener , certificates_arn ) [source]
Parameters
Returns

ecs_composex.elbv2.elbv2_stack. define_actions ( listener , target_def ) [source]

Function to identify the Target definition and create the resulting rule appropriately.

Parameters
Returns

The action to add or action list for default target

ecs_composex.elbv2.elbv2_stack. define_listener_rules_actions ( listener , left_services ) [source]

Function to identify the Target definition and create the resulting rule appropriately.

Parameters
  • service_def ( dict ) –

  • listener

  • left_services ( list ) –

Returns

The action to add or action list for default target

ecs_composex.elbv2.elbv2_stack. define_target_conditions ( definition ) [source]

Function to create the conditions for forward to target :param definition: :return: list of conditions :rtype: list

ecs_composex.elbv2.elbv2_stack. handle_cross_zone ( value ) [source]
ecs_composex.elbv2.elbv2_stack. handle_default_actions ( listener ) [source]
ecs_composex.elbv2.elbv2_stack. handle_desync_mitigation_mode ( value ) [source]
ecs_composex.elbv2.elbv2_stack. handle_drop_invalid_headers ( value ) [source]
ecs_composex.elbv2.elbv2_stack. handle_http2 ( value ) [source]
ecs_composex.elbv2.elbv2_stack. handle_non_default_services ( listener , services_def ) [source]

Function to handle define the listener rule and identify :param listener: :param services_def: :return:

ecs_composex.elbv2.elbv2_stack. handle_predefined_redirects ( listener , action_name ) [source]

Function to handle predefined redirects :return:

ecs_composex.elbv2.elbv2_stack. handle_string_condition_format ( access_string ) [source]

Function to parse and understand what type of condition that is. Supported : * path based * domain name

Parameters

access_string

Returns

ecs_composex.elbv2.elbv2_stack. handle_timeout_seconds ( timeout_seconds ) [source]
ecs_composex.elbv2.elbv2_stack. http_to_https_default ( default_of_all = False ) [source]
ecs_composex.elbv2.elbv2_stack. import_new_acm_certs ( listener , src_name , settings , listener_stack ) [source]

Function to Import an ACM Certificate defined in x-acm

Parameters
  • listener

  • src_name

  • settings

  • listener_stack

Returns

ecs_composex.elbv2.elbv2_stack. init_elbv2_template ( ) [source]

Function to create a new root ELBv2 stack :return:

ecs_composex.elbv2.elbv2_stack. map_service_target ( lb , name , l_service_def ) [source]

Function to iterate over targets to map the service and its defined TargetGroup ARN

Parameters
Returns

ecs_composex.elbv2.elbv2_stack. rectify_listener_protocol ( listener ) [source]

Function to rectify the listener type when adding cert

Parameters

listener ( troposphere.elasticloadbalancingv2.Listener ) –

Raises

ValueError if trying to set TLS for UDP

ecs_composex.elbv2.elbv2_stack. tea_pot ( default_of_all = False ) [source]
ecs_composex.elbv2.elbv2_stack. validate_listeners_duplicates ( name , ports ) [source]
ecs_composex.elbv2.elbv2_stack. validate_new_or_lookup_cert_matches ( src_name , new_acm_certs , lookup_acm_certs ) [source]
ecs_composex.elbv2.elbv2_stack. validate_service_def ( service_def ) [source]

Module contents

Package for x-elbv2