# Logstash to s3 dynamic bucket

**URL:** <https://discuss.elastic.co/t/logstash-to-s3-dynamic-bucket/235072>\
**Category:** Logstash\
**Created:** [May 31, 2020, 3:11pm UTC](https://discuss.elastic.co/t/logstash-to-s3-dynamic-bucket/235072 "2020-05-31T15:11:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mctj](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@mctj](https://discuss.elastic.co/u/mctj)\
**Post date:** [May 31, 2020, 3:11pm UTC](https://discuss.elastic.co/t/logstash-to-s3-dynamic-bucket/235072/1 "2020-05-31T15:11:14Z")

</div>

Hey,  
I'm trying to upload data from logstash to s3. I couldnt find any way to use a dynamic bucket name. In my json input I'm getting a key that is called bucket\_name and I would like to use that as the destination bucket in s3.

I saw [this issue](https://github.com/logstash-plugins/logstash-output-s3/issues/168) that was opened 2 years ago and I wanted to know if there is some kind of solution to it..

```
My output :  
output {
  s3 {
    bucket => "%{bucket_name}"
    codec => "line"
    prefix => "%{+YYYY.MM.dd}}"
    temporary_directory => "/etc/logstash/s3"
  }
}

```

If I try to add the bucket\_name variable into the prefix and use a hard\_coded bucket\_name everything works...  
When the bucket\_name is dynamic I'm getting the following error :  
` Error validating bucket write permissions! {:message=>"The specified bucket is not valid.", :class=>"Aws::S3::Errors::InvalidBucketName",`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 28, 2020, 3:11pm UTC](https://discuss.elastic.co/t/logstash-to-s3-dynamic-bucket/235072/2 "2020-06-28T15:11:17Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
