I am getting 401 - Unauthorized when I hit meta-data API

2

Hello Team,

I am new to AWS, I have created an EC2 instance and trying to use the meta-data API from the EC2 instance and getting the below error. I checked the server time, and rebooted the instance as suggested in the forums. Not sure What I am doing wrong. Any help would be appreciated thanks!

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>401 - Unauthorized</title>
 </head>
 <body>
  <h1>401 - Unauthorized</h1>
 </body>
</html>
質問済み 1年前14563ビュー
3回答
3
承認された回答

Could be that your instance is using V2 of the meta data service. Take a look here to see how to obtain a token and pass it with the query.

Add defense in depth against open firewalls, reverse proxies, and SSRF vulnerabilities with enhancements to the EC2 Instance Metadata Service.

profile pictureAWS
エキスパート
kentrad
回答済み 1年前
profile picture
エキスパート
レビュー済み 1ヶ月前
0
profile picture
エキスパート
回答済み 1年前
0

The following section provides a short explanation for each response: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html#instance-metadata-returns

For example:

  • 401 - Unauthorized – The GET request uses an invalid token. The recommended action is to generate a new token.
AWS
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