ecs_composex.ecs.ecs_family package ¶
Subpackages ¶
-
ecs_composex.ecs.ecs_family.family_helpers package
- Submodules
- ecs_composex.ecs.ecs_family.family_helpers.compute_finalizers module
- ecs_composex.ecs.ecs_family.family_helpers.network_finalizers module
-
Module contents
-
assign_policy_to_role()
-
assign_secrets_to_roles()
-
ensure_essential_containers()
-
handle_same_task_services_dependencies()
-
set_ecs_cluster_logging_access()
-
set_ecs_cluster_logging_cw_access()
-
set_ecs_cluster_logging_kms_access()
-
set_ecs_cluster_logging_s3_access()
-
set_service_dependency_on_all_iam_policies()
-
swap_environment_value_with_parameter()
-
update_env_var_to_parameter()
-
-
ecs_composex.ecs.ecs_family.family_logging package
- Submodules
- ecs_composex.ecs.ecs_family.family_logging.cw_logging module
-
Module contents
-
FamilyLogging
-
FamilyLogging.api_health_enabled
-
FamilyLogging.buffer_limit_mb
-
FamilyLogging.cpu_limits
-
FamilyLogging.cw_log_retention
-
FamilyLogging.family
-
FamilyLogging.family_log_group
-
FamilyLogging.grace_period
-
FamilyLogging.handle_awslogs_logging()
-
FamilyLogging.handle_firelens()
-
FamilyLogging.init_family_services_log_configuration()
-
FamilyLogging.set_init_family_service_logging()
-
FamilyLogging.update_cw_log_retention()
-
FamilyLogging.update_family_services_logging_configuration()
-
-
Submodules ¶
ecs_composex.ecs.ecs_family.family_template module ¶
ecs_composex.ecs.ecs_family.task_execute_command module ¶
Module to enable ECS Anywhere feature for a given ECS Family.
- ecs_composex.ecs.ecs_family.task_execute_command. apply_ecs_execute_command_permissions ( family , settings ) [source] ¶
-
Set the IAM Policies in place to allow ECS Execute SSM and Logging
- Parameters :
-
settings –
- Returns :
-
ecs_composex.ecs.ecs_family.task_runtime module ¶
- ecs_composex.ecs.ecs_family.task_runtime. define_family_runtime_cpu_arch ( family , svc ) [source] ¶
-
Sets the CPU Runtime architecture set from services, if set. Validates that if set, it is the same for all
- Raises :
-
ValueError
- Return type :
-
None
Module contents ¶
Package to manage an ECS “Family” Task and Service definition
- class ecs_composex.ecs.ecs_family. ComposeFamily ( services , family_name ) [source] ¶
-
Bases:
object
Class to group services logically to create the final ECS Task and Service definitions
Processing order
-
Import first service
-
Define LaunchType
-
- Define CapacityProviders if set
-
This helps determine if we run in EXTERNAL mode early, as a lot of networking settings won’t apply.
- Variables :
-
-
services ( list [ ecs_composex.compose.compose_services.ComposeService ] ) – List of the Services part of the family
-
ecs_service ( ecs_composex.ecs.ecs_service.Service ) – ECS Service settings
-
iam_manager ( ecs_composex.ecs.task_iam.TaskIam ) –
-
task_compute ( TaskCompute ) – Task Compute manager
-
- add_containers_images_cfn_parameters ( ) [source] ¶
-
Adds parameters to the stack and set values for each service/container in the family definition
- add_managed_sidecar ( service ) [source] ¶
-
Adds a new container/service to the Task Family and validates all settings that go along with the change. :type service:
ecs_composex.compose.compose_services.ComposeService
:param service:
- add_service ( service ) [source] ¶
-
Function to add new services (defined in the compose files). Not to use for managed sidecars :param ComposeService service:
- apply_ecs_execute_command_permissions ( settings ) [source] ¶
-
Method to set the IAM Policies in place to allow ECS Execute SSM and Logging
- Parameters :
-
settings (
ecs_composex.common.settings.ComposeXSettings
) – - Return type :
-
None
- Returns :
-
- finalize_family_settings ( settings ) [source] ¶
-
Once all services have been added, we add the sidecars and deal with appropriate permissions and settings Will add xray / prometheus sidecars
- finalize_services_networking_settings ( settings ) [source] ¶
-
Final pass on the service network settings
- Return type :
-
None
- generate_outputs ( ) [source] ¶
-
Generates a list of CFN outputs for the ECS Service and Task Definition
- handle_logging ( settings ) [source] ¶
-
Method to go over each service logging configuration and accordingly define the IAM permissions needed for the exec/task role
- import_all_sidecars ( ) [source] ¶
-
Once all services have been added from the ComposeXSettings looping over services, we import all sidecars Should be invoked only once.
- Return type :
-
None
- init_family ( ) [source] ¶
-
Initializes the family after all services in the docker-compose definition have been assigned.
The only containers that might then be added will be sidecars which won’t influence launch type, capacity providers or anything else than the ECS Task Definition (CPU/RAM | ProxySettings)
- Return type :
-
None
- init_network_settings ( settings , vpc_stack , families_sg_stack ) [source] ¶
-
Once we have figured out the compute settings (EXTERNAL vs other)
- Return type :
-
None
- init_task_definition ( ) [source] ¶
-
Initialize the ECS TaskDefinition
-
Sets Compute settings
-
Sets the TaskDefinition using current services/ContainerDefinitions
-
Update the logging configuration for the containers.
-
- property logical_name : str ¶
- property service_definition : Union [ None , Service ] ¶
- property services : list [ ecs_composex.compose.compose_services.ComposeService ] ¶
- property services_names : list [ str ] ¶
- set_enable_execute_command ( ) [source] ¶
-
Sets necessary settings to enable ECS Execute Command ECS Anywhere support since 2022-01-24
- Return type :
-
None
- set_services_to_services_dependencies ( ) [source] ¶
-
Method to iterate over each depends_on service set in the family services and add them up
- Returns :
-
- set_task_definition ( ) [source] ¶
-
Function to set or update the task definition
- Parameters :
-
self – the self of services
- set_update_containers_priority ( ) [source] ¶
-
Method to sort out the containers dependencies and create the containers definitions based on the configs.
- Return type :
-
None
- static sort_env_vars ( service , environment , secrets = None ) [source] ¶
-
Sorts env vars. If there are secrets in the list, checks to remove env vars with Name that’d overlap with an existing secret. Favoring secret over environment variable for security, as it’s likely more sensitive.
- Return type :
-
None
- sort_secrets_env_vars ( ) [source] ¶
-
Sorts secrets and env vars alphabetically. Removes env vars which would have a Key common to secrets
- state_facts ( ) [source] ¶
-
Function to display facts about the family. Similar to __repr__ but for logging the properties of the ComposeFamily
- property task_ephemeral_storage : int ¶
-
If any service ephemeral storage is defined above, sets the ephemeral storage to the maximum of them. Return 0 if below 21 which is the default “free” Fargate storage space.
- property want_xray : bool ¶
-
- class ecs_composex.ecs.ecs_family. ServiceStack ( name , stack_template , stack_parameters = None , file_name = None , module_name = None , module = None , ** kwargs ) [source] ¶
-
Bases:
ComposeXStack
Class to identify specifically a service stack