{"id":13647364,"url":"https://github.com/adamchainz/ec2-metadata","last_synced_at":"2025-12-29T23:41:06.261Z","repository":{"id":21929047,"uuid":"94463832","full_name":"adamchainz/ec2-metadata","owner":"adamchainz","description":"An easy interface to query the EC2 metadata API, with caching.","archived":false,"fork":false,"pushed_at":"2025-04-11T15:12:57.000Z","size":1086,"stargazers_count":113,"open_issues_count":3,"forks_count":31,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-11T16:27:57.647Z","etag":null,"topics":["aws","ec2","ec2-instance","ec2-instance-metadata"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adamchainz.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"tidelift":"pypi/ec2-metadata","custom":["https://adamj.eu/books/"]}},"created_at":"2017-06-15T17:38:32.000Z","updated_at":"2025-04-11T15:13:00.000Z","dependencies_parsed_at":"2023-10-14T14:04:32.870Z","dependency_job_id":"11e4e584-6bda-4892-84e2-44e93dd87f37","html_url":"https://github.com/adamchainz/ec2-metadata","commit_stats":{"total_commits":460,"total_committers":16,"mean_commits":28.75,"dds":"0.17391304347826086","last_synced_commit":"32ef2ba68bb24cfb6ca5b07478b4279c79226628"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamchainz%2Fec2-metadata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamchainz%2Fec2-metadata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamchainz%2Fec2-metadata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamchainz%2Fec2-metadata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamchainz","download_url":"https://codeload.github.com/adamchainz/ec2-metadata/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250163643,"owners_count":21385278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","ec2","ec2-instance","ec2-instance-metadata"],"created_at":"2024-08-02T01:03:31.340Z","updated_at":"2025-12-29T23:41:06.255Z","avatar_url":"https://github.com/adamchainz.png","language":"Python","funding_links":["https://tidelift.com/funding/github/pypi/ec2-metadata","https://adamj.eu/books/"],"categories":["Python"],"sub_categories":[],"readme":"============\nec2-metadata\n============\n\n.. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/ec2-metadata/main.yml.svg?branch=main\u0026style=for-the-badge\n   :target: https://github.com/adamchainz/ec2-metadata/actions?workflow=CI\n\n.. image:: https://img.shields.io/badge/Coverage-100%25-success?style=for-the-badge\n   :target: https://github.com/adamchainz/ec2-metadata/actions?workflow=CI\n\n.. image:: https://img.shields.io/pypi/v/ec2-metadata.svg?style=for-the-badge\n   :target: https://pypi.org/project/ec2-metadata/\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge\n   :target: https://github.com/psf/black\n\n.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white\u0026style=for-the-badge\n   :target: https://github.com/pre-commit/pre-commit\n   :alt: pre-commit\n\nAn easy interface to query the EC2 metadata API (version 2), with caching.\n\nA quick example:\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e from ec2_metadata import ec2_metadata\n    \u003e\u003e\u003e print(ec2_metadata.region)\n    us-east-1\n    \u003e\u003e\u003e print(ec2_metadata.instance_id)\n    i-123456\n\n----\n\n**Working on a Django project?**\nImprove your skills with `one of my books \u003chttps://adamj.eu/books/\u003e`__.\n\n----\n\nInstallation\n============\n\nUse **pip**:\n\n.. code-block:: sh\n\n    python -m pip install ec2-metadata\n\nPython 3.10 to 3.14 supported.\n\nWhy?\n====\n\n``boto`` came with a utility function to retrieve the instance metadata as a lazy loading dictionary, ``boto.utils.get_instance_metadata``, but this has not been ported to ``boto3``, as per `this issue \u003chttps://github.com/boto/boto3/issues/313\u003e`_.\nI thought that rather than building a new version inside ``boto3`` it would work well as a standalone library.\n\nInstance Metadata Service Version 2\n===================================\n\nIn November 2019, AWS released `version 2 \u003chttps://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/\u003e`__ of the instance metadata service.\nIt's more secure against Server Side Request Forgery (SSRF) attacks.\n\n``ec2-metadata`` now uses it exclusively.\nSo, you may consider disabling version 1, as per `AWS' guide \u003chttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html#instance-metadata-transition-to-version-2\u003e`__.\n\n**Note:** Instance Metadata Service v2 has a default IP hop limit of 1.\nThis can mean that you can see ``requests.exceptions.ReadTimeout`` errors from within Docker containers.\nTo solve this, reconfigure your EC2 instance’s metadata options to allow three hops with |aws ec2 modify-instance-metadata-options|__:\n\n.. |aws ec2 modify-instance-metadata-options| replace:: ``aws ec2 modify-instance-metadata-options``\n__ https://docs.aws.amazon.com/cli/latest/reference/ec2/modify-instance-metadata-options.html\n\n.. code-block:: bash\n\n    aws ec2 modify-instance-metadata-options  --instance-id \u003cinstance-id\u003e --http-put-response-hop-limit 3\n\nAPI\n===\n\n``EC2Metadata(session=None)``\n-----------------------------\n\nA container that represents the data available on the EC2 metadata service.\nAttributes don't entirely correspond to the paths in the metadata service—they have been 'cleaned up'.\nYou may also want to refer to the `metadata service docs \u003chttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html\u003e`_ to understand the exact contents.\n\nThere's a singleton instance of it at the name ``ec2_metadata`` which should cover most use cases.\nUse it like:\n\n.. code-block:: python\n\n    from ec2_metadata import ec2_metadata\n\n    ec2_metadata.region\n\nThe ``session`` argument, if provided, should be an instance of |requests.Session|__, allowing you to customize the way requests are made.\n\n.. |requests.Session| replace:: ``requests.Session``\n__ https://docs.python-requests.org/en/latest/user/advanced/\n\nMost of the attributes are cached, except where noted below.\nThis is because they are mostly immutable, or at least require an instance stop to change.\nHowever some cached attributes do represent things that can change without an instance stop, but rarely do, such as network devices.\n\nThe caching is done with |@cached_property|__, so they cache on first access.\nIf you want to clear the cache of one attribute you can just `del` it:\n\n.. |@cached_property| replace:: ``@cached_property``\n__ https://docs.python.org/3/library/functools.html#functools.cached_property\n\n.. code-block:: python\n\n    del ec2_metadata.network_interfaces\n\nTo clear all, use the ``clear_all()`` method as per below.\n\n``account_id: str``\n~~~~~~~~~~~~~~~~~~~\n\nThe current AWS account ID, for example ``'123456789012'``.\n\n``ami_id: str``\n~~~~~~~~~~~~~~~\n\nThe ID of the AMI used to launch the instance, for example ``'ami-123456'``.\n\n``autoscaling_target_lifecycle_state: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n**Uncached.**\n\nThe target Auto Scaling lifecycle state that the instance is transitionioning to, or ``None`` if the instance is not in an autoscaling group.\nSee AWS docs page `Retrieve the target lifecycle state through instance metadata \u003chttps://docs.aws.amazon.com/autoscaling/ec2/userguide/retrieving-target-lifecycle-state-through-imds.html\u003e`__.\n\n``availability_zone: str``\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe name of the current AZ, for example ``'eu-west-1a'``.\n\n``availability_zone_id: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe unique, cross-account ID of the current AZ, for example ``'use1-az6'``.\nSee AWS docs page `AZ IDs for your AWS resources \u003chttps://docs.aws.amazon.com/ram/latest/userguide/working-with-az-ids.html\u003e`__.\n\n``ami_launch_index: int``\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe index of the instance in the launch request, zero-based, for example ``0``.\n\n``ami_manifest_path: str``\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe path to the AMI manifest file in Amazon S3, or ``'(unknown)'`` on EBS-backed AMI's.\n\n``clear_all() -\u003e None``\n~~~~~~~~~~~~~~~~~~~~~~~\n\nClear all the cached attributes on the class, meaning their next access will re-fetch the data from the metadata API.\nThis includes clearing the token used to authenticate with the service.\n\n``domain: str``\n~~~~~~~~~~~~~~~\n\nThe domain for AWS resources for the region.\nFor example: ``'amazonaws.com'`` for the standard AWS regions and GovCloud (US), or ``'amazonaws.com.cn'`` for China.\n\n``iam_info: IamInfoDict | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA dictionary of data for the IAM role attached to the instance, or ``None`` if no role is attached.\nThe dict has this type, based on what the metadata service returns:\n\n.. code-block:: python\n\n    class IamInfoDict(TypedDict):\n        InstanceProfileArn: str\n        InstanceProfileId: str\n        LastUpdated: str\n\n``iam_security_credentials: IamSecurityCredentialsDict | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA dictionary of data for the security credentials associated with the IAM role attached to the instance, or ``None`` if no role is attached.\nSee the `AWS docs section “Retrieve security credentials from instance metadata” \u003chttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#instance-metadata-security-credentials\u003e`__ for details.\nThe dict has this type, based on that document:\n\n.. code-block:: python\n\n    class IamSecurityCredentialsDict(TypedDict):\n        LastUpdated: str\n        Type: str\n        AccessKeyId: str\n        SecretAccessKey: str\n        Token: str\n        Expiration: str\n\n``instance_action: str``\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n**Uncached.**\n\nA state that notifies if the instance will reboot in preparation for bundling.\nSee the `AWS docs section “Instance Metadata Categories” \u003chttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-categories.html\u003e`_ for the valid values.\n\n``instance_id: str``\n~~~~~~~~~~~~~~~~~~~~\n\nThe current instance's ID, for example ``'i-123456'``.\n\n``instance_identity_document: InstanceIdentityDocumentDict``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA dictionary of dynamic data about the instance.\nSee the `AWS docs page “Instance Identity Documents” \u003chttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html\u003e`__ for an explanation of the contents.\nThe dict has this type, based on that document:\n\n.. code-block:: python\n\n    class InstanceIdentityDocumentDict(TypedDict):\n        accountId: str\n        architecture: Literal[\"i386\", \"x86_64\", \"arm64\"]\n        availabilityZone: str\n        billingProducts: list[str] | None\n        marketplaceProductCodes: list[str] | None\n        imageId: str\n        instanceId: str\n        instanceType: str\n        kernelId: str | None\n        pendingTime: str\n        privateIp: str\n        ramdiskId: str | None\n        region: str\n        version: str\n\n``instance_life_cycle: str``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe purchasing option of this instance, for example ``'on-demand'``.\n\n``instance_profile_arn: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe ARN of the IAM role/instance profile attached to the instance, taken from ``iam_info``, or ``None`` if no role is attached.\n\n``instance_profile_id: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe ID of the IAM role/instance profile attached to the instance, taken from ``iam_info``, or ``None`` if no role is attached.\n\n\n``instance_profile_name: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe instance profile name, extracted from ``instance_profile_arn``, or ``None`` if no role is attached.\n\n``instance_type: str``\n~~~~~~~~~~~~~~~~~~~~~~\n\nThe current instance's type, for example ``'t2.nano'``.\n\n``kernel_id: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe current instance's kernel ID, or ``None`` if it doesn't have one, for example ``'aki-dc9ed9af'``.\n\n``mac : str``\n~~~~~~~~~~~~~\n\nThe instance's MAC address, for example ``'0a:d2:ae:4d:f3:12'``.\n\n``network_interfaces: dict[str, NetworkInterface]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA dictionary of mac address to ``NetworkInterface``, which represents the data available on a network interface, documented below.\nFor example: ``{'01:23:45:67:89:ab': NetworkInterface('01:23:45:67:89:ab')}``\n\n``partition: str``\n~~~~~~~~~~~~~~~~~~\n\nThe AWS partition where the instance is running.\nFor example: ``'aws'`` for the standard AWS regions, ``'aws-us-gov'`` for GovCloud (US), or ``'aws-cn'`` for China.\n\n``private_hostname : str``\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe private IPv4 DNS hostname of the instance, for example ``'ip-172-30-0-0.eu-west-1.compute.internal'`` .\n\n``private_ipv4: str``\n~~~~~~~~~~~~~~~~~~~~~\n\nThe private IPv4 of the instance, for example ``'172.30.0.0'``.\n\n``public_hostname : str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe public DNS hostname of the instance, or ``None`` if the instance is not public.\nFor example: ``'ec2-1-2-3-4.compute-1.amazonaws.com'``.\n\n``public_ipv4: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe public IPv4 address of the instance, or ``None`` if the instance is not public.\nFor example: ``'1.2.3.4'``.\n\n``public_keys: dict[str, PublicKey]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA dictionary of key name to ``PublicKey``, which represents data available on an SSH public key, documented below.\nThese keys represent the SSH keys authorized to log into the instance when it was created.\nFor example: ``{'somekey': PublicKey(0)}``\nIf no public keys are available, this will be an empty dictionary.\n\n``region: str``\n~~~~~~~~~~~~~~~\n\nThe region the instance is running in, for example ``'eu-west-1'``.\n\n``reservation_id: str``\n~~~~~~~~~~~~~~~~~~~~~~~\n\nThe ID of the reservation used to launch the instance, for example ``'r-12345678901234567'``.\n\n``security_groups : list[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nList of security groups by name, for example ``['ssh-access', 'custom-sg-1']``.\n\n``spot_instance_action: SpotInstanceAction | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n**Uncached.**\n\nAn object describing an action about to happen to this spot instance.\nReturns ``None`` if the instance is not spot, or not marked for termination.\n\nThe ``SpotInstanceAction`` object has two attributes:\n\n* ``action: str`` - the action about to happen, one of ``\"hibernate\"``, ``\"stop\"``, or ``\"terminate\"``.\n* ``time: datetime`` - the approximate UTC datetime when the action will occur.\n\nSee `AWS docs section \u003chttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-instance-termination-notices.html#instance-action-metadata\u003e`__ for a little more information.\n\n``tags: InstanceTags``\n~~~~~~~~~~~~~~~~~~~~~~\n\nA dict-like mapping of the tags for the instance (documented below).\nThis requires you to `explicitly enable the feature \u003chttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#allow-access-to-tags-in-IMDS\u003e`__ for the instance.\nIf the feature is not enabled, accessing this attribute raises an error.\n\n(It also seems that there is a bug where if the feature is enabled and then disabled, the metadata service returns an empty response.\nThis is indistinguishable from “no tags”, so beware that in that case, ``InstanceTags`` will just look like an empty mapping.)\n\n``user_data: bytes | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe raw user data assigned to the instance (not base64 encoded), or ``None`` if there is none.\n\n``InstanceTags``\n----------------\n\nA dict-like mapping of tag names to values (both ``str``\\s).\nTo avoid unnecessary requests, the mapping is lazy: values are only fetched when required.\n(Names are known on construction though, from the first request in ``EC2Metadata.tags``.)\n\nThe metadata service will receive tag updates on some instance types, as per `the AWS documentation \u003chttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#work-with-tags-in-IMDS\u003e`__:\n\n    If you add or remove an instance tag, the instance metadata is updated while the instance is running for instances built on the Nitro System, without needing to stop and then start the instance.\n    For all other instances, to update the tags in the instance metadata, you must stop and then start the instance.\n\nBecause ``InstanceTags`` is cached, it won’t reflect such updates on Nitro instances unless you clear it first:\n\n.. code-block:: python\n\n    del ec2_metadata.tags\n    ec2_metadata.tags[\"Name\"]  # fresh\n\n``NetworkInterface``\n--------------------\n\nRepresents a single network interface, as retrieved from ``EC2Metadata.network_interfaces``.\nAgain like ``EC2Metadata`` all its attributes cache on first access, and can be cleared with ``del`` or its ``clear_all()`` method.\n\n``device_number: int``\n~~~~~~~~~~~~~~~~~~~~~~\n\nThe unique device number associated with that interface, for example ``0``.\n\n``interface_id: str``\n~~~~~~~~~~~~~~~~~~~~~\n\nThe unique id used to identify the Elastic Network Interface, for example ``'eni-12345'``.\n\n``ipv4_associations: dict[str, list[str]]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA dictionary mapping the interface’s public IP addresses on the interface to the list of private IP addresses associated with that public IP.\nFor example: ``{'54.0.0.1': ['172.30.0.0']}``.\n\n``ipv6s: list[str]``\n~~~~~~~~~~~~~~~~~~~~\n\nThe IPv6 addresses associated with the interface, for example ``['2001:db8:abcd:ef00::1234']``.\n\n``ipv6_prefix: list[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe IPv6 prefixes associated with the interface, for example ``['2001:db8:abcd:ef00:::/80']``.\n\n``mac: str``\n~~~~~~~~~~~~\n\nThe MAC address of the interface, for example ``'01:23:45:67:89:ab'``.\n\n``owner_id: str``\n~~~~~~~~~~~~~~~~~\n\nThe AWS Account ID of the owner of the network interface, for example ``'123456789012'``.\n\n``private_hostname: str``\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe interface's local/private hostname, for example ``'ip-172-30-0-0.eu-west-1.compute.internal'``.\n\n``private_ipv4s: list[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe private IPv4 addresses associated with the interface, for example ``['172.30.0.0']``.\n\n``public_hostname: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe interface's public DNS (IPv4), for example ``'ec2-54-0-0-0.compute-1.amazonaws.com'``.\n\n``public_ipv4s: list[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe Elastic IP addresses associated with the interface, for example ``['54.0.0.0']``.\n\n``security_groups: list[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe names of the security groups to which the network interface belongs, for example ``['ssh-access', 'custom-sg-1']``.\n\n``security_group_ids: list[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe names of the security groups to which the network interface belongs, for example ``['sg-12345678', 'sg-12345679']``.\n\n``subnet_id: str``\n~~~~~~~~~~~~~~~~~~\n\nThe ID of the subnet in which the interface resides, for example ``'subnet-12345678'``.\n\n``subnet_ipv4_cidr_block: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe IPv4 CIDR block of the subnet in which the interface resides, or ``None`` if there is none, for example ``'172.30.0.0/24'``.\n\n``subnet_ipv6_cidr_blocks: list[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe list of IPv6 CIDR blocks of the subnet in which the interface resides, for example ``['2001:db8:abcd:ef00::/64']``.\nIf the subnet does not have any IPv6 CIDR blocks or the instance isn't in a VPC, the list will be empty, for example ``[]``.\n\n``vpc_id: str``\n~~~~~~~~~~~~~~~\n\nThe ID of the VPC in which the interface resides, for example ``'vpc-12345678'``.\n\n``vpc_ipv4_cidr_block: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe IPv4 CIDR block of the VPC, or ``None`` if the instance isn't in a VPC, for example ``'172.30.0.0/16'``.\n\n``vpc_ipv4_cidr_blocks: list[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe list of IPv4 CIDR blocks for example ``['172.30.0.0/16']``.\nIf the interface doesn’t have any such CIDR blocks, the list will be empty.\n\n``vpc_ipv6_cidr_blocks: list[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe list of IPv6 CIDR blocks of the VPC in which the interface resides, for example ``['2001:db8:abcd:ef00::/56']``.\nIf the VPC does not have any IPv6 CIDR blocks or the instance isn't in a VPC, the list will be empty, for example ``[]``.\n\n``PublicKey``\n-------------\n\nRepresents a single SSH public key, as retrieved from ``EC2Metadata.public_keys``.\nAgain like ``EC2Metadata`` all its attributes cache on first access, and can be cleared with ``del`` or its ``clear_all()`` method.\n\n``openssh_key: str | None``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe SSH public key in OpenSSH format, with a trailing newline, for example: ``ssh-rsa AAAAblahblahblah= exampleuser@examplehost\\n``.\nIf the key is not available in OpenSSH format, this will be ``None``, however that is unlikely as that is the only format currently supported by the metadata service.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamchainz%2Fec2-metadata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamchainz%2Fec2-metadata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamchainz%2Fec2-metadata/lists"}