Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Deleting S3 files using AWS data pipeline

I want to delete all S3 keys starting with some prefix using AWS data Pipeline. I am using AWS Shell Activity for this.

These are the argument

  "scriptUri": "https://s3.amazonaws.com/my_s3_bucket/hive/removeExitingS3.sh",
  "scriptArgument": "s3://my_s3_bucket/output/2017-03-19",

I want to delete all S3 keys starting with 2017-03-19 in output folder. What should be command to do this?

I have tried this command in .sh file

  sudo yum -y upgrade aws-cli 
  aws s3 rm $1 --recursive

This is not working.

Sample files are

s3://my_s3_bucket/output/2017-03-19/1.txt
s3://my_s3_bucket/output/2017-03-19/2.txt
s3://my_s3_bucket/output/2017-03-19_3.txt

EDIT:

The date(2017-03-19) is dynamic and this is output of #{format(@scheduledStartTime,"YYYY-MM-dd")}. So effectively

 "scriptArgument": "s3://my_s3_bucket/output/{format(@scheduledStartTime,"YYYY-MM-dd")}"
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try

aws s3 rm $1 --recursive --exclude "*" --include "2017-03-19*" --include "2017-03-19/*"

with

"scriptArgument": "s3://my_s3_bucket/output/"

EDIT: As the date is a dynamic param, pass it as the second scriptArgument to the Shell command activity,

aws s3 rm $1 --recursive --exclude "*" --include "$2*" --include "$2/*"
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!