docs.aws.amazon.com Open in urlscan Pro
18.66.147.13  Public Scan

URL: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html
Submission: On October 22 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

SELECT YOUR COOKIE PREFERENCES

We use essential cookies and similar tools that are necessary to provide our
site and services. We use performance cookies to collect anonymous statistics so
we can understand how customers use our site and make improvements. Essential
cookies cannot be deactivated, but you can click “Customize cookies” to decline
performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide
useful site features, remember your preferences, and display relevant content,
including relevant advertising. To continue without accepting these cookies,
click “Continue without accepting.” To make more detailed choices or learn more,
click “Customize cookies.”

Accept all cookiesContinue without acceptingCustomize cookies


CUSTOMIZE COOKIE PREFERENCES

We use cookies and similar tools (collectively, "cookies") for the following
purposes.


ESSENTIAL

Essential cookies are necessary to provide our site and services and cannot be
deactivated. They are usually set in response to your actions on the site, such
as setting your privacy preferences, signing in, or filling in forms.




PERFORMANCE

Performance cookies provide anonymous statistics about how customers navigate
our site so we can improve site experience and performance. Approved third
parties may perform analytics on our behalf, but they cannot use the data for
their own purposes.

Allow performance category
Allowed


FUNCTIONAL

Functional cookies help us provide useful site features, remember your
preferences, and display relevant content. Approved third parties may set these
cookies to provide certain site features. If you do not allow these cookies,
then some or all of these services may not function properly.

Allow functional category
Allowed


ADVERTISING

Advertising cookies may be set through our site by us or our advertising
partners and help us deliver relevant marketing content. If you do not allow
these cookies, you will experience less relevant advertising.

Allow advertising category
Allowed

Blocking some types of cookies may impact your experience of our sites. You may
review and change your choices at any time by clicking Cookie preferences in the
footer of this site. We and selected third-parties use cookies or similar
technologies as specified in the AWS Cookie Notice.

CancelSave preferences




UNABLE TO SAVE COOKIE PREFERENCES

We will only store essential cookies at this time, because we were unable to
save your cookie preferences.

If you want to change your cookie preferences, try again later using the link in
the AWS console footer, or contact support if the problem persists.

Dismiss


Contact Us
English


Create an AWS Account
 1. AWS
 2. ...
    
    
 3. Documentation
 4. Amazon EC2
 5. User Guide for Linux Instances

Feedback
Preferences


AMAZON ELASTIC COMPUTE CLOUD


