concrete.ml.deployment.deploy_to_aws.md
module concrete.ml.deployment.deploy_to_aws
concrete.ml.deployment.deploy_to_aws
Methods to deploy a client/server to AWS.
It takes as input a folder with: - client.zip - server.zip - processing.json
It spawns a AWS EC2 instance with proper security groups. Then SSHs to it to rsync the files and update Python dependencies. It then launches the server.
Global Variables
DATE_FORMAT
DEFAULT_CML_AMI_ID
function create_instance
create_instance
Create a EC2 instance.
Arguments:
instance_type
(str): the type of AWS EC2 instance.open_port
(int): the port to open.instance_name
(Optional[str]): the name to use for AWS created objectsverbose
(bool): show logs or notregion_name
(Optional[str]): AWS regionami_id
(str): AMI to use
Returns:
Dict[str, Any]
: some information about the newly created instance. - ip - private_key - instance_id - key_path - ip_address - port
function deploy_to_aws
deploy_to_aws
Deploy a model to a EC2 AWS instance.
Arguments:
instance_metadata
(Dict[str, Any]): the metadata of AWS EC2 instance created using AWSInstance or create_instancepath_to_model
(Path): the path to the serialized modelnumber_of_ssh_retries
(int): the number of ssh retries (-1 is no limit)wait_bar
(bool): whether to show a wait bar when waiting for ssh connection to be availableverbose
(bool): whether to show a logs
Returns: instance_metadata (Dict[str, Any])
Raises:
RuntimeError
: if launching the server crashed
function wait_instance_termination
wait_instance_termination
Wait for AWS EC2 instance termination.
Arguments:
instance_id
(str): the id of the AWS EC2 instance to terminate.region_name
(Optional[str]): AWS region (Optional)
function terminate_instance
terminate_instance
Terminate a AWS EC2 instance.
Arguments:
instance_id
(str): the id of the AWS EC2 instance to terminate.region_name
(Optional[str]): AWS region (Optional)
function delete_security_group
delete_security_group
Terminate a AWS EC2 instance.
Arguments:
security_group_id
(str): the id of the AWS EC2 instance to terminate.region_name
(Optional[str]): AWS region (Optional)
function main
main
Deploy a model.
Arguments:
path_to_model
(Path): path to serialized model to serve.port
(int): port to use.instance_type
(str): type of AWS EC2 instance to use.instance_name
(Optional[str]): the name to use for AWS created objectsverbose
(bool): show logs or notwait_bar
(bool): show progress bar when waiting for ssh connectionterminate_on_shutdown
(bool): terminate instance when script is over
class AWSInstance
AWSInstance
AWSInstance.
Context manager for AWS instance that supports ssh and http over one port.
method __init__
__init__
Last updated