- Newest
- Most votes
- Most comments
Hello.
If you are using Windows Server on EC2, you can check the metadata by running the following command in PowerShell.
This command supports IMDSv2.
Invoke-RestMethod -Headers @{"X-aws-ec2-metadata-token" = $token} -Method GET -Uri http://169.254.169.254/latest/meta-data/
By the way, if you are using a proxy with EC2, please configure it to exclude "169.254.169.254".
If you don't configure this, you won't be able to check the metadata.
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-proxy.html#cli-configure-proxy-ec2
If you configure a proxy on an Amazon EC2 instance launched with an attached IAM role, ensure that you exempt the address used to access the instance metadata. To do this, set the NO_PROXY environment variable to the IP address of the instance metadata service, 169.254.169.254. This address does not vary.
EC2 instance metadata is automatically created and available for all EC2 instances, including Windows instances. You don't need to manually create it - it's a built-in service that runs on every EC2 instance and provides data about your instance.
However, you can configure the Instance Metadata Service (IMDS) options for your Windows instances. Here are the key configuration options available:
Metadata Version: You can choose between IMDSv1 and IMDSv2. IMDSv2 is recommended for security and is the default for newer instance types. Note that if you're using a PowerShell version earlier than 4.0 on Windows, you'll need to update to Windows Management Framework 4.0 to use IMDSv2.
Enable or Disable Access: You can turn instance metadata access on or off, though disabling it may prevent applications or agents that rely on metadata from functioning properly.
IPv6 Endpoint: You can enable the IPv6 endpoint for instance metadata if your instance is launched in a subnet that supports IPv6.
Tags in Metadata: By default, instance tags are not accessible through instance metadata. You can explicitly enable access to tags in the metadata if needed.
You can configure these options at different levels:
- At the account level to set defaults for all new instances
- At the AMI level when registering or modifying an image
- At launch time when creating a new instance through the advanced details section
- After launch by modifying the instance metadata settings
To access instance metadata from within your Windows instance, you can use PowerShell or other tools to query the metadata endpoint.
Sources
Configure instance metadata options for new instances - Amazon Elastic Compute Cloud
Use instance metadata to manage your EC2 instance - Amazon Elastic Compute Cloud
Configure the Instance Metadata Service options - Amazon Elastic Compute Cloud
Relevant content
- AWS OFFICIALUpdated 10 months ago
