diff --git a/.github/actions/aurora-create-database/action.yaml b/.github/actions/aurora-create-database/action.yaml index ece08adc0..48eb25b40 100644 --- a/.github/actions/aurora-create-database/action.yaml +++ b/.github/actions/aurora-create-database/action.yaml @@ -8,6 +8,10 @@ inputs: region: description: 'The AWS region used to host the Aurora DB' required: true + engineVersion: + description: 'The Postgres engine version to use' + instanceClass: + description: 'Instance class for the Aurora DB' runs: using: "composite" @@ -18,4 +22,6 @@ runs: working-directory: provision/aws/rds env: AURORA_CLUSTER: ${{ inputs.name }} + AURORA_ENGINE_VERSION: ${{ inputs.engineVersion }} + AURORA_INSTANCE_CLASS: ${{ inputs.instanceClass }} AWS_REGION: ${{ inputs.region }} diff --git a/.github/workflows/aurora-create-database.yaml b/.github/workflows/aurora-create-database.yaml index cb7ff0036..a087dea60 100644 --- a/.github/workflows/aurora-create-database.yaml +++ b/.github/workflows/aurora-create-database.yaml @@ -11,6 +11,12 @@ on: description: 'The AWS region used to host the Aurora DB' type: string required: true + engineVersion: + description: 'The Postgres engine version to use' + type: string + instanceClass: + description: 'Instance class for the Aurora DB' + type: string jobs: prepare: @@ -33,3 +39,5 @@ jobs: with: name: ${{ inputs.name }} region: ${{ inputs.region }} + engineVersion: ${{ inputs.engineVersion }} + instanceClass: ${{ inputs.instanceClass }} diff --git a/provision/aws/rds/aurora_common.sh b/provision/aws/rds/aurora_common.sh index e952b8419..80b40ae61 100755 --- a/provision/aws/rds/aurora_common.sh +++ b/provision/aws/rds/aurora_common.sh @@ -6,13 +6,17 @@ if [ -f ./.env ]; then fi export AURORA_CLUSTER=${AURORA_CLUSTER:-"keycloak"} -export AURORA_INSTANCE=${AURORA_INSTANCE:-"${AURORA_CLUSTER}-instance-1"} export AURORA_ENGINE=${AURORA_ENGINE:-"aurora-postgresql"} -export AURORA_USERNAME=${AURORA_USERNAME:-"keycloak"} +export AURORA_ENGINE_VERSION=${AURORA_ENGINE_VERSION:-"15.3"} +export AURORA_INSTANCE=${AURORA_INSTANCE:-"${AURORA_CLUSTER}-instance-1"} +export AURORA_INSTANCE_CLASS=${AURORA_INSTANCE_CLASS:-"db.t4g.large"} export AURORA_PASSWORD=${AURORA_PASSWORD:-"secret99"} -export AURORA_SUBNET_GROUP_NAME=${AURORA_SUBNET_GROUP_NAME:-"${AURORA_CLUSTER}-subnet-group"} +export AURORA_REGION=${AURORA_REGION} export AURORA_SECURITY_GROUP_NAME=${AURORA_SECURITY_GROUP_NAME:-"${AURORA_CLUSTER}-security-group"} +export AURORA_SUBNET_A_CIDR=${AURORA_SUBNET_A_CIDR:-"192.168.0.0/19"} +export AURORA_SUBNET_B_CIDR=${AURORA_SUBNET_B_CIDR:-"192.168.32.0/19"} +export AURORA_SUBNET_GROUP_NAME=${AURORA_SUBNET_GROUP_NAME:-"${AURORA_CLUSTER}-subnet-group"} +export AURORA_USERNAME=${AURORA_USERNAME:-"keycloak"} export AURORA_VPC_CIDR=${AURORA_VPC_CIDR:-"192.168.0.0/16"} -export AURORA_REGION=${AURORA_REGION} export AWS_REGION=${AWS_REGION:-${AURORA_REGION}} export AWS_PAGER="" diff --git a/provision/aws/rds/aurora_create.sh b/provision/aws/rds/aurora_create.sh index d67f25b89..4e7b0fa47 100755 --- a/provision/aws/rds/aurora_create.sh +++ b/provision/aws/rds/aurora_create.sh @@ -31,7 +31,7 @@ AURORA_VPC=$(aws ec2 create-vpc \ SUBNET_A=$(aws ec2 create-subnet \ --availability-zone "${AWS_REGION}a" \ --vpc-id ${AURORA_VPC} \ - --cidr-block 192.168.0.0/19 \ + --cidr-block ${AURORA_SUBNET_A_CIDR} \ --output json \ | jq -r '.Subnet.SubnetId' ) @@ -39,7 +39,7 @@ SUBNET_A=$(aws ec2 create-subnet \ SUBNET_B=$(aws ec2 create-subnet \ --availability-zone "${AWS_REGION}b" \ --vpc-id ${AURORA_VPC} \ - --cidr-block 192.168.32.0/19 \ + --cidr-block ${AURORA_SUBNET_B_CIDR} \ --output json \ | jq -r '.Subnet.SubnetId' ) @@ -78,6 +78,7 @@ aws rds create-db-cluster \ --db-cluster-identifier ${AURORA_CLUSTER} \ --database-name keycloak \ --engine ${AURORA_ENGINE} \ + --engine-version ${AURORA_ENGINE_VERSION} \ --master-username ${AURORA_USERNAME} \ --master-user-password ${AURORA_PASSWORD} \ --vpc-security-group-ids ${AURORA_SECURITY_GROUP_ID} \ @@ -86,7 +87,7 @@ aws rds create-db-cluster \ aws rds create-db-instance \ --db-cluster-identifier ${AURORA_CLUSTER} \ --db-instance-identifier ${AURORA_INSTANCE} \ - --db-instance-class db.t4g.large \ + --db-instance-class ${AURORA_INSTANCE_CLASS} \ --engine ${AURORA_ENGINE} aws rds wait db-instance-available --db-instance-identifier ${AURORA_INSTANCE}