diff --git a/pkg/server/setup.go b/pkg/server/setup.go index f28d5e7..ef01e3c 100644 --- a/pkg/server/setup.go +++ b/pkg/server/setup.go @@ -79,13 +79,15 @@ func (s *Server) Setup() error { }) } - if _, err := s.PutBucketLifecycleConfiguration(&s3.PutBucketLifecycleConfigurationInput{ - Bucket: aws.String(s.Config.Bucket), - LifecycleConfiguration: &s3.BucketLifecycleConfiguration{ - Rules: lcRules, - }, - }); err != nil { - return fmt.Errorf("failed to set bucket %s's lifecycle rules: %w", s.Config.Bucket, err) + if len(lcRules) > 0 { + if _, err := s.PutBucketLifecycleConfiguration(&s3.PutBucketLifecycleConfigurationInput{ + Bucket: aws.String(s.Config.Bucket), + LifecycleConfiguration: &s3.BucketLifecycleConfiguration{ + Rules: lcRules, + }, + }); err != nil { + return fmt.Errorf("failed to set bucket %s's lifecycle rules: %w", s.Config.Bucket, err) + } } // lc, err := svc.GetBucketLifecycleConfiguration(&s3.GetBucketLifecycleConfigurationInput{