{"id":20740897,"url":"https://github.com/netflix-skunkworks/ec2blockdevcfg","last_synced_at":"2026-05-08T15:53:16.049Z","repository":{"id":145996244,"uuid":"189665584","full_name":"Netflix-Skunkworks/ec2blockdevcfg","owner":"Netflix-Skunkworks","description":"Tools and configuration for Amazon EC2 NVMe block devices","archived":false,"fork":false,"pushed_at":"2019-06-01T01:31:48.000Z","size":6,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":93,"default_branch":"master","last_synced_at":"2025-01-18T01:44:51.669Z","etag":null,"topics":["aws","ec2","linux","nvme"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Netflix-Skunkworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-31T22:28:55.000Z","updated_at":"2021-06-08T04:53:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"3cdbc840-4ed5-41a9-9bf2-429d2708b0a7","html_url":"https://github.com/Netflix-Skunkworks/ec2blockdevcfg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix-Skunkworks%2Fec2blockdevcfg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix-Skunkworks%2Fec2blockdevcfg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix-Skunkworks%2Fec2blockdevcfg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix-Skunkworks%2Fec2blockdevcfg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Netflix-Skunkworks","download_url":"https://codeload.github.com/Netflix-Skunkworks/ec2blockdevcfg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243030803,"owners_count":20224666,"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","linux","nvme"],"created_at":"2024-11-17T06:30:58.076Z","updated_at":"2026-05-08T15:53:16.014Z","avatar_url":"https://github.com/Netflix-Skunkworks.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EC2 NVMe Block Device Configuration\n\nTools and configuration for working with Amazon EC2 NVMe block device metadata and providing stable device names across boots. With the introduction of instance-store and EBS-backed NVMe devices, there is no guarantee of stable `nvme?n?` device names (eg `/dev/nvme0n1` on first boot might appear as `/dev/nvme2n1` on a subsequent boot if there are additional NVMe devices present).\n\nOriginal work by Amazon, adapted and extended by Netflix.\n\nRelevant EC2 documentation:\n\nhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html\n\n## Tools\n\n### ec2nvme-id\n\n`ec2nvme-id` is adapted from a tool of the same name provided by Amazon for use in Amazon Linux that examines NVMe metadata and extracts embedded `xvd*` or `sd*` device names as requested during attachment in order to provide stable device names aligning with the user requested block device. \n\n#### Changes from the Original\n\nThe script was ported to Python 3 and is known to work against Python 3.5 and later. No dependencies beyond the Python stdlib are required. \n\nThe `ctypes` definitions were fleshed out to fully reflect the structures provided by the kernel and the overall source was cleaned up a bit to make it usable both as a CLI tool and as a library for other tools if necessary.\n\nFor EBS NVMe devices, the original tool only returns the exact embedded block device alias. For example, if one asked for an EBS volume at `/dev/xvdb` and another at `/dev/sdc`, querying the volumes would only return that explicit alias. Given that one can mix-and-match `xvd*` and `sd*` in requests, for consistency, the tool was modified to return both `xvd` and `sd` aliases. While the EC2 API will *accept* requests for EBS volumes at `/dev/xvdb` and `/dev/sdb`, only one or the other will actually succeed, so we can safely set up both aliases as we can never have two distinct block devices at `xvdN` and `sdN` for any `N`.\n\nIn the original tool, there was no special consideration given to instance-store NVMe devices as one might find on `i3.*` instance types or the `*5d` Nitro instance types. When one launches those instances, instance-store NVMe devices are always attached and ready regardless of any ephemeral block device mapping configuration attached to the AMI, instance, or launch configuration. While these devices do embed a unique serial number and manufacturer string identifying them as NVMe instance-store devices, there is no embedded block device alias. To help identify these disks, a synthetic friendly block device alias is established for each instance-store NVMe device in the form of `/dev/ec2_ephemeral_nvmeX` where `X` corresponds to `X` in `/dev/nvmeXn1`.\n\n  **NOTE**: These friendly aliases are *not* currently guaranteed to be stable across reboots but do help one distinguish between EBS- and instance-store-NVMe devices at-a-glance. A future update will make these friendly aliases stable across reboots by using a sorted list of the embedded serial numbers in instance-store NVMe devices to establish a stable numeric order for the `ec2_ephemeral_nvmeX` friendly names. This relies on the fact that one cannot currently add or remove instance-store NVMe devices during an instance's lifetime and the stability guarantee no longer holds if that changes.\n\n### ec2nvme-nsid\n\n`ec2nvme-nsid` extracts the ns number from a given NVMe kernel device name for use in configuration of NVMe ns device links under `/dev/disk/by-id`.\n\n#### Changes from the Original\n\nThis variant is functionally identical but leans on shell parameter expansion over subshells and pipes.\n\n## Configuration\n\nThe udev rules file uses the above tools and establishes the NVMe device symlinks on instance boot. It differs from Amazon's version in that it configures both `sd` and `xvd` aliases and handles instance-store volumes as described above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetflix-skunkworks%2Fec2blockdevcfg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetflix-skunkworks%2Fec2blockdevcfg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetflix-skunkworks%2Fec2blockdevcfg/lists"}