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. handle_services_alarm_access ( alarm ) [source]

Function to grant describe access onto the alarm

Parameters

alarm

Returns

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_ecs. set_services_alarms ( settings ) [source]

Function to create and assign alarms to services

Parameters

settings ( ecs_composex.common.settings.ComposeXSettings ) –

Returns

ecs_composex.alarms.alarms_ecs. update_alarm_threshold ( alarm_properties , settings ) [source]

Function to update the threshold based on the defined settings

Parameters
  • alarm_properties

  • settings

Returns

ecs_composex.alarms.alarms_ecs. update_definition_from_settings ( alarm_definition , settings ) [source]

Function to update the alarm definition with the global settings

Parameters
  • alarm_definition ( dict ) –

  • settings ( dict ) –

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_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_name , settings , mapping_key = None ) [source]

Bases: ecs_composex.common.compose_resources.XResource

Class to represent CW Alarms

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

Bases: ecs_composex.common.stacks.ComposeXStack

Class to represent the Rootstack for alarms

add_xdependencies ( root_stack , settings ) [source]

Function to cross reference alarm settings with other resources

Parameters
handle_dimensions ( resource , root_stack , settings ) [source]

Handles the dimensions settings and tries to resolve

Parameters
ecs_composex.alarms.alarms_stack. add_composite_alarms ( template , new_alarms ) [source]
ecs_composex.alarms.alarms_stack. create_alarms ( template , settings , new_alarms ) [source]

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

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

Function to create the composite alarms

Parameters
  • alarm ( Alarm ) –

  • alarms ( list ) –

Returns

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

Function to create the composite alarms

Parameters
  • mapping ( dict ) –

  • expression ( str ) –

  • alarms ( list ) –

Returns

ecs_composex.alarms.alarms_stack. 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

Module contents