aws-solutions / content-analysis-on-aws

As of August 30, 2023, this AWS Solution is no longer available. Existing deployments will continue to run. The functionality provided by Content Analysis on AWS will be superseded with functionality in Media2Cloud on AWS and Content Localization on AWS. We encourage you to explore these solutions.
https://aws.amazon.com/solutions/implementations/aws-content-analysis/
Apache License 2.0
96 stars 47 forks source link

Update S3 write scripts to check account ownership before write #19

Closed jilladams closed 3 years ago

jilladams commented 3 years ago

Update script statements like this: aws s3 sync $global_dist_dir s3://$global_bucket/aws-media-insights-engine/$version/ aws s3 sync $regional_dist_dir s3://${regional_bucket}-${region}/aws-media-insights-engine/$version/

To include checks like this before running s3 sync or cp: aws s3api head-bucket --bucket $global_bucket --expected-bucket-owner $bucket_account aws s3api head-bucket --bucket $regional_bucket --expected-bucket-owner $bucket_account

The head-bucket command will return a non-zero result (API returns a 403) if the bucket ownership doesn’t match. If you have error handling set to short-circuit the script, the above statements would stop the script before uploading.

Directly uploading to regional buckets means checking each bucket before uploading.