USER GUIDE FOR LINUX INSTANCES

 * What is Amazon EC2?
 * Set up
 * Get started tutorial
 * Best practices
 * Working with AWS SDKs
 * Tutorials
    * Install LAMP
       * Amazon Linux 2023
       * Amazon Linux 2
       * Amazon Linux
   
    * Configure SSL/TLS
       * Amazon Linux 2023
       * Amazon Linux 2
       * Amazon Linux
   
    * Host a WordPress blog
       * Amazon Linux 2023
       * Amazon Linux 2
   
    * Increase size of Amazon EBS volume
       * Step 1: Launch an instance with added volume
       * Step 2: Make the data volume available for use
       * Step 3: Increase the size of the data volume
       * Step 4: Extend the file system
       * Step 5: Clean up

 * Amazon Machine Images
    * AMI types
    * Virtualization types
    * Boot modes
       * Launch an instance
       * AMI boot mode parameter
       * Instance type boot mode
       * Instance boot mode
       * Operating system boot mode
       * Set AMI boot mode
       * UEFI variables
       * UEFI Secure Boot
          * How UEFI Secure Boot works
          * Launch an instance with UEFI Secure Boot support
          * Verify whether an instance is enabled for UEFI Secure Boot
          * Create a Linux AMI to support UEFI Secure Boot
             * Create three key pairs
             * Option A: Add keys to the variable store from within the instance
             * Option B: Create a binary blob containing a pre-filled variable
               store
         
          * How the AWS binary blob is created
   
    * Find a Linux AMI
    * Shared AMIs
       * Find shared AMIs
       * Make an AMI public
       * Share an AMI with organizations or OUs
       * Share an AMI with specific AWS accounts
       * Cancel having an AMI shared with your account
       * Use bookmarks
       * Guidelines for shared Linux AMIs
   
    * Paid AMIs
    * AMI lifecycle
       * Create an AMI
          * Create an Amazon EBS-backed Linux AMI
          * Create an instance store-backed Linux AMI
             * Set up the AMI tools
             * Create an AMI from an instance store-backed instance
             * Convert to an Amazon EBS-Backed AMI
             * AMI tools reference
      
       * Modify an AMI
       * Copy an AMI
       * Store and restore an AMI
       * Deprecate an AMI
       * Disable an AMI
       * Archive AMI snapshots
       * Deregister your AMI
       * Recover AMIs from the Recycle Bin
       * Automate the EBS-backed AMI lifecycle
   
    * Use encryption with EBS-backed AMIs
    * Monitor AMI events
    * Understand AMI billing
       * AMI billing fields
       * Find AMI billing information
       * Verify AMI charges on your bill
   
    * Amazon Linux
       * Run Amazon Linux 2 on premises
       * Kernel Live Patching
   
    * User provided kernels
    * Configure the MATE desktop connection
    * AMI quotas

 * Instances
    * Instances and AMIs
    * Instance types
       * General purpose
          * Burstable performance instances
             * Key concepts
             * Unlimited mode
                * Concepts
                * Examples
            
             * Standard mode
                * Concepts
                * Examples
            
             * Work with burstable performance instances
             * Monitor your CPU credits
      
       * Compute optimized
       * Memory optimized
       * Storage optimized
       * Accelerated computing
          * Get started with P5 instances
          * Install NVIDIA drivers
          * Install AMD drivers
          * Dual 4k on G4ad
          * Activate NVIDIA GRID Virtual Applications
          * Optimize GPU settings
      
       * Find an instance type
       * Get recommendations
       * Change the instance type
          * Compatibility
          * Troubleshoot
          * Instance store-backed instances
   
    * Mac instances
    * Instance purchasing options
       * On-Demand Instances
       * Reserved Instances
          * Regional and zonal Reserved Instances (scope)
          * Types of Reserved Instances (offering classes)
          * How Reserved Instances are applied
          * Use your Reserved Instances
          * How you are billed
          * Buy Reserved Instances
          * Sell in the Reserved Instance Marketplace
          * Modify Reserved Instances
          * Exchange Convertible Reserved Instances
          * Reserved Instance quotas
      
       * Spot Instances
          * Best practices
          * How Spot Instances work
          * Spot Instance pricing history
          * Savings
          * Work with Spot Instances
             * Example launch specifications
         
          * Spot request status
          * Rebalance recommendations
          * Spot Instance interruptions
             * Reasons for interruption
             * Interruption behavior
             * Stop
             * Hibernate
             * Terminate
             * Prepare for interruptions
             * Initiate an interruption
             * Spot Instance interruption notices
             * Find interrupted Spot Instances
             * Determine whether Amazon EC2 terminated a Spot Instance
             * Billing
         
          * Spot placement score
          * Spot Instance data feed
          * Spot Instance quotas
          * Burstable performance instances
      
       * Dedicated Hosts
          * Pricing and billing
          * Burstable T3 instances on Dedicated Hosts
          * Work with Dedicated Hosts
          * Work with shared Dedicated Hosts
          * Dedicated Hosts on AWS Outposts
          * Host recovery
          * Host maintenance
          * Track configuration changes
      
       * Dedicated Instances
          * Work with Dedicated Instances
      
       * On-Demand Capacity Reservations
          * Capacity Reservation pricing and billing
          * Work with Capacity Reservations
          * Work with Capacity Reservation groups
          * Capacity Reservations in cluster placement groups
          * Capacity Reservations in Local Zones
          * Capacity Reservations in Wavelength Zones
          * Capacity Reservations on AWS Outposts
          * Work with shared Capacity Reservations
          * Capacity Reservation Fleets
             * Capacity Reservation Fleet concepts
             * Work with Capacity Reservation Fleets
             * Example configurations
             * Using service-linked roles
         
          * Monitoring Capacity Reservations
             * CloudWatch metrics
             * EventBridge events
             * Utilization notifications
   
    * Instance lifecycle
       * Launch
          * Launch using the launch instance wizard
             * Old launch instance wizard
         
          * Launch using a launch template
             * Restrictions
             * Permissions
             * Control launching instances
             * Create
             * Modify (manage versions)
             * Delete
             * Launch instances
         
          * Launch an instance from an existing instance
          * Use an AWS Marketplace instance
      
       * Stop and start
       * Hibernate
          * Overview
          * Prerequisites
          * Limitations
          * Configure an AMI to support hibernation
          * Enable hibernation for an instance
          * Disable KASLR on an instance (Ubuntu only)
          * Hibernate an instance
          * Start a hibernated instance
          * Troubleshoot
      
       * Reboot
       * Retire
       * Terminate
       * Recover
   
    * Connect
       * Connect to your Linux instance
          * Connect with SSH from Linux or macOS
          * Connect from Windows
             * Connect with OpenSSH (Recommended)
             * Connect with PuTTY
             * Connect with WSL
         
          * Connect with EC2 Instance Connect
             * Prerequisites
             * Permissions
             * Install EC2 Instance Connect
             * Connect using EC2 Instance Connect
             * Uninstall EC2 Instance Connect
         
          * Connect with Session Manager
      
       * Connect to instances without requiring a public IPv4 address
          * Prerequisites
          * Permissions
          * Security groups
          * Create an EC2 Instance Connect Endpoint
          * Connect to an instance
          * Log connections
          * Remove EC2 Instance Connect Endpoint
          * Service-linked role
          * Quotas
      
       * Connect your instance to a resource
          * Tutorial: Connect an EC2 instance to an RDS database
             * Option 1: Automatically connect – EC2 console
                * Task 1: Create an RDS database – optional
                * Task 2: Launch an EC2 instance – optional
                * Task 3: Automatically connect your EC2 instance to your RDS
                  database
                * Task 4: Verify the connection configuration
            
             * Option 2: Automatically connect – RDS console
                * Task 1: Launch an EC2 instance – optional
                * Task 2: Create an RDS database and automatically connect it to
                  your EC2 instance
                * Task 3: Verify the connection configuration
            
             * Option 3: Manually connect (create security groups)
                * Task 1: Launch an EC2 instance – optional
                * Task 2: Create an RDS database – optional
                * Task 3: Manually connect your EC2 instance to your RDS
                  database
            
             * Clean up
   
    * Configure instances
       * Manage software
          * Update software
          * Add repositories
          * Find and install software packages
          * Prepare to compile software
      
       * Manage users
       * Processor state control
       * I/O scheduler
       * Set the time
       * Optimize CPU options
          * Rules for specifying CPU options
          * CPU cores and threads per CPU core per instance type
          * Specify CPU options for your instance
          * View the CPU options for your instance
      
       * CPU features
          * AMD SEV-SNP
             * Requirements
             * Considerations
             * Concepts and terminology
             * Working with AMD SEV-SNP
             * Attestation with AMD SEV-SNP
      
       * Change the hostname
       * Set up dynamic DNS
       * Run commands at launch
       * Instance metadata and user data
          * Use IMDSv2
             * How IMDSv2 works
             * Transition to using IMDSv2
             * Supported SDKs
         
          * Configure the instance metadata options
             * For new instances
             * For existing instances
         
          * Retrieve instance metadata
          * Work with instance user data
          * Retrieve dynamic data
          * Instance metadata categories
          * Example: AMI launch index value
          * Instance identity documents
             * Verify using the PKCS7 signature
             * Verify using the base64-encoded signature
             * Verify using the RSA-2048 signature
         
          * Instance identity roles
   
    * Amazon EI
    * Identify instances

 * Fleets
    * EC2 Fleet
       * EC2 Fleet request types
          * EC2 Fleet 'instant' type
      
       * EC2 Fleet configuration strategies
          * Plan an EC2 Fleet
          * Allocation strategies for Spot Instances
          * Attribute-based instance type selection
          * On-Demand backup
          * Capacity Rebalancing
          * Maximum price overrides
          * Control spending
          * Instance weighting
      
       * Work with EC2 Fleets
   
    * Spot Fleet
       * Spot Fleet request types
       * Spot Fleet configuration strategies
          * Plan a Spot Fleet request
          * Allocation strategies for Spot Instances
          * Attribute-based instance type selection
          * On-Demand in Spot Fleet
          * Capacity Rebalancing
          * Spot price overrides
          * Control spending
          * Instance weighting
      
       * Work with Spot Fleets
       * CloudWatch metrics for Spot Fleet
       * Automatic scaling for Spot Fleet
          * Target tracking scaling policies
          * Step scaling policies
          * Scheduled scaling
   
    * Monitor fleet events
       * EC2 Fleet event types
       * Spot Fleet event types
       * Create EventBridge rules
          * For EC2 Fleet events
          * For Spot Fleet events
   
    * Tutorials
       * Tutorial: Use EC2 Fleet with instance weighting
       * Tutorial: Use EC2 Fleet with On-Demand as the primary capacity
       * Tutorial: Launch On-Demand Instances using targeted Capacity
         Reservations
       * Tutorial: Use Spot Fleet with instance weighting
   
    * Example configurations
       * EC2 Fleet example configurations
       * Spot Fleet example configurations
   
    * Fleet quotas

 * Monitor
    * Automated and manual monitoring
    * Best practices for monitoring
    * Monitor the status of your instances
       * Instance status checks
       * State change events
       * Scheduled events
          * Define event windows for scheduled events
   
    * Monitor your instances using CloudWatch
       * Enable detailed monitoring
       * List available metrics
       * Get statistics for metrics
          * Get statistics for a specific instance
          * Aggregate statistics across instances
          * Aggregate statistics by Auto Scaling group
          * Aggregate statistics by AMI
      
       * Graph metrics
       * Create an alarm
       * Create alarms that stop, terminate, reboot, or recover an instance
   
    * Automate using EventBridge
    * Monitor memory and disk metrics
       * Deprecated: Collect metrics using the CloudWatch monitoring scripts
   
    * Log API calls with AWS CloudTrail

 * Networking
    * Regions and Zones
    * Instance IP addressing
       * Multiple IP addresses
   
    * Instance hostname types
    * Bring your own IP addresses
    * Elastic IP addresses
    * Network interfaces
       * Best practices for configuring network interfaces
       * Scenarios for network interfaces
       * Requester-managed network interfaces
       * Assign prefixes
          * Work with prefixes
   
    * Network bandwidth
    * Enhanced networking
       * Elastic Network Adapter (ENA)
       * ENA Express
       * Intel 82599 VF
       * Operating system optimizations
       * Network performance metrics
       * Troubleshoot ENA
       * Improve network latency on Linux instances
   
    * Elastic Fabric Adapter
       * Get started with P5 instances and EFA
       * Get started with EFA and MPI
       * Get started with EFA and NCCL
          * Use a base AMI
          * Use an AWS Deep Learning AMI
      
       * Work with EFA
       * Monitor an EFA
       * Verify the EFA installer using a checksum
   
    * Placement groups
       * Share a placement group
       * Placement groups on AWS Outposts
   
    * Network MTU
    * Virtual private clouds

 * Code examples
    * Actions
       * Add tags to resources
       * Allocate an Elastic IP address
       * Associate an Elastic IP address with an instance
       * Create a Amazon Virtual Private Cloud (Amazon VPC)
       * Create a launch template
       * Create a route table
       * Create a security group
       * Create a security key pair
       * Create a subnet
       * Create and run an instance
       * Delete a launch template
       * Delete a security group
       * Delete a security key pair
       * Delete a snapshot
       * Describe Availability Zones
       * Describe Regions
       * Describe instance status
       * Describe instances
       * Describe snapshots
       * Disable detailed monitoring
       * Disassociate an Elastic IP address from an instance
       * Enable monitoring
       * Get data about Amazon Machine Images
       * Get data about a security group
       * Get data about instance types
       * Get data about the instance profile associated with an instance
       * Get details about Elastic IP addresses
       * Get the default VPC
       * Get the default subnets for a VPC
       * List security key pairs
       * Reboot an instance
       * Release an Elastic IP address
       * Replace the instance profile associated with an instance
       * Set inbound rules for a security group
       * Start an instance
       * Stop an instance
       * Terminate an instance
   
    * Scenarios
       * Build and manage a resilient service
       * Get started with instances

 * Security
    * Infrastructure security
    * Resilience
    * Data protection
    * Identity and access management
       * IAM policies
          * Policy structure
          * Tag resources during creation
          * Control access to EC2 resources using resource tags
          * Example policies for CLI or SDK
          * Example policies for the console
      
       * AWS managed policies
       * IAM roles
       * Network access
   
    * Key pairs
       * Create key pairs
       * Tag a public key
       * Describe public keys
       * Delete a public key
       * Add or remove a public key on your instance
       * Verify the fingerprint
   
    * Security groups
       * Security group rules
       * Connection tracking
       * Default and custom security groups
       * Work with security groups
       * Security group rules for different use cases
   
    * AWS PrivateLink
    * Update management
    * Compliance validation
    * NitroTPM
       * Considerations
       * Prerequisites
       * Create a Linux AMI for NitroTPM support
       * Verify whether an AMI is enabled for NitroTPM
       * Enable or stop using NitroTPM on an instance

 * Storage
    * Amazon EBS
       * EBS volumes
          * EBS volume types
             * General Purpose SSD volumes
             * Provisioned IOPS SSD volumes
             * Throughput Optimized HDD and Cold HDD volumes
         
          * Size and configuration constraints
          * Create a volume
          * Attach a volume to an instance
          * Attach a volume to multiple instances
             * NVMe reservations
         
          * Make a volume available for use
          * View volume details
          * Replace a volume
          * Replace a root volume
          * Monitor the status of your volumes
          * Detach a volume from an instance
          * Delete a volume
          * Fault testing
      
       * EBS snapshots
          * Create snapshots
          * Delete a snapshot
          * Copy a snapshot
          * Archive snapshots
             * Guidelines and best practices for archiving snapshots
             * Required IAM permissions
             * Work with snapshot archiving
             * Monitor snapshot archiving
         
          * View snapshot information
          * Share a snapshot
          * Recover snapshots from the Recycle Bin
          * Local snapshots on Outposts
          * Amazon EBS direct APIs
             * IAM permissions for EBS direct APIs
             * Use EBS direct APIs
                * Read snapshots
                * Write snapshots
                * Use encryption
                * Use Signature Version 4 signing
                * Use checksums
                * Idempotency for StartSnapshot API
                * Error retries
                * Optimize performance
                * EBS direct APIs service endpoints
            
             * Interface VPC endpoints
             * Log API calls with AWS CloudTrail
             * Frequently asked questions
         
          * Automate the snapshot lifecycle
      
       * Amazon Data Lifecycle Manager
          * Automate snapshot lifecycles
          * Automate AMI lifecycles
          * Automate cross-account snapshot copies
          * View, modify, and delete lifecycle policies
          * AWS Identity and Access Management
             * AWS managed policies
             * IAM service roles
             * Permissions for users
             * Permissions for encryption
         
          * Monitor the lifecycle of snapshots and AMIs
             * Monitor your policies using CloudWatch Events
             * Monitor your policies using Amazon CloudWatch
      
       * EBS data services
          * Elastic volumes
             * Requirements
             * Request volume modifications
             * Monitor modifications
             * Extend a file system
         
          * EBS encryption
          * Fast snapshot restore
      
       * EBS volumes and NVMe
       * EBS optimization
       * EBS performance
          * I/O characteristics and monitoring
          * Initialize volumes
          * RAID configuration
          * Benchmark EBS volumes
      
       * EBS CloudWatch metrics
       * EBS EventBridge events
       * EBS quotas
   
    * Instance store
       * Instance store volumes
       * Add instance store volumes
       * SSD instance store volumes
       * Instance store swap volumes
       * Optimize disk performance
   
    * File storage
       * Amazon S3
       * Amazon EFS
       * Amazon FSx
   
    * Instance volume limits
    * Root device volume
    * Device names
    * Block device mappings
    * Torn write prevention

 * Resources and tags
    * Recycle Bin
       * Considerations
       * Required IAM permissions
          * Condition keys for Recycle Bin
      
       * Work with retention rules
       * Work with resources in the Recycle Bin
       * Monitor Recycle Bin
          * Monitor using EventBridge
          * Monitor using CloudTrail
   
    * Resource locations
    * Resource IDs
    * List and filter your resources
    * Global View
    * Tag your resources
    * Service quotas
    * Usage reports

 * Troubleshoot
    * Troubleshoot launch issues
    * Connect to your instance
    * Stop your instance
    * Terminate your instance
    * Failed status checks
    * Troubleshoot an unreachable instance
    * Boot from the wrong volume
    * EC2Rescue for Linux
       * Install EC2Rescue for Linux
       * (Optional) Verify the signature of EC2Rescue for Linux
       * Work with EC2Rescue for Linux
       * Develop EC2Rescue modules
   
    * EC2 Serial Console
       * Prerequisites
       * Configure access to the EC2 Serial Console
       * Connect to the EC2 Serial Console
       * Disconnect from the EC2 Serial Console
       * Troubleshoot your instance using the EC2 Serial Console
          * Troubleshoot your Linux instance using GRUB
          * Troubleshoot your Linux instance using SysRq
   
    * Send a diagnostic interrupt

 * Related information
 * Document history

