Skip to content

Commit 2bd62ba

Browse files
hanwen-clusterhanwen-pcluste
authored andcommitted
[slurmdbd] Use region and account id in bucket name
The hash doesn't work because it is generated before the CloudFormation template is deployed. Signed-off-by: Hanwen <hanwenli@amazon.com>
1 parent cfaaf70 commit 2bd62ba

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

cloudformation/external-slurmdbd/external-slurmdbd.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,14 @@
229229
{
230230
"Ref": "AWS::StackName"
231231
},
232-
"-cf55004ab3dc0560"
232+
"-",
233+
{
234+
"Ref": "AWS::AccountId"
235+
},
236+
"-",
237+
{
238+
"Ref": "AWS::Region"
239+
}
233240
]
234241
]
235242
},
@@ -506,7 +513,15 @@
506513
{
507514
"Ref": "AWS::StackName"
508515
},
509-
"-cf55004ab3dc0560\", \"cluster\": {\"region\": \"",
516+
"-",
517+
{
518+
"Ref": "AWS::AccountId"
519+
},
520+
"-",
521+
{
522+
"Ref": "AWS::Region"
523+
},
524+
"\", \"cluster\": {\"region\": \"",
510525
{
511526
"Ref": "AWS::Region"
512527
},
@@ -599,7 +614,14 @@
599614
{
600615
"Ref": "AWS::StackName"
601616
},
602-
"-cf55004ab3dc0560"
617+
"-",
618+
{
619+
"Ref": "AWS::AccountId"
620+
},
621+
"-",
622+
{
623+
"Ref": "AWS::Region"
624+
}
603625
]
604626
]
605627
}

cloudformation/external-slurmdbd/external_slurmdbd/external_slurmdbd_stack.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import hashlib
21
import json
32

43
import pkg_resources
@@ -420,7 +419,7 @@ def _add_s3_bucket(self):
420419
return s3.CfnBucket(
421420
self,
422421
id="ExternalSlurmdbdS3Bucket",
423-
bucket_name=Aws.STACK_NAME + "-" + hashlib.sha256((self.account + self.region).encode()).hexdigest()[0:16],
422+
bucket_name=Aws.STACK_NAME + "-" + Aws.ACCOUNT_ID + "-" + Aws.REGION,
424423
public_access_block_configuration=s3.CfnBucket.PublicAccessBlockConfigurationProperty(
425424
block_public_acls=True,
426425
block_public_policy=True,

0 commit comments

Comments
 (0)