-
Clone the Repository
git clone <repository-url> cd <repository-directory>
-
Build the CLI
cd cli go build -o yb_infra main.go
-
Install Terragrunt Follow the Terragrunt installation guide.
-
Navigate to the Infrastructure Directory
cd yb_infra/infra/env/dev
-
Configure Terragrunt Ensure you have the necessary inputs
config.hcl
configuration file. Here is an example configuration:inputs = { environment = "dev" aws_region = "us-west-2" table_name_prefix = "InstanceSchedules" }
-
Apply the Infrastructure Configuration
terragrunt run-all apply -input=false -lock=false -auto-approve --terragrunt-non-interactive
-
Navigate to the Lambda Function Directory
cd lambda
-
Install Dependencies
GOOS=linux GOARCH=amd64 go build -o bootstrap main.go
-
Package the Lambda Function
zip yb_infra.zip bootstrap
-
Deploy the Lambda Function Reapply the Infrastructure Configuration to upload latest lambda code.
./yb_infra create-schedule --cloud-type aws --instance-id <instance-id> --start-time "08:00" --stop-time "20:00" --timezone "IST" --aws-region "us-west-2" --friendly-name "MyInstance"
./yb_infra list-schedules --cloud-type aws
./yb_infra delete-schedule --cloud-type aws --instance-id <instance-id>
Make sure to set the following environment variables before running the CLI:
export TABLE_NAME=your-dynamodb-table