Deployment on AWS Cloud
This section describes how to use Terraform/Packer/Ansible to provision a Face SDK Web API.
Terraform is an Infrastructure as Code (IaC) software tool. With Terraform, you can provision infrastructure by using declarative configuration files.
Prerequisites
-
Install and configure Terraform.
-
Install and configure Packer.
-
Install and configure Ansible.
-
Install and configure AWS CLI.
Info
You can download template configuration files from our GitHub Public repository.
Configuration and Deployment
Configure AWS CLI
- Set AWS CLI credentials:
aws configure
Configure Packer
- Set a
regula.license
file to thefaceapi/packer/artifacts/license/
folder. - Edit the Packer variables file
faceapi/packer/variables/faceapi.pkrvars.hcl
according to your needs. - Required
faceapi_tag
(default "5.2.256.842") can be found at Docker Hub. faceapi_engine
is either cpu (default) or gpu. This is important for the next Terraform section.- Run a Packer build to create AWS AMI.
Note
Execute the command at the faceapi/packer
folder.
packer build -var-file=variables/faceapi.pkrvars.hcl faceapi.pkr.hcl
Configure Terraform
- Edit Terraform variables at
faceapi/terraform/main.tf
. - Upload a certificate for your domain "*.example.com" using AWS Certificate Manager (ACM). (See
faceapi/terraform/variables.tf
-domain
var.)
Run Terraform templates
Note
Execute commands at the faceapi/terraform
folder.
Info
The default engine is CPU. To deploy a GPU version, do the following:
- Set faceapi_engine
to gpu
and faceapi_instance_type
to one of the g4dn instance types, i.e. g4dn.large
at the terraform/main.tf
file.
- The Packer image also should have faceapi_engine
set to gpu
.
terraform init
terraform workspace new dev || terraform workspace select dev # (optional)
terraform plan
terraform apply