diff --git a/README.md b/README.md index 1e985013..740395b0 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,8 @@ cdk bootstrap -c email=$EMAIL -c account=$ACCOUNT -c region=$REGION -c source_br This command creates a CodePipeline pipeline, this pipeline coordinates the build and deployment of all required DREM services. +Note - when deploying DREM in an account for the first time it may fail when creating AWS CodeStar Notifications, as the service-linked role for AWS CodeStar Notifications might not yet exist. Wait a few minutes, and then try again. + ```sh make install ``` diff --git a/lib/lambdas/models_optimize/model_optimizer_lambda.py b/lib/lambdas/models_optimize/model_optimizer_lambda.py index ab6a1bfb..bde86947 100644 --- a/lib/lambdas/models_optimize/model_optimizer_lambda.py +++ b/lib/lambdas/models_optimize/model_optimizer_lambda.py @@ -78,6 +78,11 @@ def lambda_handler(event, context): model_key, os.path.join(constants.APIDefaults.TMP_DIR, model_target_file), ) + # Get the tags of the downloaded file as we' + s3_object_tags = client_s3.get_object_tagging( + Bucket=src_bucket, + Key=model_key + )['TagSet'] if not os.path.isdir(model_target_dir): os.makedirs(model_target_dir) @@ -100,9 +105,10 @@ def lambda_handler(event, context): return try: - client_s3.upload_file(archive_file, src_bucket, model_key) + #Add the same tags as the downloaded file when uploading the optimized model + client_s3.upload_file(archive_file, src_bucket, model_key,ExtraArgs={'Tagging': '&'.join([f"{tag['Key']}={tag['Value']}" for tag in s3_object_tags])}) logger.info( - f"Uploading {archive_file} to s3://{src_bucket}/{model_key}" + f"Uploading {archive_file} to s3://{src_bucket}/{model_key} with tags {s3_object_tags}" ) except ClientError as e: logger.error(f"Error in uploading {archive_file}", e)