Skip to content

Commit

Permalink
get prefix list ids for dbmigration for infra region (#624)
Browse files Browse the repository at this point in the history
### Feature or Bugfix
- Bugfix

### Detail
- get the prefix id list for S3 from the infra region. We need the
prefix id to connect the dbmigration stage with the S3 bucket containing
the migration scripts (add it in the security groups)

### Relates
- #618 

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
  • Loading branch information
dlpzx authored Aug 8, 2023
1 parent 8900ebf commit f0a932f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
9 changes: 4 additions & 5 deletions deploy/stacks/backend_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def __init__(
id,
envname: str = 'dev',
resource_prefix='dataall',
tooling_region=None,
tooling_account_id=None,
ecr_repository=None,
image_tag=None,
Expand Down Expand Up @@ -72,7 +71,7 @@ def __init__(
vpc = self.vpc_stack.vpc
vpc_endpoints_sg = self.vpc_stack.vpce_security_group
vpce_connection = ec2.Connections(security_groups=[vpc_endpoints_sg])
self.s3_prefix_list = self.get_s3_prefix_list(tooling_region)
self.s3_prefix_list = self.get_s3_prefix_list()

self.pivot_role_name = f"dataallPivotRole{'-cdk' if enable_pivot_role_auto_create else ''}"

Expand Down Expand Up @@ -362,13 +361,13 @@ def create_opensearch_serverless_stack(self):
collection_name=aoss_stack.collection_name,
)

def get_s3_prefix_list(self, tooling_region):
ec2_client = boto3.client("ec2", region_name=tooling_region)
def get_s3_prefix_list(self):
ec2_client = boto3.client("ec2", region_name=self.region)
response = ec2_client.describe_prefix_lists(
Filters=[
{
'Name': 'prefix-list-name',
'Values': [f'com.amazonaws.{tooling_region}.s3']
'Values': [f'com.amazonaws.{self.region}.s3']
},
]
)
Expand Down
2 changes: 0 additions & 2 deletions deploy/stacks/backend_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def __init__(
resource_prefix='dataall',
ecr_repository=None,
commit_id=None,
tooling_region=None,
tooling_account_id=None,
pipeline_bucket=None,
vpc_id=None,
Expand Down Expand Up @@ -42,7 +41,6 @@ def __init__(
f'backend-stack',
envname=envname,
resource_prefix=resource_prefix,
tooling_region=tooling_region,
tooling_account_id=tooling_account_id,
ecr_repository=ecr_repository,
pipeline_bucket=pipeline_bucket,
Expand Down
1 change: 0 additions & 1 deletion deploy/stacks/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,6 @@ def set_backend_stage(self, target_env, repository_name):
},
envname=target_env['envname'],
resource_prefix=self.resource_prefix,
tooling_region=self.region,
tooling_account_id=self.account,
pipeline_bucket=self.pipeline_bucket_name,
ecr_repository=f'arn:aws:ecr:{target_env.get("region", self.region)}:{self.account}:repository/{repository_name}',
Expand Down

0 comments on commit f0a932f

Please sign in to comment.