Skip to content

Commit

Permalink
Add download script
Browse files Browse the repository at this point in the history
  • Loading branch information
agamm committed Sep 25, 2023
1 parent f1e5417 commit a030bf8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ output.txt
output/

*.csv
script/download
19 changes: 19 additions & 0 deletions script/download
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."

0 comments on commit a030bf8

Please sign in to comment.