Skip to content

saratkumar-yb/infra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

CLI Build

  1. Clone the Repository

    git clone <repository-url>
    cd <repository-directory>
  2. Build the CLI

    cd cli
    go build -o yb_infra main.go

Infrastructure Creation Using Terragrunt

  1. Install Terragrunt Follow the Terragrunt installation guide.

  2. Navigate to the Infrastructure Directory

    cd yb_infra/infra/env/dev
  3. 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"
    }
  4. Apply the Infrastructure Configuration

    terragrunt run-all apply -input=false -lock=false -auto-approve --terragrunt-non-interactive

Lambda Function Build

  1. Navigate to the Lambda Function Directory

    cd lambda
  2. Install Dependencies

    GOOS=linux GOARCH=amd64 go build -o bootstrap main.go
  3. Package the Lambda Function

    zip yb_infra.zip bootstrap
  4. Deploy the Lambda Function Reapply the Infrastructure Configuration to upload latest lambda code.

Sample CLI Usage

Create Schedule

./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"

List Schedules

./yb_infra list-schedules --cloud-type aws

Delete Schedule

./yb_infra delete-schedule --cloud-type aws --instance-id <instance-id>

Environment Variables

Make sure to set the following environment variables before running the CLI:

export TABLE_NAME=your-dynamodb-table

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published