-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,3 @@ output.txt | |
output/ | ||
|
||
*.csv | ||
script/download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
WORKSPACE=$(pwd) | ||
|
||
# Get the S3 bucket ARN from the Terraform outputs | ||
cd "$WORKSPACE/tf/" | ||
BUCKET_ARN=$(terraform output -raw s3_bucket_arn) | ||
echo "Received bucket ARN: $BUCKET_ARN" | ||
BUCKET_NAME=$(echo $BUCKET_ARN | cut -d':' -f6) | ||
|
||
# List the contents of the bucket | ||
OBJECTS=$(aws s3 ls s3://$BUCKET_NAME/ --recursive | wc -l) | ||
echo "Object count: $OBJECTS" | ||
|
||
# Download the contents of the bucket | ||
mkdir -p "$WORKSPACE/output/" | ||
aws s3 sync s3://$BUCKET_NAME/ "$WORKSPACE/output/" | ||
|
||
OBJECT_COUNT=$(ls -la $WORKSPACE/output/ | wc -l) | ||
echo "Downloaded: $OBJECT_COUNT files." |