Use IMDSv2 - Amazon Elastic Compute Cloud
AWSDocumentationAmazon EC2User Guide for Linux Instances


USE IMDSV2

PDFRSS

You can access instance metadata from a running instance using one of the
following methods:

 * Instance Metadata Service Version 1 (IMDSv1) – a request/response method

 * Instance Metadata Service Version 2 (IMDSv2) – a session-oriented method

By default, you can use either IMDSv1 or IMDSv2, or both.

You can configure the Instance Metadata Service (IMDS) on each instance so that
local code or users must use IMDSv2. When you specify that IMDSv2 must be used,
IMDSv1 no longer works. For information about how to configure your instance to
use IMDSv2, see Configure the instance metadata options.

The PUT or GET headers are unique to IMDSv2. If these headers are present in the
request, then the request is intended for IMDSv2. If no headers are present, it
is assumed the request is intended for IMDSv1.

For an extensive review of IMDSv2, see Add defense in depth against open
firewalls, reverse proxies, and SSRF vulnerabilities with enhancements to the
EC2 Instance Metadata Service.

To retrieve instance metadata, see Retrieve instance metadata.

TOPICS

 * How Instance Metadata Service Version 2 works
 * Transition to using Instance Metadata Service Version 2
 * Use a supported AWS SDK

Javascript is disabled or is unavailable in your browser.

To use the Amazon Web Services Documentation, Javascript must be enabled. Please
refer to your browser's Help pages for instructions.

Document Conventions
Instance metadata and user data
How IMDSv2 works
Did this page help you? - Yes

Thanks for letting us know we're doing a good job!

If you've got a moment, please tell us what we did right so we can do more of
it.



Did this page help you? - No

Thanks for letting us know this page needs work. We're sorry we let you down.

If you've got a moment, please tell us how we can make the documentation better.





DID THIS PAGE HELP YOU?

Yes
No
Provide feedback

NEXT TOPIC:

How IMDSv2 works

PREVIOUS TOPIC:

Instance metadata and user data

NEED HELP?

 * Try AWS re:Post 
 * Connect with an AWS IQ expert 

PrivacySite termsCookie preferences
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.


ON THIS PAGE










DID THIS PAGE HELP YOU? - NO



Thanks for letting us know this page needs work. We're sorry we let you down.

If you've got a moment, please tell us how we can make the documentation better.




Feedback