ecs_composex.ecs.service_networking package

Submodules

ecs_composex.ecs.service_networking.helpers module

ecs_composex.ecs.service_networking.helpers. set_family_hostname ( family ) [source]

Sets the hostname to use for the Family in Cloudmap. If it has been set on more than one service container, it uses the first one.

ecs_composex.ecs.service_networking.helpers. update_family_subnets ( family , settings ) [source]

Update the stack parameters of the family stack AppSubnets Parameter value to the one matching with networks.x-vpc and networks.[]

Return type :

None

ecs_composex.ecs.service_networking.ingress_helpers module

ecs_composex.ecs.service_networking.ingress_helpers. add_service_to_service_ingress_rules ( dst_family , target_family_services , families_sg_stack ) [source]

For each identified service that wants to access the dst_family services For each port of the dst_family Create an SG Ingress rule that allows service-to-service communication

ecs_composex.ecs.service_networking.ingress_helpers. find_namespace ( family , namespace_id , settings ) [source]

Finds the x-cloudmap: namespace and returns the identifier to use for it

ecs_composex.ecs.service_networking.ingress_helpers. find_port_mapping ( port_name , family ) [source]

Goes over all the services/containers of the task definition and over each PortMapping of the container. If the port name matches, we have found the PortMapping

Return type :

typing.Optional [ troposphere.ecs.PortMapping ]

ecs_composex.ecs.service_networking.ingress_helpers. handle_aws_sources ( existing_sources , new_sources ) [source]

Function to handle merge of aws sources between two services for one family :type existing_sources: list :param existing_sources: :type new_sources: list :param new_sources: :rtype: None :return:

ecs_composex.ecs.service_networking.ingress_helpers. handle_dict_cloudmap_config ( family , family_mappings , cloudmap_config , ports ) [source]

Handles cloudmap config settings when set as a mapping/dict

Parameters :
Return type :

None

ecs_composex.ecs.service_networking.ingress_helpers. handle_ext_sources ( existing_sources , new_sources ) [source]

Adds up external sources if they are not defined yet

Parameters :
  • existing_sources ( list ) –

  • new_sources ( list ) –

Return type :

None

ecs_composex.ecs.service_networking.ingress_helpers. handle_ingress_rules ( source_config , ingress_config ) [source]
Return type :

None

ecs_composex.ecs.service_networking.ingress_helpers. handle_services ( existing_sources , new_sources ) [source]

Function to merge source services definitions

Parameters :
  • existing_sources ( list ) –

  • new_sources ( list ) –

Return type :

None

Returns :

ecs_composex.ecs.service_networking.ingress_helpers. handle_str_cloudmap_config ( family , family_mappings , cloudmap_config , ports ) [source]

Handle cloudmap config when config is set as str

Parameters :
Return type :

None

ecs_composex.ecs.service_networking.ingress_helpers. import_set_ecs_connect_settings ( family , settings ) [source]
Return type :

typing.Optional [ troposphere.ecs.ServiceConnectConfiguration ]

ecs_composex.ecs.service_networking.ingress_helpers. merge_cloudmap_settings ( family , ports ) [source]

Function to merge the x_cloudmap from the service

Parameters :
Returns :

The cloudmap config for the given family

Return type :

dict

ecs_composex.ecs.service_networking.ingress_helpers. merge_family_network_setting ( family , key , definition , network , network_config ) [source]

Merges a network setting (key) and its definition (definition) with new definition (network) into network_config

If the key is x-cloudmap, and is unset, set to value. If another service of the family comes in, comes second.

Parameters :
Return type :

None

Returns :

ecs_composex.ecs.service_networking.ingress_helpers. merge_family_services_networking ( family ) [source]

Merge the different services network configuration definitions

Parameters :

family ( ecs_composex.ecs.ecs_family.ComposeFamily ) –

Returns :

The family network definition

Return type :

dict

ecs_composex.ecs.service_networking.ingress_helpers. process_ecs_connect_settings ( family , service , settings ) [source]

Determines whether to create the ECS Service connect from the Properties or MacroParameters

Return type :

troposphere.ecs.ServiceConnectConfiguration | troposphere.Ref

ecs_composex.ecs.service_networking.ingress_helpers. set_compose_services_ingress ( dst_family , families_sg_stack , settings ) [source]

Function to crate SG Ingress between two families / services. Presently, the ingress rules are set after all services have been created

Return type :

None

ecs_composex.ecs.service_networking.ingress_helpers. set_ecs_connect_from_macro ( family , service , macro , settings ) [source]

Based on the MacroParameters, creates the ServiceConnectConfiguration object. Configuration is in the macro parameter

Return type :

troposphere.ecs.ServiceConnectConfiguration

Module contents

Module to help with defining the network settings for the ECS Service based on the family services definitions.

class ecs_composex.ecs.service_networking. ServiceNetworking ( family , families_sg_stack ) [source]

Bases: object

Class to group the configuration for Service network settings

Variables :
  • ports ( list [ dict ] ) – List of the ports used by te service

  • networks ( dict ) – Mapping of the networks to use for service

add_lb_ingress ( lb_name , lb_sg_ref ) [source]

Method to add ingress rules from other AWS Sources

Parameters :
  • lb_name ( str ) –

  • lb_sg_ref

Return type :

None

Returns :

add_self_ingress ( ) [source]

Method to allow communications internally to the group on set ports

Return type :

None

property ecs_network_config
property eip_assign
property ingress_from_self : bool
merge_networks ( ) [source]

Method to merge network

merge_services_ports ( ) [source]

Function to merge two sections of ports

property network_mode

The network mode used for the Task/Service. valid are host/bridge/awsvpc. Defaults to awsvpc. Only override is to bridge/host based on the Launch Type

property sd_service
property security_groups : list
self_key = 'Myself'
set_ecs_connect ( settings ) [source]
property subnets
property subnets_output