Skip to content

Commit

Permalink
feat: Add instance flavor and size arguments for det deploy aws [INFE…
Browse files Browse the repository at this point in the history
…NG-227] (determined-ai#7931)
  • Loading branch information
julian-determined-ai authored Sep 22, 2023
1 parent e031a2f commit d25612b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
17 changes: 17 additions & 0 deletions harness/determined/deploy/aws/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions harness/determined/deploy/aws/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions harness/determined/deploy/aws/deployment_types/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 10 additions & 2 deletions harness/determined/deploy/aws/templates/simple-rds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -462,7 +470,7 @@ Resources:
Value: !Ref AWS::StackName
VPCSecurityGroups:
- !GetAtt DatabaseSecurityGroup.GroupId
AllocatedStorage: 20
AllocatedStorage: !Ref DBSize
StorageType: gp2

RetainedLogGroup:
Expand Down

0 comments on commit d25612b

Please sign in to comment.