This repository contains the infrastructure for the Crypto Bot project. The infrastructure is built using Terraform and is hosted on AWS.
- Terraform
- AWS CLI
- AWS Account
- Clone the repository
- Create a
.env
file in the root directory of the repository and add the following environment variables:TF_VAR_aws_access_key=your_aws_access_key TF_VAR_aws_secret_key=your_aws_secret_key TF_VAR_aws_region=your_aws_region TF_VAR_instance_type=your_instance_type TF_VAR_ami=your_ami TF_STATE_BUCKET=your_state_bucket AWS_PROFILE=your_aws_profile
TF_STATE_BUCKET
: The name of the S3 bucket to store the Terraform state fileAWS_PROFILE
: The name of the AWS profile to use in the case of multiple profiles locally
- Run
make init
to initialize the Terraform configuration - Run
make plan
to see the changes that will be applied - Run
make apply
to apply the changes
To destroy the infrastructure, run make destroy
.
To connect to the EC2 instance, run make connect
. It will SSH into the instance using the key pair created on make apply
.
The Makefile contains the following commands:
load_env
: Loads the environment variables from the.env
fileinit
: Initializes the Terraform configuration and loads the environment variables usingload_env
plan
: Shows the changes that will be appliedapply
: Applies the changes to the infrastructure and creates the key pair on~/.ssh/
directorydestroy
: Destroys the infrastructureconnect
: Connects to the EC2 instance by retrieving the public dns and using the key pair created on~/.ssh/
directory