This script is used to get access key, secret key and session token from role attached to an instance.
Make sure you have AWS CLI and JQ package installed before. Steps for installation of AWS CLI can be found here
For Redhat/Centos distributon JQ can be installed using yum install jq
and for Debian apt-get install jq
.
./ec2-instance-metadata.sh