- Newest
- Most votes
- Most comments
Hello.
If the execution environment is EC2, you can access S3 using an IAM role.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#working-with-iam-roles
Hi. We can also use IMDS v2 on EC2 to get credential.
https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html
<Example commend>.
-
to get token.
TOKEN= 'curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds:21600"' -
to get credential from IAM role.
curl -H "X-aws-ec2-metadata-token:$TOKEN" -v http://169.254.169.254/latest/meta-data/iam/security-credentials/<IAM-role>
But IMDS2 looks like it does not support recat js.
https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/use-a-supported-sdk-version-for-imdsv2.html
Relevant content
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
i have attach IAM role to AWS which provide access to S3 ,kindly suggest me sdk or sample to code to upload files directly to S3