aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap
[AWS::ARCRegionSwitch::Plan] - [Enhancement] - Stop AuroraServerlessScalingConfig requiring hard coded regions
- Dominant language
- No language data
- Stars
- 1.1k
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
### Name of the resource
Other
### Resource name
AWS::ARCRegionSwitch::Plan
### Description
Starting with a simple `AWS::ARCRegionSwitch::Plan` resource below which fails over the Aurora Global cluster and Route53 failover records from the primary to the standby region.
```yaml
RegionSwitchPlan:
Type: AWS::ARCRegionSwitch::Plan
Properties:
Name: Trigger-Regional-Failover
Description: Failover to another region.
RecoveryApproach: activePassive
PrimaryRegion: !Ref PrimaryRegion
Regions:
- !Ref PrimaryRegion
- !Ref StandbyRegion
ExecutionRole: !GetAtt RegionSwitchRole.Arn
Workflows:
- WorkflowTargetAction: activate
Steps:
- Name: Failover Infrastructure
ExecutionBlockType: Parallel
ExecutionBlockConfiguration:
ParallelConfig:
Steps:
- Name: Failover Aurora Global Database
ExecutionBlockType: AuroraGlobalDatabase
ExecutionBlockConfiguration:
GlobalAuroraConfig:
Behavior: switchoverOnly
GlobalClusterIdentifier: !Ref GlobalClusterIdentifier
DatabaseClusterArns:
- !Sub arn:${AWS::Partition}:rds:${PrimaryRegion}:${AWS::AccountId}:cluster:${PrimaryRegionClusterIdentifier}
- !Sub arn:${AWS::Partition}:rds:${StandbyRegion}:${AWS::AccountId}:cluster:${StandbyRegionClusterIdentifier}
- Name: Failover DNS
ExecutionBlockType: Route53HealthCheck
ExecutionBlockConfiguration:
Route53HealthCheckConfig:
HostedZoneId: !Ref PublicHostedZoneId
RecordName: !Ref DomainName
```
I want to take advantage of the Aurora Serverless Scaling execution block, but I am unable to integrate it into my CloudFormation.
```yaml
- Name: Scale Aurora Global Serverless Instances
ExecutionBlockType: AuroraServerlessScaling
ExecutionBlockConfiguration:
AuroraServerlessScalingConfig:
GlobalClusterIdentifier: !Ref GlobalClusterIdentifier
RegionDatabaseClusterArns: # <--- How can I define this??
```
I want to do something like this, but CloudFormation intrinsic functions can only be used on map values, not map keys.
```yaml
- Name: Scale Aurora Global Serverless Instances
ExecutionBlockType: AuroraServerlessScaling
ExecutionBlockConfiguration:
AuroraServerlessScalingConfig:
GlobalClusterIdentifier: !Ref GlobalClusterIdentifier
RegionDatabaseClusterArns:
!Sub ${PrimaryRegion}: !Sub arn:${AWS::Partition}:rds:${PrimaryRegion}:${AWS::AccountId}:cluster:${PrimaryRegionClusterIdentifier}
!Sub ${StandbyRegion}: !Sub arn:${AWS::Partition}:rds:${StandbyRegion}:${AWS::AccountId}:cluster:${StandbyRegionClusterIdentifier}
```
I currently have a simple custom resource which I can use like `RegionDatabaseClusterArns: !GetAtt CustomResource.RegionDatabaseClusterArns` to work around the problem, but I feel this shouldn't be necessary.
```python
from crhelper import CfnResource
helper = CfnResource()
@helper.create
@helper.update
def create_update(event, context):
properties: dict[str, Any] = event["ResourceProperties"]
regions: list[str] = properties.get("Regions", [])
instances: list[str] = properties.get("Instances", [])
if len(regions) != len(instances):
raise ValueError("Regions and Instances lists must have the same length")
helper.Data["RegionDatabaseClusterArns"] = dict(zip(regions, instances))
def handler(event, context):
helper(event, context)
```
### Other Details
_No response_
Contributor guide
Research direction
Start with the AWS::ARCRegionSwitch::Plan AuroraServerlessScalingConfig documentation and the CloudFormation intrinsic-function rules described in the issue. Compare the existing RegionDatabaseClusterArns example with the custom resource workaround. No repository files or tests are named; done means defining region keys without the workaround while preserving the Aurora Serverless scaling configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud, databases, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100