How do we select the entire contents of a bucket (all images), and bulk copy URL list for all the objects?

0

How do we select the entire contents of a bucket, and bulk copy URL list for all the objects? Or generate a CSV with all of the URL's for every object in the bucket?

질문됨 2년 전895회 조회
2개 답변
0

You can't do it with S3 features alone.

But you can get a list of objects using S3's advanced API.
list-objects-v2 — AWS CLI 2.5.8 Command Reference

Then, you can format the acquired list into an easy-to-use form using another module such as jq.

$ aws s3api list-objects-v2 --bucket bucketname | jq -r '.Contents[] | ["s3://bucketname/" + .Key] | @csv'
"s3://bucketname/html/API_AddTags.md.html"
"s3://bucketname/html/API_AlgorithmSpecification.md.html"
"s3://bucketname/html/API_AlgorithmStatusDetails.md.html"
"s3://bucketname/html/API_AlgorithmStatusItem.md.html"
"s3://bucketname/html/API_AlgorithmSummary.md.html"
"s3://bucketname/html/API_AlgorithmValidationProfile.md.html"
"s3://bucketname/html/API_AlgorithmValidationSpecification.md.html"
:
profile picture
전문가
iwasa
답변함 2년 전
0

yes you can do it by using this command this will create a csv file with two column first is file name and the second is Object _url

*** **for /f "tokens=2 delims=/" %a in ('aws s3 ls s3://bucketName/anyfolderif/ --recursive --region ap-northeast-1 ^| findstr ".aac$"') do echo %a,https://bucketName.s3.ap-northeast-1.amazonaws.com/anyfolderif/%a >> s3_urls.csv ***** You have to set your region this is my region (ap-northeast-1)
and if it not work then you have to install AWS CLI tool, https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html After installation do aws configure in your cmd(command prompt) it ask some key and secret key pin that you go through to any youtube video After configuration use the command that I give you in the first Remember that place you bucket_name or in you bucket have any folder then place the folder name to anyfolderif or one more change you region after that You can crate a csv file if you have a million of data or a short data nothing matter it create a csv file according to data

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