Skip to content

Commit

Permalink
Set AWS_DEFAULT_REGION in EC2 Userdata (#464)
Browse files Browse the repository at this point in the history
### Changed
- Update Consolidated EC2 Userdata to wait until AWS S3 API can be accessed before proceeding with provisioning [#460]
- Set AWS_DEFAULT_REGION in EC2 Userdata [#463]
  • Loading branch information
mbloch1986 authored Sep 1, 2022
1 parent edb939d commit 72500e5
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Changed
- Update Consolidated EC2 Userdata to wait until AWS S3 API can be accessed before proceeding with provisioning [#460]
- Set AWS_DEFAULT_REGION in EC2 Userdata [#463]

## 5.16.0 - 2022-09-01
### Changed
Expand Down
3 changes: 2 additions & 1 deletion templates/cloudformation/apps/aem/consolidated/main-c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ Resources:
Value: author-publish-dispatcher
UserData:
Fn::Base64:
Fn::Sub: "#!/bin/bash -x\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
Fn::Sub: "#!/bin/bash -x\nexport AWS_DEFAULT_REGION=${AWS::Region}\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
\ source /etc/profile\n mkdir -p /opt/shinesolutions/aem-aws-stack-builder/\n\
\ until [[ $(aws s3 ls s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh) ]]; do echo \"Waiting for EC2 initilsation to finish.\";done\n\
\ aws s3 cp s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh\
\ /opt/shinesolutions/aem-aws-stack-builder/stack-init.sh\n chmod 755\
\ /opt/shinesolutions/aem-aws-stack-builder/stack-init.sh\n /opt/shinesolutions/aem-aws-stack-builder/stack-init.sh\
Expand Down
3 changes: 2 additions & 1 deletion templates/cloudformation/apps/aem/consolidated/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ Resources:
Value: author-publish-dispatcher
UserData:
Fn::Base64:
Fn::Sub: "#!/bin/bash -x\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
Fn::Sub: "#!/bin/bash -x\nexport AWS_DEFAULT_REGION=${AWS::Region}\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
\ source /etc/profile\n mkdir -p /opt/shinesolutions/aem-aws-stack-builder/\n\
\ until [[ $(aws s3 ls s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh) ]]; do echo \"Waiting for EC2 initilsation to finish.\";done\n\
\ aws s3 cp s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh\
\ /opt/shinesolutions/aem-aws-stack-builder/stack-init.sh\n chmod 755\
\ /opt/shinesolutions/aem-aws-stack-builder/stack-init.sh\n /opt/shinesolutions/aem-aws-stack-builder/stack-init.sh\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Resources:
Fn::Sub: ${PrerequisitesStackPrefixParameter}-AuthorDispatcherSecurityGroup
UserData:
Fn::Base64:
Fn::Sub: "#!/bin/bash -x\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
Fn::Sub: "#!/bin/bash -x\nexport AWS_DEFAULT_REGION=${AWS::Region}\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
\ source /etc/profile\n mkdir -p /opt/shinesolutions/aem-aws-stack-builder/\n\
\ until [[ $(aws s3 ls s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh) ]]; do echo \"Waiting for EC2 initilsation to finish.\";done\n\
\ aws s3 cp s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh\
Expand Down
6 changes: 3 additions & 3 deletions templates/cloudformation/apps/aem/full-set/author.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Resources:
Value: author-primary
UserData:
Fn::Base64:
Fn::Sub: "#!/bin/bash -x\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
Fn::Sub: "#!/bin/bash -x\nexport AWS_DEFAULT_REGION=${AWS::Region}\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
\ source /etc/profile\n mkdir -p /opt/shinesolutions/aem-aws-stack-builder/\n\
\ until [[ $(aws s3 ls s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh) ]]; do echo \"Waiting for EC2 initilsation to finish.\";done\n\
\ aws s3 cp s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh\
Expand Down Expand Up @@ -309,7 +309,7 @@ Resources:
- PrivateIp
UserData:
Fn::Base64:
Fn::Sub: "#!/bin/bash -x\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
Fn::Sub: "#!/bin/bash -x\nexport AWS_DEFAULT_REGION=${AWS::Region}\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
\ source /etc/profile\n mkdir -p /opt/shinesolutions/aem-aws-stack-builder/\n\
\ until [[ $(aws s3 ls s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh) ]]; do echo \"Waiting for EC2 initilsation to finish.\";done\n\
\ aws s3 cp s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh\
Expand Down Expand Up @@ -859,4 +859,4 @@ Resources:
Period: 300
Statistic: Maximum
Threshold: 45
Type: AWS::CloudWatch::Alarm
Type: AWS::CloudWatch::Alarm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Resources:
Fn::Sub: ${PrerequisitesStackPrefixParameter}-ChaosMonkeySecurityGroup
UserData:
Fn::Base64:
Fn::Sub: "#!/bin/bash -x\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
Fn::Sub: "#!/bin/bash -x\nexport AWS_DEFAULT_REGION=${AWS::Region}\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
\ source /etc/profile\n mkdir -p /opt/shinesolutions/aem-aws-stack-builder/\n\
\ until [[ $(aws s3 ls s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh) ]]; do echo \"Waiting for EC2 initilsation to finish.\";done\n\
\ aws s3 cp s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Resources:
Fn::Sub: ${PrerequisitesStackPrefixParameter}-OrchestratorSecurityGroup
UserData:
Fn::Base64:
Fn::Sub: "#!/bin/bash -x\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
Fn::Sub: "#!/bin/bash -x\nexport AWS_DEFAULT_REGION=${AWS::Region}\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
\ source /etc/profile\n mkdir -p /opt/shinesolutions/aem-aws-stack-builder/\n\
\ # Configure other stack names in Orchestrator's stack provisioner's\
\ local.yaml\n echo '\n aem_orchestrator::application_properties::aws_cloudformation_stack_name_author:\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ Resources:
Fn::Sub: ${PrerequisitesStackPrefixParameter}-PublishDispatcherSecurityGroup
UserData:
Fn::Base64:
Fn::Sub: "#!/bin/bash -x\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
Fn::Sub: "#!/bin/bash -x\nexport AWS_DEFAULT_REGION=${AWS::Region}\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
\ source /etc/profile\n mkdir -p /opt/shinesolutions/aem-aws-stack-builder/\n\
\ until [[ $(aws s3 ls s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh) ]]; do echo \"Waiting for EC2 initilsation to finish.\";done\n\
\ aws s3 cp s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh\
Expand Down
2 changes: 1 addition & 1 deletion templates/cloudformation/apps/aem/full-set/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Resources:
Fn::Sub: ${PrerequisitesStackPrefixParameter}-PublishSecurityGroup
UserData:
Fn::Base64:
Fn::Sub: "#!/bin/bash -x\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
Fn::Sub: "#!/bin/bash -x\nexport AWS_DEFAULT_REGION=${AWS::Region}\nexport no_proxy=${NoProxyParameter}\nexport http_proxy=${HttpProxyParameter}\nexport https_proxy=${HttpsProxyParameter}\n\
\ source /etc/profile\n mkdir -p /opt/shinesolutions/aem-aws-stack-builder/\n\
\ until [[ $(aws s3 ls s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh) ]]; do echo \"Waiting for EC2 initilsation to finish.\";done\n\
\ aws s3 cp s3://${DataBucketNameParameter}/${MainStackPrefixParameter}/stack-init.sh\
Expand Down

0 comments on commit 72500e5

Please sign in to comment.