ecs_composex.alarms package

Submodules

ecs_composex.alarms.alarms_ecs module

Module to define CloudWatch alarms in x-alarms and match these to services

ecs_composex.alarms.alarms_ecs. add_service_actions ( alarm , alarms_stack , target , scaling_in_policy , scaling_out_policy ) [source]

Function to update the alarm properties with OKActions and AlarmActions

Parameters :
ecs_composex.alarms.alarms_ecs. alarms_to_ecs ( resources , services_stack , res_root_stack , settings ) [source]
ecs_composex.alarms.alarms_ecs. get_alarm_actions ( alarm ) [source]

Function to get the alarm actions

Parameters :

alarm

Returns :

the okay and alarm actions

Return type :

tuple

ecs_composex.alarms.alarms_ecs. handle_alarm_topics ( alarm , alarms_stack , settings ) [source]

Function to add the topics actions for defined topics

Parameters :
Returns :

ecs_composex.alarms.alarms_ecs. handle_compose_topics ( alarm , alarms_stack , settings , topic_def , notify_on ) [source]

Function to handle x-alarms to x-sns topics

Parameters :
Returns :

ecs_composex.alarms.alarms_ecs. handle_notify_on ( topic_def ) [source]

Function to validate parameter NotifyOn

Parameters :

topic_def ( dict ) –

Returns :

ecs_composex.alarms.alarms_ecs. handle_service_scaling ( alarm , alarms_stack ) [source]

Function to create the scaling steps for defined services

Parameters :
ecs_composex.alarms.alarms_ecs. map_topic_to_action ( alarm , notify_on , topic_identifier ) [source]

Function to map the topic to specific actions

Parameters :
  • alarm – alarm props for alarms

  • notify_on ( str ) –

  • topic_identifier

Returns :

ecs_composex.alarms.alarms_elbv2 module

Functions to validate the inputs from Metrics for elbv2 https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html#load-balancer-metrics-alb https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-cloudwatch-metrics.html

ecs_composex.alarms.alarms_elbv2. get_target_lb ( parts , dimension , resource , settings ) [source]

Identifies and returns the Elbv2 from the x-elbv2 defined

Parameters :
Returns :

The ELBv2 object

Return type :

ecs_composex.elbv2.elbv2_stack.Elbv2

Raises :

ValueError if the name provided does not match to an x-elbv2 resource

ecs_composex.alarms.alarms_elbv2. handle_elbv2_dimension_mapping ( alarms_stack , dimension , resource , settings ) [source]

Replaces x-elbv2::<name> with a pointer to the LB

Parameters :
Returns :

The identified LB

ecs_composex.alarms.alarms_elbv2. handle_elbv2_target_group_dimensions ( alarms_stack , dimension , resource , settings ) [source]

Matches up the x-elbv2::<lb>::<service>::port provided input to the new resource for alarms

Parameters :
Returns :

ecs_composex.alarms.alarms_elbv2. validate_tgt_input ( dimension , settings ) [source]

Validates given input is conform to expect format

Parameters :
Returns :

The parts matched from the input

Return type :

re.Match

Raises :

ValueError

ecs_composex.alarms.alarms_helpers module

ecs_composex.alarms.alarms_helpers. add_composite_alarms ( template , new_alarms ) [source]
Return type :

None

ecs_composex.alarms.alarms_helpers. create_alarms ( template , stack , new_alarms , settings ) [source]

Main function to create new alarms Rules out CompositeAlarms first, creates “Simple” alarms, and then link these to ComopsiteAlarms if so declared.

Return type :

None

ecs_composex.alarms.alarms_helpers. create_composite_alarm ( alarm , alarms ) [source]

Function to create the composite alarms

Return type :

None

ecs_composex.alarms.alarms_helpers. create_composite_alarm_expression ( mapping , expression ) [source]

Function to create the composite alarms

Parameters :
  • mapping ( dict ) –

  • expression ( str ) –

  • alarms ( list ) –

Return type :

troposphere.Join

Returns :

ecs_composex.alarms.alarms_helpers. handle_service_alarm ( alarm , settings , template , family_name ) [source]
Return type :

None

ecs_composex.alarms.alarms_helpers. map_expression_to_alarms ( expression , alarms ) [source]

Function to map the alarms in expression to CFN alarms

Parameters :
  • expression ( str ) –

  • alarms ( list ) –

Returns :

The composite alarm properties

Return type :

dict

ecs_composex.alarms.alarms_module module

ecs_composex.alarms.alarms_params module

ecs_composex.alarms.alarms_stack module

Main module to create x-alarms defined at the top level.

class ecs_composex.alarms.alarms_stack. Alarm ( name , definition , module , settings ) [source]

Bases: ServicesXResource

Class to represent CW Alarms

handle_dimensions ( settings ) [source]

Handles the dimensions settings and tries to resolve

Return type :

None

handle_x_dependencies ( settings , root_stack = None ) [source]

Function to cross reference alarm settings with other resources

Parameters :
Return type :

None

init_outputs ( ) [source]

Placeholder method

topics_key = 'Topics'
class ecs_composex.alarms.alarms_stack. XStack ( name , settings , module , ** kwargs ) [source]

Bases: ComposeXStack

Class to represent the root stack for alarms

Module contents