ecs_composex.appmesh package

Submodules

ecs_composex.appmesh.appmesh_aws module

Module to interact with AWS AppMesh API

ecs_composex.appmesh.appmesh_aws. find_mesh_in_list ( mesh_name , client , next_token = None ) [source]

Function to recursively go through meshes in case the mesh exists but we don’t know the account Id

Parameters
  • mesh_name – Name of the mesh

  • next_token – token for next api call

Returns

ecs_composex.appmesh.appmesh_aws. lookup_mesh_by_name ( session , mesh_name , mesh_owner = None ) [source]

Function to figure out whether the mesh exists or not.

Parameters
  • mesh_name ( str ) –

  • session ( boto3.session.Session ) –

  • mesh_owner ( str ) –

Returns

ecs_composex.appmesh.appmesh_conditions module

AppMesh related conditions

ecs_composex.appmesh.appmesh_conditions. add_appmesh_conditions ( template ) [source]

Function to add AppMesh default conditions to template

Parameters

template ( troposphere.Template ) – The template to add the conditions to

ecs_composex.appmesh.appmesh_conditions. get_mesh_name ( mesh_obj ) [source]

Function to return the mesh reference based on the type of parameter mesh_obj

Returns

ecs_composex.appmesh.appmesh_conditions. get_mesh_owner ( mesh_obj ) [source]

Function to return the mesh reference based on the type of parameter mesh_obj

Returns

ecs_composex.appmesh.appmesh_conditions. set_mesh_name ( ) [source]

Function to set the mesh name if default is passed, otherwise generate it. :return: If

ecs_composex.appmesh.appmesh_conditions. set_mesh_owner_id ( ) [source]

Returns the IF condition for MeshOwner

Returns

CFN Condition

Return type

If

ecs_composex.appmesh.appmesh_mesh module

Main module for AppMesh.

Once all services have been deployed and their VirtualNodes are setup, we deploy the Mesh for it.

class ecs_composex.appmesh.appmesh_mesh. Mesh ( mesh_definition , services_root_stack , settings , dns_settings ) [source]

Bases: object

Class for AppMesh mesh

define_nodes ( settings , services_root_stack , mesh ) [source]

Method to compile the nodes for the Mesh.

Parameters

services_root_stack ( ecs_composex.ecs.ServicesStack ) – The services root stack where the services are.

Returns

define_routes_and_routers ( ) [source]

Method to register routers

define_virtual_services ( dns_settings ) [source]

Method to parse the services and map them to nodes and routers.

mesh_title = 'ServiceMesh'
nodes_key = 'Nodes'
process_mesh_components ( services_stack , dns_settings ) [source]
render_mesh_template ( services_stack , settings , dns_settings ) [source]

Method to create the AppMesh template stack.

Parameters

services_stack ( ecs_composex.ecs.ServicesStack ) – The services root stack

required_keys = ['Nodes', 'Routers', 'Services']
routers_key = 'Routers'
services_key = 'Services'

ecs_composex.appmesh.appmesh_node module

class ecs_composex.appmesh.appmesh_node. MeshNode ( family , protocol , mesh , backends = None ) [source]

Bases: object

Class representing an AppMesh Node.

add_envoy_container_definition ( family ) [source]

Method to expand the containers configuration and add the Envoy SideCar.

create_ingress_rule ( root_stack , nodes ) [source]

Creates EC2 ingress rules to allow all traffic from node to backends nodes SG.

Parameters
expand_backends ( root_stack , services ) [source]

Method to set the backends to the service node.

Parameters
  • root_stack ( ecs_composex.ServicesStack ) – the root stack to put a dependency from.

  • services ( dict ) – the services in the mesh stack.

extend_service_stack ( mesh ) [source]

Method to expand the service template with the AppMesh virtual node

extend_task_policy ( ) [source]

Method to add a policy for AppMesh Access

set_listeners_port_mappings ( ) [source]

Method to set the listeners port_mappings

set_node_weight ( weight ) [source]

Method to set the weight of the service

Parameters

weight ( int ) –

Returns

set_port_mappings ( ) [source]

Method to set the port mappings based on the service config ports

weight = 1

ecs_composex.appmesh.appmesh_params module

AppMesh parameters

ecs_composex.appmesh.appmesh_router module

Module to manage Routers specifically.

class ecs_composex.appmesh.appmesh_router. MeshRouter ( name , definition , mesh , nodes ) [source]

Bases: object

Defines a router.

add_routes ( nodes ) [source]

Method to register routers

handle_http_route ( routes , router , nodes , http2 = False ) [source]

Function to create a HTTP or HTTP/2 route

Parameters
  • routes ( list ) – routes of HTTP or HTTP2 protocol

  • router ( troposphere.appmesh.VirtualRouter ) – The virtual router to attach the route to.

  • nodes ( dict ) – list of nodes.

  • http2 – whether it is http2

Returns

handle_tcp_route ( routes , router , nodes ) [source]

Function to create the TCP routes for the router

Parameters
  • routes ( list ) – routes of TCP protocol

  • router ( troposphere.appmesh.VirtualRouter ) – The virtual router to attach the route to.

  • nodes ( dict ) – Nodes in the mesh

http_routes_keys = ['Match', 'Nodes']
tcp_routes_keys = ['Nodes']
validate_definition ( ) [source]

Method to validate the router definition

ecs_composex.appmesh.appmesh_router. define_http_route ( route_match , route_nodes ) [source]
ecs_composex.appmesh.appmesh_router. define_route_name ( route_match ) [source]

Function to create the route name for an AppMesh Router.

Parameters

route_match ( dict ) – The route argument.

Returns

ecs_composex.appmesh.appmesh_service module

Module to manage the AppMesh Virtual service

class ecs_composex.appmesh.appmesh_service. MeshService ( name , definition , routers , nodes , mesh , dns_settings ) [source]

Bases: object

Class to represent a mesh Virtual Service.

add_dns_entries ( template , dns_settings ) [source]

Method to add CloudMap service and record for DNS resolution.

get_backend_nodes ( ) [source]

Method to return the nodes SG when this service is used as backend.

Returns

ecs_composex.appmesh.appmesh_service. validate_service_backend ( service , routers , nodes ) [source]

Function to validate backend settings

Parameters
  • service

  • nodes

  • routers

Raises

KeyError

Module contents