Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions amazon-ec2-utils.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: amazon-ec2-utils
Summary: A set of tools for running in EC2
Version: 2.2.0
Version: 2.2.1
Release: 1%{?dist}
License: MIT
Group: System Tools
Expand All @@ -25,6 +25,7 @@ Provides: ec2-metadata = %{version}-%{release}
Obsoletes: ec2-metadata <= 0.1.3
Requires: curl
Requires: python3
BuildRequires: sed
BuildRequires: python3-devel
BuildRequires: systemd-rpm-macros
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Expand All @@ -35,6 +36,7 @@ amazon-ec2-utils contains a set of utilities for running in ec2.
%prep

%build
sed "s/%EC2_METADATA_VERSION%/%version/" %{SOURCE0} > ec2-metadata

%install
rm -rf $RPM_BUILD_ROOT
Expand All @@ -44,7 +46,7 @@ mkdir -p $RPM_BUILD_ROOT%{_sbindir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8/

install -m755 %{SOURCE0} $RPM_BUILD_ROOT%{_bindir}
install -m755 ec2-metadata $RPM_BUILD_ROOT%{_bindir}
install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_udevrulesdir}
install -m755 %{SOURCE24} $RPM_BUILD_ROOT%{_sbindir}
Expand Down Expand Up @@ -81,10 +83,13 @@ rm -rf $RPM_BUILD_ROOT
/etc/udev/rules.d/60-cdrom_id.rules

%changelog
* Mon Aug 25 2025 Ziggy Gable <[email protected]> - 2.2.1-1
- Add support for --aws-domain to ec2-metadata

* Wed May 29 2024 Kuniyuki Iwashima <[email protected]> - 2.2.1
- Add symlink for ENA PTP device.

* Thu Jan 18 2024 Keith Gable <[email protected]> - 2.2.0-1
* Thu Jan 18 2024 Ziggy Gable <[email protected]> - 2.2.0-1
- Corrected issue where an ec2-metadata error was written to stdout
- Change ec2nvme-nsid to use Bash string manipulation to improve
performance and reliability
Expand Down
9 changes: 6 additions & 3 deletions ec2-metadata
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

function print_help()
{
echo "ec2-metadata v0.1.5
echo "ec2-metadata v%EC2_METADATA_VERSION%
Use to retrieve EC2 instance metadata from within a running EC2 instance.
e.g. to retrieve instance id: ec2-metadata -i
to retrieve ami id: ec2-metadata -a
Expand All @@ -23,6 +23,7 @@ Options:
-l/--ami-launch-index The index of this instance in the reservation (per AMI).
-m/--ami-manifest-path The manifest path of the AMI with which the instance was launched.
-n/--ancestor-ami-ids The AMI IDs of any instances that were rebundled to create this AMI.
-D/--aws-domain The root domain name that AWS uses in this region
-b/--block-device-mapping Defines native device names to use when exposing virtual devices.
-i/--instance-id The ID of this instance
-t/--instance-type The type of instance to launch. For more information, see Instance Types.
Expand Down Expand Up @@ -138,6 +139,7 @@ function print_all()
print_normal_metric ami-launch-index meta-data/ami-launch-index
print_normal_metric ami-manifest-path meta-data/ami-manifest-path
print_normal_metric ancestor-ami-ids meta-data/ancestor-ami-ids
print_normal_metric aws-domain meta-data/services/domain
print_block-device-mapping
print_normal_metric instance-id meta-data/instance-id
print_normal_metric instance-type meta-data/instance-type
Expand Down Expand Up @@ -189,8 +191,8 @@ fi

declare -a actions
declare -a paths
shortopts=almnbithokzPcpvuresdgR
longopts=(ami-id ami-launch-index ami-manifest-path ancestor-ami-ids block-device-mapping
shortopts=almnDbithokzPcpvuresdgR
longopts=(ami-id ami-launch-index ami-manifest-path ancestor-ami-ids aws-domain block-device-mapping
instance-id instance-type local-hostname local-ipv4 kernel-id availability-zone
partition product-codes public-hostname public-ipv4 public-keys ramdisk-id
reservation-id security-groups user-data tags region help all quiet path:)
Expand Down Expand Up @@ -243,6 +245,7 @@ for action in "${actions[@]}"; do
-l | --ami-launch-index ) print_normal_metric ami-launch-index meta-data/ami-launch-index ;;
-m | --ami-manifest-path ) print_normal_metric ami-manifest-path meta-data/ami-manifest-path ;;
-n | --ancestor-ami-ids ) print_normal_metric ancestor-ami-ids meta-data/ancestor-ami-ids ;;
-D | --aws-domain ) print_normal_metric aws-domain meta-data/services/domain ;;
-b | --block-device-mapping ) print_block-device-mapping ;;
-i | --instance-id ) print_normal_metric instance-id meta-data/instance-id ;;
-t | --instance-type ) print_normal_metric instance-type meta-data/instance-type ;;
Expand Down