ecs_composex.s3 package

Submodules

ecs_composex.s3.s3_aws module

Functions to find buckets and identify settings about these.

ecs_composex.s3.s3_aws. lookup_bucket_config ( lookup , session ) [source]

Function to find the DB in AWS account

Parameters
  • lookup ( dict ) – The Lookup definition for DB

  • session ( boto3.session.Session ) – Boto3 session for clients

Returns

ecs_composex.s3.s3_aws. return_bucket_config ( bucket_arn , session ) [source]
Parameters
  • bucket_arn ( str ) –

  • session ( boto3.session.Session ) –

Returns

ecs_composex.s3.s3_ecs module

Functions to pass permissions to Services to access S3 buckets.

ecs_composex.s3.s3_ecs. assign_lookup_buckets ( bucket , mappings ) [source]

Function to add the lookup bucket to service access

Parameters
  • bucket ( ecs_composex.s3.s3_stacks.Bucket ) –

  • mappings ( dict ) –

ecs_composex.s3.s3_ecs. assign_new_bucket_to_services ( bucket , res_root_stack , nested = False ) [source]

Function to assign the bucket services permissions to access the s3 bucket. :param ecs_composex.s3.s3_stack.Bucket bucket: :param ecs_composex.common.stacks.ComposeXStack res_root_stack: :param bool nested: :return:

ecs_composex.s3.s3_ecs. assign_service_permissions_to_bucket ( bucket , family , services , access , value , arn ) [source]
ecs_composex.s3.s3_ecs. define_bucket_mappings ( buckets_mappings , lookup_buckets , use_buckets , settings ) [source]

Function to populate bucket mapping

Parameters

buckets_mappings

Returns

ecs_composex.s3.s3_ecs. define_lookup_buckets_access ( bucket , target , services ) [source]

Function to create the IAM policy for the service access to bucket

Parameters
  • bucket

  • target

  • services

Returns

ecs_composex.s3.s3_ecs. get_bucket_kms_key_from_config ( bucket , bucket_config , session ) [source]

Function to get the KMS Encryption key if defined.

Parameters
Returns

The KMS Key ARN or None

Return type

str

ecs_composex.s3.s3_ecs. handle_new_resources ( resource , services_stack , res_root_stack , nested = False ) [source]
Parameters
Returns

ecs_composex.s3.s3_ecs. s3_to_ecs ( resources , services_stack , res_root_stack , settings ) [source]

Function to handle permissions assignment to ECS services.

Parameters
  • resources – x-sqs queues defined in compose file

  • services_stack ( ecs_composex.common.stack.ComposeXStack ) – services root stack

  • res_root_stack ( ecs_composex.common.stack.ComposeXStack ) – s3 root stack

  • settings ( ecs_composex.common.settings.ComposeXSettings ) – ComposeX Settings for execution

Returns

ecs_composex.s3.s3_ecs. validate_bucket_kms_key ( bucket , kms_key , session ) [source]

Function to evaluate the KMS Key ID and ensure we return a KMS Key ARN

Parameters
Returns

The KMS Key ARN or None

Return type

str

ecs_composex.s3.s3_params module

ecs_composex.s3.s3_perms module

ecs_composex.s3.s3_perms. get_access_types ( ) [source]

ecs_composex.s3.s3_stack module

Module to control S3 stack

class ecs_composex.s3.s3_stack. Bucket ( name , definition , module_name , settings , mapping_key = None ) [source]

Bases: ecs_composex.common.compose_resources.XResource

Class for S3 bucket.

init_outputs ( ) [source]
class ecs_composex.s3.s3_stack. XStack ( title , settings , ** kwargs ) [source]

Bases: ecs_composex.common.stacks.ComposeXStack

Class to handle S3 buckets

ecs_composex.s3.s3_stack. create_s3_template ( new_buckets , template ) [source]

Function to create the root S3 template.

Parameters
  • new_buckets ( list ) –

  • template ( troposphere.Template ) –

Returns

ecs_composex.s3.s3_template module

ecs_composex.s3.s3_template. define_bucket_name ( bucket ) [source]

Function to automatically add Region and Account ID to the bucket name. If set, will use a user-defined separator, else, -

Parameters

bucket

Returns

The bucket name

Return type

str

ecs_composex.s3.s3_template. evaluate_parameters ( bucket , bucket_template ) [source]
Parameters
ecs_composex.s3.s3_template. generate_bucket ( bucket ) [source]

Function to generate the S3 bucket object

Parameters

bucket ( ecs_composex.s3.s3_stack.Bucket ) –

Returns

ecs_composex.s3.s3_template. handle_predefined_policies ( bucket , param_key , managed_policies_key , statement ) [source]

Function to configure and add statements for bucket policy based on predefined Bucket Policies

Parameters
  • bucket

  • param_key ( str ) –

  • managed_policies_key ( str ) –

  • statement ( list ) –

ecs_composex.s3.s3_template. handle_user_defined_policies ( bucket , param_key , user_policies_key , statement ) [source]

Function to add user defined policies

Parameters
  • bucket

  • param_key ( str ) –

  • user_policies_key ( str ) –

  • statement ( list ) –

ecs_composex.s3.s3_template. implement_bucket_policy ( bucket , param_key , bucket_template ) [source]

Function to parse the input parameter for the Bucket Policy, and generate the policy accordingly

Parameters

Module contents