-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add aws govcloud support for det-deploy (#2049)
- Loading branch information
1 parent
79134e5
commit fc7fee6
Showing
5 changed files
with
797 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import boto3 | ||
|
||
from determined_deploy.aws import aws, constants | ||
from determined_deploy.aws.deployment_types import base | ||
|
||
|
||
class Govcloud(base.DeterminedDeployment): | ||
ssh_command = "SSH to master Instance: ssh -i <pem-file> ubuntu@{master_ip}" | ||
det_ui = ( | ||
"Configure the Determined CLI: export DET_MASTER={master_ip}\n" | ||
"View the Determined UI: http://{master_ip}:8080\n" | ||
"View Logs at: https://{region}.console.amazonaws-us-gov.com/cloudwatch/home?" | ||
"region={region}#logsV2:log-groups/log-group/{log_group}" | ||
) | ||
|
||
template = "govcloud.yaml" | ||
|
||
template_parameter_keys = [ | ||
constants.cloudformation.ENABLE_CORS, | ||
constants.cloudformation.MASTER_TLS_CERT, | ||
constants.cloudformation.MASTER_TLS_KEY, | ||
constants.cloudformation.MASTER_CERT_NAME, | ||
constants.cloudformation.KEYPAIR, | ||
constants.cloudformation.MASTER_INSTANCE_TYPE, | ||
constants.cloudformation.CPU_AGENT_INSTANCE_TYPE, | ||
constants.cloudformation.GPU_AGENT_INSTANCE_TYPE, | ||
constants.cloudformation.INBOUND_CIDR, | ||
constants.cloudformation.VERSION, | ||
constants.cloudformation.DB_PASSWORD, | ||
constants.cloudformation.MAX_IDLE_AGENT_PERIOD, | ||
constants.cloudformation.MAX_AGENT_STARTING_PERIOD, | ||
constants.cloudformation.MAX_CPU_CONTAINERS_PER_AGENT, | ||
constants.cloudformation.MAX_DYNAMIC_AGENTS, | ||
constants.cloudformation.SPOT_ENABLED, | ||
constants.cloudformation.SPOT_MAX_PRICE, | ||
constants.cloudformation.SUBNET_ID_KEY, | ||
constants.cloudformation.SCHEDULER_TYPE, | ||
constants.cloudformation.PREEMPTION_ENABLED, | ||
constants.cloudformation.CPU_ENV_IMAGE, | ||
constants.cloudformation.GPU_ENV_IMAGE, | ||
constants.cloudformation.LOG_GROUP_PREFIX, | ||
constants.cloudformation.RETAIN_LOG_GROUP, | ||
] | ||
|
||
def deploy(self) -> None: | ||
cfn_parameters = self.consolidate_parameters() | ||
self.before_deploy_print() | ||
with open(self.template_path) as f: | ||
template = f.read() | ||
|
||
aws.deploy_stack( | ||
stack_name=self.parameters[constants.cloudformation.CLUSTER_ID], | ||
template_body=template, | ||
keypair=self.parameters[constants.cloudformation.KEYPAIR], | ||
boto3_session=self.parameters[constants.cloudformation.BOTO3_SESSION], | ||
parameters=cfn_parameters, | ||
) | ||
self.print_results( | ||
self.parameters[constants.cloudformation.CLUSTER_ID], | ||
self.parameters[constants.cloudformation.BOTO3_SESSION], | ||
) | ||
|
||
def print_results(self, stack_name: str, boto3_session: boto3.session.Session) -> None: | ||
output = aws.get_output(stack_name, boto3_session) | ||
master_ip = output[constants.cloudformation.DET_ADDRESS] | ||
region = output[constants.cloudformation.REGION] | ||
log_group = output[constants.cloudformation.LOG_GROUP] | ||
ui_command = self.det_ui.format(master_ip=master_ip, region=region, log_group=log_group) | ||
print(ui_command) | ||
|
||
ssh_command = self.ssh_command.format(master_ip=master_ip) | ||
print(ssh_command) |
Oops, something went wrong.