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_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 , root_stack , settings ) [source]

Bases: object

Class for AppMesh mesh

define_nodes ( settings ) [source]

Method to compile the nodes for the Mesh.

Return type :

None

define_routes_and_routers ( ) [source]

Method to register routers

define_virtual_services ( 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 , settings ) [source]
render_mesh_template ( stack , settings ) [source]

Method to create the AppMesh template stack.

Parameters :

stack ( ComposeXStack ) – 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 , port , mesh , settings , backends = None ) [source]

Bases: object

Class representing an AppMesh Node.

add_envoy_container_definition ( mesh , 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 :
create_service_virtual_node ( family , mesh , settings ) [source]

Method to expand the service template with the AppMesh virtual node

expand_backends ( mesh , 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.

set_node_weight ( weight ) [source]

Method to set the weight of the service

Parameters :

weight ( int ) –

Returns :

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]

Scheme 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]

Scheme to validate the router definition

ecs_composex.appmesh.appmesh_router. define_http_route ( route_match , route_nodes , http2 ) [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 , settings ) [source]

Bases: object

Class to represent a mesh Virtual Service.

add_dns_entries ( stack , 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 :

namespace_property ( property_param , stack , settings ) [source]
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