Tagging multiple prefixes within an S3 bucket for lifecycle rule application.

0

Hi, I wanted to find out what the easiest way for me to be able to apply lifecycle rules a large subset of prefixes within my S3 bucket but still being able to use other lifecycle rules (with longer transition/expiration settings) to a smaller subset of prefixes.

One way I have thought this may be possible is to tag all of the prefixes that will have the larger blanket lifecycle rule applied to them however I wanted to find out how I may go about tagging these prefixes. It's worth noting that all of these prefixes would have 1000s of objects within them.

A follow up question - Even if it possible to tag by prefix, will new objects created with that prefix automatically have the tag applied to them or will this tagging process need to be carried out frequently.

Thanks!

  • Is the smaller set of prefixes a subset of the larger set? As in you want a different lifecycle rule for objects with the prefix example/ and another for objects with the prefix example/smaller/. Just want to make sure I understand the ask.

1개 답변
0

Unfortunately, I don't think tags can be set for S3 prefixes.
Set tags on the object instead.

Tags can be set on the object either at upload time or after upload.
If done with AWS CLI, it will look like this.

aws s3api put-object --bucket example-bucket --body test.txt --key test/key --tagging Key1=Value1
profile picture
전문가
답변함 일 년 전

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

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

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

관련 콘텐츠