diff --git a/harness/determined/deploy/aws/cli.py b/harness/determined/deploy/aws/cli.py index 5600e547ab5..a38f3b927bd 100644 --- a/harness/determined/deploy/aws/cli.py +++ b/harness/determined/deploy/aws/cli.py @@ -150,6 +150,9 @@ def deploy_aws(command: str, args: argparse.Namespace) -> None: f"The agent-subnet-id was set to '{args.agent_subnet_id}', but the " f"deployment-type={args.deployment_type}." ) + if args.deployment_type == constants.deployment_types.SIMPLE_RDS: + if args.db_size is not None and args.db_size < 20: + raise ValueError("The db-size must be greater than or equal to 20 GB") if args.deployment_type == constants.deployment_types.GOVCLOUD: if args.region not in ["us-gov-east-1", "us-gov-west-1"]: @@ -198,6 +201,8 @@ def deploy_aws(command: str, args: argparse.Namespace) -> None: constants.cloudformation.VERSION: args.det_version, constants.cloudformation.INBOUND_CIDR: args.inbound_cidr, constants.cloudformation.DB_PASSWORD: args.db_password, + constants.cloudformation.DB_INSTANCE_TYPE: args.db_instance_type, + constants.cloudformation.DB_SIZE: args.db_size, constants.cloudformation.MAX_IDLE_AGENT_PERIOD: args.max_idle_agent_period, constants.cloudformation.MAX_AGENT_STARTING_PERIOD: args.max_agent_starting_period, constants.cloudformation.MAX_AUX_CONTAINERS_PER_AGENT: args.max_aux_containers_per_agent, @@ -437,6 +442,18 @@ def handle_dump_master_config_template(args: argparse.Namespace) -> None: default=constants.defaults.DB_PASSWORD, help="password for master database", ), + Arg( + "--db-instance-type", + type=str, + default=constants.defaults.DB_INSTANCE_TYPE, + help="instance type for master database", + ), + Arg( + "--db-size", + type=int, + default=constants.defaults.DB_SIZE, + help="storage size in GB for master database", + ), Arg( "--max-idle-agent-period", type=str, diff --git a/harness/determined/deploy/aws/constants.py b/harness/determined/deploy/aws/constants.py index aee64770f8d..0f10d5e6008 100644 --- a/harness/determined/deploy/aws/constants.py +++ b/harness/determined/deploy/aws/constants.py @@ -15,6 +15,8 @@ class defaults: REGION = "us-west-2" STACK_TAG_KEY = "managed-by" STACK_TAG_VALUE = "determined" + DB_SIZE = 20 + DB_INSTANCE_TYPE = "db.m7g.large" class cloudformation: @@ -36,6 +38,8 @@ class cloudformation: MASTER_SCHEME = "MasterScheme" VERSION = "Version" DB_PASSWORD = "DBPassword" + DB_INSTANCE_TYPE = "DBInstanceType" + DB_SIZE = "DBSize" ENABLE_CORS = "EnableCORS" MASTER_TLS_CERT = "MasterTLSCert" MASTER_TLS_KEY = "MasterTLSKey" diff --git a/harness/determined/deploy/aws/deployment_types/base.py b/harness/determined/deploy/aws/deployment_types/base.py index 323adcb024f..306f3f49e5f 100644 --- a/harness/determined/deploy/aws/deployment_types/base.py +++ b/harness/determined/deploy/aws/deployment_types/base.py @@ -22,6 +22,8 @@ constants.cloudformation.INBOUND_CIDR, constants.cloudformation.VERSION, constants.cloudformation.DB_PASSWORD, + constants.cloudformation.DB_INSTANCE_TYPE, + constants.cloudformation.DB_SIZE, constants.cloudformation.MAX_IDLE_AGENT_PERIOD, constants.cloudformation.MAX_AGENT_STARTING_PERIOD, constants.cloudformation.MAX_AUX_CONTAINERS_PER_AGENT, diff --git a/harness/determined/deploy/aws/templates/simple-rds.yaml b/harness/determined/deploy/aws/templates/simple-rds.yaml index e94ba7dc32b..17ff0c76ac2 100644 --- a/harness/determined/deploy/aws/templates/simple-rds.yaml +++ b/harness/determined/deploy/aws/templates/simple-rds.yaml @@ -99,6 +99,14 @@ Parameters: Type: String Description: Password for database (eg. "postgres") NoEcho: true + + DBSize: + Type: Number + Description: Initial storage size for database in GB + + DBInstanceType: + Type: String + Description: Instance type for database (eg. "db.m7g.large") MaxAuxContainersPerAgent: Type: Number @@ -453,7 +461,7 @@ Resources: Type: AWS::RDS::DBInstance DeletionPolicy: Delete Properties: - DBInstanceClass: db.m7g.large + DBInstanceClass: !Ref DBInstanceType Engine: postgres MasterUsername: postgres MasterUserPassword: !Ref DBPassword @@ -462,7 +470,7 @@ Resources: Value: !Ref AWS::StackName VPCSecurityGroups: - !GetAtt DatabaseSecurityGroup.GroupId - AllocatedStorage: 20 + AllocatedStorage: !Ref DBSize StorageType: gp2 RetainedLogGroup: