EC2 metadata credentials code example
Example: retrieving credentials ec2 instance metadata
$ curl http://169.254.169.254/latest/meta-data/iam/security-credentials/s3access
$ curl http://169.254.169.254/latest/meta-data/iam/security-credentials/s3access