ecs_composex.ecs.service_networking package ¶
Submodules ¶
ecs_composex.ecs.service_networking.helpers module ¶
- ecs_composex.ecs.service_networking.helpers. add_security_group ( family ) [source] ¶
-
Creates a new EC2 SecurityGroup and assigns to ecs_service.network_settings Adds the security group to the family template resources.
- Parameters :
-
family ( ecs_composex.ecs.ecs_family.ComposeFamily ) –
- Return type :
-
None
- ecs_composex.ecs.service_networking.helpers. update_family_subnets ( family , settings ) [source] ¶
-
Method to update the stack parameters
- Parameters :
-
-
family ( ecs_composex.ecs.ecs_family.ComposeFamily ) –
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
- Return type :
-
None
ecs_composex.ecs.service_networking.ingress_helpers module ¶
- ecs_composex.ecs.service_networking.ingress_helpers. add_dependant_ingress_rules ( dst_family , dst_family_sg_param , src_family ) [source] ¶
-
- Return type :
-
None
- ecs_composex.ecs.service_networking.ingress_helpers. add_independent_rules ( dst_family , service_name , root_stack ) [source] ¶
-
Adds security groups rules in the root stack as both services need to be created (with their SG) before the ingress rule can be defined.
- Parameters :
-
-
dst_family (
ecs_composex.ecs.ecs_family.ComposeFamily
) – -
service_name (
str
) – -
root_stack (
ecs_composex.common.stacks.ComposeXStack
) –
-
- Return type :
-
None
- Returns :
-
- 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 :
-
-
family ( ecs_composex.ecs.ecs_family.ComposeFamily ) –
-
family_mappings ( dict ) –
-
cloudmap_config ( dict ) –
-
ports ( list ) –
-
- 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 :
-
-
family ( ecs_composex.ecs.ecs_family.ComposeFamily ) –
-
family_mappings ( dict ) –
-
cloudmap_config ( str ) –
-
ports ( list ) –
-
- Return type :
-
None
- ecs_composex.ecs.service_networking.ingress_helpers. merge_cloudmap_settings ( family , ports ) [source] ¶
-
Function to merge the x_cloudmap from the service
- Parameters :
-
-
family ( ecs_composex.ecs.ecs_family.ComposeFamily ) –
-
ports ( list [ dict ] ) –
-
- 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 :
-
-
family ( ecs_composex.ecs.ecs_family.ComposeFamily ) –
-
key ( str ) –
-
definition ( dict ) –
-
network ( dict ) –
-
network_config ( dict ) –
-
- 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. set_compose_services_ingress ( root_stack , dst_family , families , settings ) [source] ¶
-
Function to crate SG Ingress between two families / services. Presently, the ingress rules are set after all services have been created
- Parameters :
-
-
root_stack ( ecs_composex.common.stacks.ComposeXStack ) –
-
dst_family ( ecs_composex.ecs.ecs_family.ComposeFamily ) –
-
families ( list ) – The list of family names.
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
- Return type :
-
None
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 ) [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 ¶
- 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_group ¶
- property security_groups : list ¶
- self_key = 'Myself' ¶
- property subnets ¶
- property subnets_output ¶