S3 input plugin without AWS credentials

I'm working on something that needs data to be transfered from s3 to Elasticsearch.So, I chose Logstash for transfering data. In the config file of logstash, I dont want to provide AWS credentials(access_key_id,secret_key). I read somewhere that through IAM roles on EC2 instance, we can get data from s3 without providing credentials. please explain more about this process.

Well according to the docs, you don't need to specify anything other than a bucket.