# Logstash s3 input with iam role

**URL:** <https://discuss.elastic.co/t/logstash-s3-input-with-iam-role/97986>\
**Category:** Logstash\
**Created:** [August 22, 2017, 10:36pm UTC](https://discuss.elastic.co/t/logstash-s3-input-with-iam-role/97986 "2017-08-22T22:36:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [August 22, 2017, 10:36pm UTC](https://discuss.elastic.co/t/logstash-s3-input-with-iam-role/97986/1 "2017-08-22T22:36:19Z")

</div>

Hi ,

I am trying to use logstash s3 input plugin to process cloudtrail data. My configuration is all OK but as i am running this logstash on prem, my access to s3 bucket is via a IAM role. I cannot get access and secret keys as my org. does not allow the use of that.

Is there a way anyone knows about to process this data using an IAM role.

I have configure my CLI and i can access things via command line.

--  
Niraj

---

<div class="post-metadata">

**Author:** ![Tito](https://avatars.discourse-cdn.com/v4/letter/t/dfb087/32.png) [@Tito](https://discuss.elastic.co/u/Tito)\
**Post date:** [August 23, 2017, 8:26am UTC](https://discuss.elastic.co/t/logstash-s3-input-with-iam-role/97986/2 "2017-08-23T08:26:22Z")

</div>

Hello,

I also granted S3 bucket access via IAM role. My logstash input looks like:

input  
{  
s3  
{  
bucket =\> "name\_of\_bucket"  
prefix =\> "logs/"  
interval =\> 60  
region =\> "ap-southeast-2"  
type =\> "input\_type"  
}  
}

and it's working, so without providing access and secret keys.

regards,  
Lukasz

---

<div class="post-metadata">

**Author:** ![Tito](https://avatars.discourse-cdn.com/v4/letter/t/dfb087/32.png) [@Tito](https://discuss.elastic.co/u/Tito)\
**Post date:** [August 23, 2017, 8:32am UTC](https://discuss.elastic.co/t/logstash-s3-input-with-iam-role/97986/3 "2017-08-23T08:32:13Z")

</div>

Hello,

and the IAM role looks like:

Show Policy  
{  
"Version": "2012-10-17",  
"Statement": [  
{  
"Sid": "---",  
"Effect": "Allow",  
"Action": ["s3:ListBucket"],  
"Resource": ["arn:aws:s3:::name\_of\_the\_bucket"]  
},  
{  
"Effect": "Allow",  
"Action": [  
"s3:PutObject",  
"s3:GetObject",  
"s3:DeleteObject"  
],  
"Resource": ["arn:aws:s3:::name\_of\_the\_bucket/\*"]  
}  
]  
}

regards,  
Lukasz

---

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [August 23, 2017, 4:37pm UTC](https://discuss.elastic.co/t/logstash-s3-input-with-iam-role/97986/4 "2017-08-23T16:37:09Z")

</div>

@Tito What you are running is on an EC2 instance i believe. I am on-prem instances where i cannot attach IAM roles. I wrote a self script to flush environment variables. But was just curious if there is a way or trick out there to help achieve this scenario.

--  
Niraj

---

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [August 24, 2017, 10:38pm UTC](https://discuss.elastic.co/t/logstash-s3-input-with-iam-role/97986/5 "2017-08-24T22:38:19Z")

</div>

Seems like if you have set an ENV variable and try to reflush it using a script while the logstash is ingesting. Logstash will never find this change and will stop ingesting because the credentials expires after an hour. I am kind of blocked as my IT does not ever allow the usage of access keys. 😑

--  
Niraj

---

<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:** [September 21, 2017, 10:38pm UTC](https://discuss.elastic.co/t/logstash-s3-input-with-iam-role/97986/6 "2017-09-21T22:38:23Z")

</div>

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