Concrete ML
WebsiteLibrariesProducts & ServicesDevelopersSupport
1.2
1.2
  • What is Concrete ML?
  • Getting Started
    • Installation
    • Key Concepts
    • Inference in the Cloud
    • Demos and Tutorials
  • Built-in Models
    • Linear Models
    • Tree-based Models
    • Neural Networks
    • Nearest Neighbors
    • Pandas
    • Built-in Model Examples
  • Deep Learning
    • Using Torch
    • Using ONNX
    • Step-by-step Guide
    • Deep Learning Examples
    • Debugging Models
    • Optimizing Inference
  • Deployment
    • Prediction with FHE
    • Hybrid models
    • Production Deployment
    • Serialization
  • Advanced topics
    • Quantization
    • Pruning
    • Compilation
    • Advanced Features
  • Developer Guide
    • Workflow
      • Set Up the Project
      • Set Up Docker
      • Documentation
      • Support and Issues
      • Contributing
    • Inner Workings
      • Importing ONNX
      • Quantization Tools
      • FHE Op-graph Design
      • External Libraries
    • API
      • concrete.ml.common.check_inputs.md
      • concrete.ml.common.debugging.custom_assert.md
      • concrete.ml.common.debugging.md
      • concrete.ml.common.md
      • concrete.ml.common.serialization.decoder.md
      • concrete.ml.common.serialization.dumpers.md
      • concrete.ml.common.serialization.encoder.md
      • concrete.ml.common.serialization.loaders.md
      • concrete.ml.common.serialization.md
      • concrete.ml.common.utils.md
      • concrete.ml.deployment.deploy_to_aws.md
      • concrete.ml.deployment.deploy_to_docker.md
      • concrete.ml.deployment.fhe_client_server.md
      • concrete.ml.deployment.md
      • concrete.ml.deployment.server.md
      • concrete.ml.deployment.utils.md
      • concrete.ml.onnx.convert.md
      • concrete.ml.onnx.md
      • concrete.ml.onnx.onnx_impl_utils.md
      • concrete.ml.onnx.onnx_model_manipulations.md
      • concrete.ml.onnx.onnx_utils.md
      • concrete.ml.onnx.ops_impl.md
      • concrete.ml.pytest.md
      • concrete.ml.pytest.torch_models.md
      • concrete.ml.pytest.utils.md
      • concrete.ml.quantization.base_quantized_op.md
      • concrete.ml.quantization.md
      • concrete.ml.quantization.post_training.md
      • concrete.ml.quantization.quantized_module.md
      • concrete.ml.quantization.quantized_module_passes.md
      • concrete.ml.quantization.quantized_ops.md
      • concrete.ml.quantization.quantizers.md
      • concrete.ml.search_parameters.md
      • concrete.ml.search_parameters.p_error_search.md
      • concrete.ml.sklearn.base.md
      • concrete.ml.sklearn.glm.md
      • concrete.ml.sklearn.linear_model.md
      • concrete.ml.sklearn.md
      • concrete.ml.sklearn.neighbors.md
      • concrete.ml.sklearn.qnn.md
      • concrete.ml.sklearn.qnn_module.md
      • concrete.ml.sklearn.rf.md
      • concrete.ml.sklearn.svm.md
      • concrete.ml.sklearn.tree.md
      • concrete.ml.sklearn.tree_to_numpy.md
      • concrete.ml.sklearn.xgb.md
      • concrete.ml.torch.compile.md
      • concrete.ml.torch.hybrid_model.md
      • concrete.ml.torch.md
      • concrete.ml.torch.numpy_module.md
      • concrete.ml.version.md
Powered by GitBook
On this page
  • module concrete.ml.deployment.deploy_to_aws
  • Global Variables
  • function create_instance
  • function deploy_to_aws
  • function wait_instance_termination
  • function terminate_instance
  • function delete_security_group
  • function main
  • class AWSInstance

Was this helpful?

Export as PDF
  1. Developer Guide
  2. API

concrete.ml.deployment.deploy_to_aws.md

Previousconcrete.ml.common.utils.mdNextconcrete.ml.deployment.deploy_to_docker.md

Last updated 1 year ago

Was this helpful?

Libraries

  • TFHE-rs
  • Concrete
  • Concrete ML
  • fhEVM

Developers

  • Blog
  • Documentation
  • Github
  • FHE resources

Company

  • About
  • Introduction to FHE
  • Media
  • Careers

module 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(
    instance_type: str = 'c5.large',
    open_port=5000,
    instance_name: Optional[str] = None,
    verbose: bool = False,
    region_name: Optional[str] = None,
    ami_id='ami-0d7427e883fa00ff3'
) → Dict[str, Any]

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 objects

  • verbose (bool): show logs or not

  • region_name (Optional[str]): AWS region

  • ami_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(
    instance_metadata: Dict[str, Any],
    path_to_model: Path,
    number_of_ssh_retries: int = -1,
    wait_bar: bool = False,
    verbose: bool = False
)

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_instance

  • path_to_model (Path): the path to the serialized model

  • number_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 available

  • verbose (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(instance_id: str, region_name: Optional[str] = None)

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(instance_id: str, region_name: Optional[str] = None)

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(security_group_id: str, region_name: Optional[str] = None)

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(
    path_to_model: Path,
    port: int = 5000,
    instance_type: str = 'c5.large',
    instance_name: Optional[str] = None,
    verbose: bool = False,
    wait_bar: bool = False,
    terminate_on_shutdown: bool = True
)

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 objects

  • verbose (bool): show logs or not

  • wait_bar (bool): show progress bar when waiting for ssh connection

  • terminate_on_shutdown (bool): terminate instance when script is over


class AWSInstance

AWSInstance.

Context manager for AWS instance that supports ssh and http over one port.

method __init__

__init__(
    instance_type: str = 'c5.large',
    open_port=5000,
    instance_name: Optional[str] = None,
    verbose: bool = False,
    terminate_on_shutdown: bool = True,
    region_name: Optional[str] = None,
    ami_id: str = 'ami-0d7427e883fa00ff3'
)