/terraform-jina-jinad-aws

Module for deploying JinaD on AWS

Primary LanguageHCLApache License 2.0Apache-2.0

OUTDATED DOCS!

Usage:

module "jinad" {
   source         = "jina-ai/jinad-aws/jina"
   debug          = "true"
   branch         = "master"
   port           = "8000"
   script         = "setup-jinad.sh"
   instances      = {
     encoder: {
       type: "c5.4xlarge"
       disk = {
         type = "gp2"
         size = 20
       }
       command: "sudo apt install -y jq"
     }
     indexer: {
       type: "i3.2xlarge"
       disk = {
         type = "gp2"
         size = 20
       }
       command: "sudo apt-get install -y redis-server && sudo redis-server --bind 0.0.0.0 --port 6379:6379 --daemonize yes"
     }
   }
   availability_zone = "us-east-1a"
   additional_tags = {
     "my_tag_key" = "my_tag_value"
   }
}

output "jinad_ips" {
   description   = "IP of JinaD"
   value         = module.jinad.instance_ips
}

Store the outputs from jinad_ips & Use it with jina

from jina import Flow
f = (Flow()
     .add(uses='MyAwesomeEncoder',
          host=<jinad_ips.encoder>:8000),
     .add(uses='MyAwesomeIndexer',
          host=<jinad_ips.indexer>:8000))

with f:
   f.index(...)

Requirements

Name Version
aws =3.37

Providers

Name Version
aws =3.37
null n/a
random n/a

Modules

Name Source Version
keypair mitchellh/dynamic-keys/aws

Resources

Name
aws_ami
aws_eip
aws_eip_association
aws_instance
aws_internet_gateway
aws_route_table
aws_route_table_association
aws_security_group
aws_security_group_rule
aws_subnet
aws_vpc
null_resource
random_string

Inputs

Name Description Type Default Required
additional_tags Additional resource tags map(string) {} no
availability_zone Mention the availability_zone where JinaD resources are going to get created string "us-east-1a" no
branch Mention the git-branch of jina repo to be built string "master" no
debug True if this is running for testing bool true no
instances Describe instance configuration here. map(any)
{
"instance1": {
"command": "sudo echo "Hello from instance1"",
"disk": {
"size": 50,
"type": "gp2"
},
"type": "t2.micro"
},
"instance2": {
"command": "sudo echo "Hello from instance2"",
"disk": {
"size": 20,
"type": "gp2"
},
"type": "t2.micro"
}
}
no
jina_version Mention the version of jinad to be pulled from docker hub
This is applicable only if debug is set to false
string "latest" no
port Mention the jinad port to be mapped on host string "8000" no
region Mention the Region where JinaD resources are going to get created string "us-east-1" no
scriptpath jinad setup script path (part of jina codebase) string n/a yes
subnet_cidr Mention the CIDR of the subnet string "10.113.0.0/16" no
vpc_cidr Mention the CIDR of the VPC string "10.113.0.0/16" no

Outputs

Name Description
instance_ips Elastic IPs of JinaD instances created as a map
instance_keys Private key of JinaD instances for debugging