Skip to content

Commit 7449941

Browse files
committed
Get region from identity_document instead of AZ.
1 parent b00a0c6 commit 7449941

File tree

1 file changed

+3
-2
lines changed
  • cookbooks/aws-parallelcluster-environment/files/default/ec2_udev_rules

1 file changed

+3
-2
lines changed

cookbooks/aws-parallelcluster-environment/files/default/ec2_udev_rules/manageVolume.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,9 @@ def handle_volume(volume_id, attach, detach):
214214

215215
instance_id = get_metadata_value(token, "http://169.254.169.254/latest/meta-data/instance-id")
216216

217-
region = get_metadata_value(token, "http://169.254.169.254/latest/meta-data/placement/availability-zone")
218-
region = region[:-1]
217+
identity_document = get_metadata_value(token, "http://169.254.169.254/latest/dynamic/instance-identity/document")
218+
identity = json.loads(identity_document)
219+
region = identity['region']
219220

220221
proxy_config = parse_proxy_config()
221222

0 commit comments

Comments
 (0)