Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aurora Severless v2 #31

Merged
merged 4 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions .github/workflows/ci.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
name: CI

name: Lint
on: [push, pull_request]

jobs:
build:
runs-on: 'ubuntu-latest'

runs-on: ['ubuntu-latest']
steps:

- uses: 'actions/checkout@v2'

- uses: 'actions/setup-python@v2'
with:
python-version: '3.8'

- name: yamlllint
run: |
pip install yamllint==1.26.3
pip install yamllint==1.35.1
yamllint module.yml && yamllint test/*.yml
- name: cfn-lint
run: |
pip install cfn-lint==0.59.1
cfn-lint -i W2001 -t module.yml && cfn-lint -t test/*.yml
pip install cfn-lint==1.20.1
cfn-lint -i W3002 W2001 W1011 -t module.yml && cfn-lint -i W3002 W2001 W1011 -t test/*.yml # Remove W2001 after enabling SecondsUntilAutoPause
- name: license
run: |
grep -q "LICENSE-2.0" module.yml
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test
on: [push, pull_request, workflow_dispatch]
permissions:
id-token: write
contents: read
concurrency:
group: test
cancel-in-progress: false
jobs:
build:
runs-on: ['ubuntu-latest']
steps:
- uses: 'actions/checkout@v2'
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: 'arn:aws:iam::068189904525:role/github-openid-connect'
aws-region: 'eu-west-1'
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: test
run: |
npm ci
cd test
npm ci
CFN_PACKAGE_BUCKET_NAME=cf-templates-1a2zmgbg9ut4o-eu-west-1 npm test
cd -
45 changes: 20 additions & 25 deletions module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,17 @@ Parameters:
Type: String
Default: 'aurora.'
PreferredBackupWindow:
Description: 'IGNORED BECAUSE OF A BUG IN CLOUDFORMATION! VALUE WILL APPLY IN THE FUTURE! The daily time range in UTC during which you want to create automated backups.' # TODO remove uppercase warning
Description: 'The daily time range in UTC during which you want to create automated backups.'
Type: String
Default: '09:54-10:24'
PreferredMaintenanceWindow:
Description: IGNORED BECAUSE OF A BUG IN CLOUDFORMATION! VALUE WILL APPLY IN THE FUTURE! The weekly time range (in UTC) during which system maintenance can occur. # TODO remove uppercase warning
Description: 'The weekly time range (in UTC) during which system maintenance can occur.'
Type: String
Default: 'sat:07:00-sat:07:30'
AutoPause:
Description: 'Enable automatic pause for a Serverless Aurora cluster. A cluster can be paused only when it has no connections. If a cluster is paused for more than seven days, the cluster might be backed up with a snapshot. In this case, the cluster is restored when there is a request to connect to it.'
Type: String
AllowedValues: ['true', 'false']
Default: 'true'
SecondsUntilAutoPause:
Description: 'The time, in seconds, before a Serverless Aurora cluster is paused.'
Description: 'IGNORED BECAUSE OF A BUG IN CLOUDFORMATION! VALUE WILL APPLY IN THE FUTURE! The time, in seconds, before a Serverless Aurora cluster is paused.' # TODO remove uppercase warning
Type: Number
MinValue: 1
MinValue: 300
MaxValue: 86400
Default: 300
MaxCapacity:
Expand All @@ -106,22 +101,18 @@ Parameters:
EngineVersion:
Description: 'Aurora Serverless MySQL version.'
Type: String
Default: '5.6.10a'
AllowedValues: ['5.6.10a', '5.7.mysql-aurora.2.07.1'] # aws rds describe-db-engine-versions --engine aurora --query 'DBEngineVersions[?contains(SupportedEngineModes,`serverless`)]'; aws rds describe-db-engine-versions --engine aurora-mysql --query 'DBEngineVersions[?contains(SupportedEngineModes,`serverless`)]'
Default: '8.0.mysql-aurora.3.08.0'
AllowedValues: ['8.0.mysql-aurora.3.08.0'] # aws rds describe-orderable-db-instance-options --engine aurora-mysql --db-instance-class db.serverless --query 'OrderableDBInstanceOptions[].[EngineVersion]' --output text
EnableDataApi:
Description: 'Enable the Data API (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html).'
Type: String
AllowedValues: ['true', 'false']
Default: 'true'
Mappings:
EngineVersionMap:
'5.6.10a':
ClusterParameterGroupFamily: 'aurora5.6'
EngineVersion: '5.6.10a'
Engine: aurora
'5.7.mysql-aurora.2.07.1':
ClusterParameterGroupFamily: 'aurora-mysql5.7'
EngineVersion: '5.7.mysql_aurora.2.07.1'
'8.0.mysql-aurora.3.08.0':
ClusterParameterGroupFamily: 'aurora-mysql8.0'
EngineVersion: '8.0.mysql_aurora.3.08.0'
Engine: 'aurora-mysql'
Conditions:
HasBastionModule: !Not [!Equals [!Ref BastionModule, '']]
Expand Down Expand Up @@ -193,22 +184,26 @@ Resources:
DBSubnetGroupName: !Ref DBSubnetGroup
EnableHttpEndpoint: !Ref EnableDataApi
Engine: !FindInMap [EngineVersionMap, !Ref EngineVersion, Engine]
EngineMode: serverless
EngineVersion: !FindInMap [EngineVersionMap, !Ref EngineVersion, EngineVersion]
KmsKeyId: !If [HasDBSnapshotIdentifier, !Ref 'AWS::NoValue', {'Fn::ImportValue': !Sub '${KmsKeyModule}-Arn'}]
MasterUsername: !If [HasDBSnapshotIdentifier, !Ref 'AWS::NoValue', !Ref DBMasterUsername]
MasterUserPassword: !If [HasDBSnapshotIdentifier, !Ref 'AWS::NoValue', !If [HasSecretModule, !Join ['', ['{{resolve:secretsmanager:', {'Fn::ImportValue': !Sub '${SecretModule}-Arn'}, '}}']], !Ref DBMasterUserPassword]]
# PreferredBackupWindow: !Ref PreferredBackupWindow TODO re-enable as soon as CloudFormation bug ix fixed
# PreferredMaintenanceWindow: !Ref PreferredMaintenanceWindow TODO re-enable as soon as CloudFormation bug ix fixed
ScalingConfiguration:
AutoPause: !Ref AutoPause
PreferredBackupWindow: !Ref PreferredBackupWindow
PreferredMaintenanceWindow: !Ref PreferredMaintenanceWindow
ServerlessV2ScalingConfiguration:
MaxCapacity: !Ref MaxCapacity
MinCapacity: !Ref MinCapacity
SecondsUntilAutoPause: !Ref SecondsUntilAutoPause
# SecondsUntilAutoPause: !Ref SecondsUntilAutoPause TODO Waiting for CloudFormation support
SnapshotIdentifier: !If [HasDBSnapshotIdentifier, !Ref DBSnapshotIdentifier, !Ref 'AWS::NoValue']
StorageEncrypted: true
VpcSecurityGroupIds:
- !Ref SecurityGroup
ServerlessDBInstance:
Type: 'AWS::RDS::DBInstance'
Properties:
DBClusterIdentifier: !Ref DBCluster
DBInstanceClass: 'db.serverless'
Engine: !FindInMap [EngineVersionMap, !Ref EngineVersion, Engine]
DBClusterEventSubscription:
Condition: HasAlertingModule
Type: 'AWS::RDS::EventSubscription'
Expand All @@ -224,7 +219,7 @@ Outputs:
ModuleId:
Value: 'rds-aurora-serverless'
ModuleVersion:
Value: '1.6.0'
Value: '2.0.0'
StackName:
Value: !Ref 'AWS::StackName'
Name:
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Resources:
VpcModule: !GetAtt 'Vpc.Outputs.StackName'
ClientSgModule: !GetAtt 'ClientSg.Outputs.StackName'
KmsKeyModule: !GetAtt 'Key.Outputs.StackName'
EngineVersion: '5.7.mysql-aurora.2.07.1'
EngineVersion: '8.0.mysql-aurora.3.08.0'
DBName: 'test'
DBMasterUserPassword: 'SuP3rS3curE'
TemplateURL: './node_modules/@cfn-modules/rds-aurora-serverless/module.yml'
Loading