To use terraform scripts, users could firstly initialise via aws configure
:
- Run terraform init this will download the aws plugin
- Run sudo apt install awscli to install awscli
- Run aws configure to configure with access keys, secret key:
aws configure
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]: us-east-2
Default output format [None]:
- Run
terraform plan
for dry-run of the script Advantages of this approach is it avoids exposing of any secret keys in the script This spots any errors before actually applying changes - Run
terraform apply
to actually apply these changes - Run
terraform apply --target=<resource-name>
to spin up a particular resource only - Run
terraform destroy
to release all the spinned up resources. Likewise use--target
flag for destroying a particular resource
Following terraform script spins up:
- Configure the AWS Provider
- Creates VPC
- Creates a Gateway
- Creates Route table
- Associate subnet with Route table
- Create security group to allow all ports
- Create network interface with an IP from subnet
- Create elastic IP addres
- Create Ubunbut server and install apache
To run this, initialize with terraform init
This will create the .terraform and you can run it now wih the command terraform apply
.
Also you can run terraform plan
first to see what the changes will be as well as to update the state.
Generic AWS framework built on boto3 for Jina's usage. This can be reused for other tests/activities to be triggered on AWS
Creates Cloudformation stack on AWS (Following can be customized)
- EC2 instance
- Volume
- Elastic IP
Creates SSM Document (Way to run long-running commands on ec2)
- Mounts Volume on ec2
- Compiles jina from pip or git (any remote branch)
- Clones jina-ai/stress-test from any remote branch
- Runs stress-test on ec2
- Gets results pushed to public s3 bucket
aws:s3:::stress-test-jina
bucket