ecs_composex.rds package ¶
Submodules ¶
ecs_composex.rds.rds_conditions module ¶
ecs_composex.rds conditions for CFN. Allows to implement conditional logic in native CFN format.
ecs_composex.rds.rds_db_template module ¶
RDS DB template generator
- ecs_composex.rds.rds_db_template. add_db_instances_for_cluster ( db_template , db ) [source] ¶
-
Function to add DB instances for a RDS Cluster
- Parameters :
-
-
db_template ( troposphere.Template ) –
-
db ( ecs_composex.rds.rds_stack.Rds ) –
-
- Return type :
-
None
- ecs_composex.rds.rds_db_template. add_db_sg ( template , db ) [source] ¶
-
Function to add a Security group for the database
- Parameters :
-
-
db – Name of the database as defined in compose file
-
template ( troposphere.Template ) – template to add the sg to
-
- ecs_composex.rds.rds_db_template. add_default_cluster_definition ( db ) [source] ¶
-
Imports definition and creates DBCluster resource
- Return type :
-
troposphere.rds.DBCluster
- ecs_composex.rds.rds_db_template. add_default_db_instance_for_cluster ( db , db_template ) [source] ¶
-
- Return type :
-
None
- ecs_composex.rds.rds_db_template. add_default_instance_definition ( db , for_cluster = False ) [source] ¶
-
Add DB Instances
- ecs_composex.rds.rds_db_template. add_instances_from_parameters ( db_template , db ) [source] ¶
-
Adds DB Instances based on the DB definition.
- Return type :
-
None
- ecs_composex.rds.rds_db_template. add_parameter_group ( template , db , session = None ) [source] ¶
-
Create a DB ParameterGroup which uses the same values as default which can later be altered
- Return type :
-
None
- ecs_composex.rds.rds_db_template. create_db_subnet_group ( template , db , subnets = None ) [source] ¶
-
Create the DB Subnet Group
- Return type :
-
troposphere.rds.DBSubnetGroup
- ecs_composex.rds.rds_db_template. create_from_parameters ( db_template , db ) [source] ¶
-
Function to create the RDS resources from MacroParameters when Properties are not set.
- Return type :
-
None
- ecs_composex.rds.rds_db_template. create_from_properties ( db_template , db ) [source] ¶
-
Function to create RDS resources based on the Properties defined in Compose files. It will try to identify what type of resource (Cluster or Instance) is defined based on the properties that were given. If not capable, falls back to using MacroParameters, and if not, raises exception
- Return type :
-
None
- ecs_composex.rds.rds_db_template. define_parameters_group_from_engine_and_version ( db , template , engine_name , engine_version , session = None ) [source] ¶
-
- Return type :
-
None
- ecs_composex.rds.rds_db_template. determine_resource_type ( db_name , properties ) [source] ¶
-
Function to determine if the properties are the ones of a DB Cluster or DB Instance. Default assumes DBCluster if it can’t make it out from properties.
- Return type :
-
type | None
- ecs_composex.rds.rds_db_template. generate_database_template ( db , settings ) [source] ¶
-
Creates the database and its template. Will be used to create the stack for it.
- Return type :
-
troposphere.Template
- ecs_composex.rds.rds_db_template. init_database_template ( db ) [source] ¶
-
Initialize default DB Template
- Return type :
-
troposphere.Template
- ecs_composex.rds.rds_db_template. override_set_properties ( props , db ) [source] ¶
-
Override secrets parameters from the rds properties
- Return type :
-
None
ecs_composex.rds.rds_features module ¶
Module to handle RDS Features definition
- ecs_composex.rds.rds_features. add_rds_features ( settings , db , db_stack , features , boundary ) [source] ¶
-
Function to add AssociatedRoles and Features if not already defined in the DB properties for that feature.
- ecs_composex.rds.rds_features. apply_extra_parameters ( settings , db , db_stack ) [source] ¶
-
Function to add extra parameters set in MacroParameters post creation of the DB resource from properties
- Parameters :
-
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
db ( ecs_composex.rds.rds_stack.Rds ) –
-
db_stack ( ecs_composex.rds.rds_template.RdsDbStack ) –
-
- Return type :
-
None
- ecs_composex.rds.rds_features. define_associated_roles ( db ) [source] ¶
-
Function to define the AssociatedRoles, either present or empty :param ecs_composex.rds.rds_stack.RdsDb db: :return: the list of Associated Roles :rtype: list
ecs_composex.rds.rds_features_define module ¶
Module to define and match RDS Features to other AWS resources.
- ecs_composex.rds.rds_features_define. define_s3_bucket_arns ( settings , db , db_stack , config ) [source] ¶
-
Function to define the IAM Policy for S3Import access
- Parameters :
-
-
settings –
-
db –
-
db_stack –
-
config –
-
- Return type :
-
list
- Returns :
-
- ecs_composex.rds.rds_features_define. define_s3_export_feature_policy ( settings , db , db_stack , config ) [source] ¶
-
Function to define the IAM Policy for S3Import access
- Parameters :
-
-
settings –
-
db –
-
config –
-
- Return type :
-
troposphere.iam.Policy
- Returns :
-
- ecs_composex.rds.rds_features_define. define_s3_import_feature_policy ( settings , db , db_stack , config ) [source] ¶
-
Function to define the IAM Policy for S3Import access
- Parameters :
-
-
settings –
-
db –
-
db_stack –
-
config –
-
- Return type :
-
troposphere.iam.Policy
- Returns :
-
- ecs_composex.rds.rds_features_define. import_bucket_from_arn ( bucket ) [source] ¶
-
Function to import a bucket defined by its ARN, supports to detect the path in bucket for objects
- Parameters :
-
bucket ( str ) –
- Returns :
-
the bucket ARN to use
- Return type :
-
str
- ecs_composex.rds.rds_features_define. import_raw_bucket_name ( bucket ) [source] ¶
-
Function to import and define a bucket ARN from bucket name alone and support for path to be defined :param str bucket: :return: the bucket ARN :rtype: Sub
- ecs_composex.rds.rds_features_define. set_from_x_s3 ( settings , db , db_stack , bucket_name ) [source] ¶
-
Function to link the RDS DB to a Bucket defined in x-s3
- Parameters :
-
-
settings (
ecs_composex.common.settings.ComposeXSettings
) – -
db (
ecs_composex.rds.rds_stack.Rds
) – -
bucket_name ( str ) –
-
- Returns :
-
ecs_composex.rds.rds_module module ¶
ecs_composex.rds.rds_parameter_groups_helper module ¶
Helper to generate default parameter group settings from engine name and version
Strip rds internal params to try and fit within 20 param limit https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbparametergroup.html#cfn-rds-dbparametergroup-parameters
- ecs_composex.rds.rds_parameter_groups_helper. get_db_cluster_engine_parameter_group_defaults ( engine_family , for_aurora_cluster = True , session = None ) [source] ¶
-
Returns a dict of all the parameter group parameters and default values
- Parm str engine_family :
-
Engine family we are getting the cluster settings for, i.e. aurora-mysql5.7
ecs_composex.rds.rds_params module ¶
ecs_composex.rds parameters.
You can change the names values so you like so long as you keep it Alphanumerical [a-zA-Z0-9]
ecs_composex.rds.rds_stack module ¶
Module to handle AWS RDS CFN Templates creation
- class ecs_composex.rds.rds_stack. Rds ( name , definition , module , settings ) [source] ¶
-
Bases:
DatabaseXResource
Class to represent RDS DB
- handle_x_dependencies ( settings , root_stack = None ) [source] ¶
-
Handles x-rds to other x-resource dependencies and features :type settings: :param settings: :type root_stack: :param root_stack: :return:
- lookup_resource ( arn_re , native_lookup_function , cfn_resource_type , tagging_api_id , subattribute_key = None , use_arn_for_id = False ) [source] ¶
-
Method to self-identify properties :return:
- subnets_param = <ecs_composex.common.cfn_params.Parameter object> ¶
- class ecs_composex.rds.rds_stack. XStack ( title , settings , module , ** kwargs ) [source] ¶
-
Bases:
ComposeXStack
Class to handle ECS root stack specific settings
- do_validation : bool ¶
- properties : Dict[str, Any] ¶
- propnames : Set[str] ¶
- resource : Dict[str, Any] ¶
- template : Optional[Template] ¶
- title : Optional[str] ¶
ecs_composex.rds.rds_template module ¶
Main module template to generate the RDS Root template and all stacks according to x-rds settings
- class ecs_composex.rds.rds_template. RdsDbStack ( name , stack_template , db , rds_stack , ** kwargs ) [source] ¶
-
Bases:
ComposeXStack
Class to represent a RDS Stack
- do_validation : bool ¶
- properties : Dict[str, Any] ¶
- propnames : Set[str] ¶
- resource : Dict[str, Any] ¶
- template : Optional[Template] ¶
- title : Optional[str] ¶
- ecs_composex.rds.rds_template. add_db_stack ( root_template , db , settings , rds_stack ) [source] ¶
-
Function to add the DB stack to the root stack
- Parameters :
-
-
root_template ( troposphere.Template ) – root template to add the nested stack to
-
db ( ecs_composex.rds.rds_stack.Rds ) – the database definition from the compose file
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
- ecs_composex.rds.rds_template. generate_rds_templates ( rds_stack , root_tpl , new_dbs , settings ) [source] ¶
-
Function to generate the RDS root template for all the DBs defined in the x-rds section of the compose file
- Parameters :
-
-
root_tpl ( troposphere.Template ) –
-
new_dbs ( list ) –
-
settings ( ecs_composex.common.settings.ComposeXSettings ) –
-
Module contents ¶
Module to handle AWS RDS CFN Templates creation