Skip to content

Commit d845d01

Browse files
Add --aws-domain option to ec2-metadata to get the top-level service domain (#5)
See #4
1 parent 06ebc28 commit d845d01

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

amazon-ec2-utils.spec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ device mapping names.
107107
- Rewrite ebsnvme-id in Bash so it is usable in early boot
108108
- Add Dracut module to support block device naming in early boot
109109

110+
* Tue Dec 17 2024 Keith Gable <gablk@amazon.com> - 2.2.1-1
111+
- Add support for --aws-domain to ec2-metadata
112+
110113
* Wed May 29 2024 Kuniyuki Iwashima <kuniyu@amazon.com> - 2.2.1
111114
- Add symlink for ENA PTP device.
112115

ec2-metadata

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
function print_help()
1010
{
11-
echo "ec2-metadata v0.1.4
11+
echo "ec2-metadata v0.1.5
1212
Use to retrieve EC2 instance metadata from within a running EC2 instance.
1313
e.g. to retrieve instance id: ec2-metadata -i
1414
to retrieve ami id: ec2-metadata -a
@@ -23,6 +23,7 @@ Options:
2323
-l/--ami-launch-index The index of this instance in the reservation (per AMI).
2424
-m/--ami-manifest-path The manifest path of the AMI with which the instance was launched.
2525
-n/--ancestor-ami-ids The AMI IDs of any instances that were rebundled to create this AMI.
26+
-D/--aws-domain The root domain name that AWS uses in this region
2627
-b/--block-device-mapping Defines native device names to use when exposing virtual devices.
2728
-i/--instance-id The ID of this instance
2829
-t/--instance-type The type of instance to launch. For more information, see Instance Types.
@@ -136,6 +137,7 @@ function print_all()
136137
print_normal_metric ami-launch-index meta-data/ami-launch-index
137138
print_normal_metric ami-manifest-path meta-data/ami-manifest-path
138139
print_normal_metric ancestor-ami-ids meta-data/ancestor-ami-ids
140+
print_normal_metric aws-domain meta-data/services/domain
139141
print_block-device-mapping
140142
print_normal_metric instance-id meta-data/instance-id
141143
print_normal_metric instance-type meta-data/instance-type
@@ -165,8 +167,8 @@ if [ "$#" -eq 0 ]; then
165167
fi
166168

167169
declare -a actions
168-
shortopts=almnbithokzPcpvuresdgR
169-
longopts=(ami-id ami-launch-index ami-manifest-path ancestor-ami-ids block-device-mapping
170+
shortopts=almnDbithokzPcpvuresdgR
171+
longopts=(ami-id ami-launch-index ami-manifest-path ancestor-ami-ids aws-domain block-device-mapping
170172
instance-id instance-type local-hostname local-ipv4 kernel-id availability-zone
171173
partition product-codes public-hostname public-ipv4 public-keys ramdisk-id
172174
reservation-id security-groups user-data tags region help all quiet)
@@ -214,6 +216,7 @@ for action in "${actions[@]}"; do
214216
-l | --ami-launch-index ) print_normal_metric ami-launch-index meta-data/ami-launch-index ;;
215217
-m | --ami-manifest-path ) print_normal_metric ami-manifest-path meta-data/ami-manifest-path ;;
216218
-n | --ancestor-ami-ids ) print_normal_metric ancestor-ami-ids meta-data/ancestor-ami-ids ;;
219+
-D | --aws-domain ) print_normal_metric aws-domain meta-data/services/domain ;;
217220
-b | --block-device-mapping ) print_block-device-mapping ;;
218221
-i | --instance-id ) print_normal_metric instance-id meta-data/instance-id ;;
219222
-t | --instance-type ) print_normal_metric instance-type meta-data/instance-type ;;

0 commit comments

Comments
 (0)