Skip to content

Add --aws-domain option to ec2-metadata to get the top-level service domain #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
5 changes: 4 additions & 1 deletion 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 Down Expand Up @@ -78,6 +78,9 @@ rm -rf $RPM_BUILD_ROOT
/etc/udev/rules.d/60-cdrom_id.rules

%changelog
* Tue Dec 17 2024 Keith 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.

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.4
echo "ec2-metadata v0.1.5
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 @@ -136,6 +137,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 @@ -165,8 +167,8 @@ if [ "$#" -eq 0 ]; then
fi

declare -a actions
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)
Expand Down Expand Up @@ -214,6 +216,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