Skip to content

Commit f75d84c

Browse files
authored
[Develop] Get region from Identity Document instead of AZ (aws#2812)
* Fix an issue in the way we get region when manage volumes so that it can correctly handle local zone.
1 parent 1ce7079 commit f75d84c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ aws-parallelcluster-cookbook CHANGELOG
33

44
This file is used to list changes made in each version of the AWS ParallelCluster cookbook.
55

6+
3.12.0
7+
------
8+
9+
**CHANGES**
10+
11+
**BUG FIXES**
12+
- Fix an issue in the way we get region when manage volumes so that it can correctly handle local zone.
13+
614
3.11.1
715
------
816

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)