# Logstash S3 output plugin with AWS emulation with Localstack

**URL:** <https://discuss.elastic.co/t/logstash-s3-output-plugin-with-aws-emulation-with-localstack/255822>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [November 18, 2020, 10:54am UTC](https://discuss.elastic.co/t/logstash-s3-output-plugin-with-aws-emulation-with-localstack/255822 "2020-11-18T10:54:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abolurah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abolurah/32/68804_2.png) [@Abolurah](https://discuss.elastic.co/u/Abolurah)\
**Post date:** [November 18, 2020, 10:54am UTC](https://discuss.elastic.co/t/logstash-s3-output-plugin-with-aws-emulation-with-localstack/255822/1 "2020-11-18T10:54:58Z")

</div>

Hi All, after I spent a lot of time configuring and connecting Logstash to Localstack, I had many errors and no guide to follow .

In my case I have 2 dockers , one is logstash docker with S3 output pluging , second docker is Localstack docker that emulates the AWS services.

I will paste docker-compose.yml and logstash config files to make it easy for you to do the same and save your time.

This is the config file for logstash , some simple input line generator

VERY IMPORTANT  
Keys - must be = "test"  
add "endpoint" to S3 output plugin with port 4566 , this is the only port after Localstack update on 09.2020  
add next lines to S3 output otherwise, you will have a lot of errors

> ```
> validate_credentials_on_root_bucket => "false"
> additional_settings => { "force_path_style" => true }
> 
> ```

* * *

> ```
> input {
> generator {
> lines => [
> "line 1",
> "line 2",
> "line 3"
> ]
> # Emit all lines 3 times.
> count => 3
> }
> }
> 
> ```
> 
> output {
> 
> ```
> stdout { codec => rubydebug {metadata => true} }
> 
>   
> s3{
> access_key_id => "test"
> secret_access_key => "test"
> endpoint => "http://yourIPaddress:4566/"
> region => "us-east-1"
> bucket => "yourBucketName"   
> size_file => 2048
> time_file => 1
> codec => "json_lines"
> prefix => "addSomePrefix"
> validate_credentials_on_root_bucket => "false"
> additional_settings => { "force_path_style" => true }
> }
> 
> ```
> 
> }

* * *

Second docker-compose file for Localstack

> ```
> version: '3.5'
> services:    
> localstack:
> container_name: localstack_main
> image: localstack/localstack
> network_mode: bridge
> ports:
> - "4566:4566"
> - "4571:4571"
> - "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"       
> environment:
> - SERVICES=s3
> - DEBUG=1
> - DATA_DIR=${DATA_DIR- }
> - PORT_WEB_UI=${PORT_WEB_UI- }
> - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
> - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
> - DOCKER_HOST=unix:///var/run/docker.sock
> - HOST_TMP_FOLDER=${TMPDIR}
> volumes:
> - "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
> - "/var/run/docker.sock:/var/run/docker.sock" 
> 
> ```

* * *

Do not forget to create a manually bucket you want to use in S3  
by running from cmd

> "aws --endpoint-url=[http://localhost:4566](http://localhost:4566) s3 mb s3://yourBucketName"

I hope it will save you a lot of time.

Goodluck.

---

<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:** [December 16, 2020, 10:55am UTC](https://discuss.elastic.co/t/logstash-s3-output-plugin-with-aws-emulation-with-localstack/255822/2 "2020-12-16T10:55:00Z")

</div>

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