ec2-stopwatch

command module
v0.0.0-...-dc266d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2017 License: MIT Imports: 21 Imported by: 0

README

ec2-stopwatch

USE THIS: https://docs.aws.amazon.com/solutions/latest/ec2-scheduler/welcome.html

NOTE: This is deprecated and will no longer be supported. It's many years old at this point and honestly, putting something that serves this purpose in lambda would be much better. The concept is fine, but this implementation should probably be abandoned for something designed to run on lambda.

HTTP API for managing ec2 instances. Scheduling periods when an instance should be on and off, and also setting instance expiration dates (not yet implemented)

Dependencies

Environment Variables

Variable Name Description
VAULT_ADDR The address where stopwatch will find your vault server (e.g. http://127.0.0.1:8200)
VAULT_TOKEN The Vault Root Token
VAULT_KEY_1 Vault Key 1 to Unseal
VAULT_KEY_2 Vault Key 2 to Unseal
VAULT_KEY_3 Vault Key 3 to Unseal
REDIS_HOST_PORT The host:port for redis (e.g. localhost:6379)
REDIS_PASSWORD The password used to AUTH to redis
SENDGRID_API_TOKEN Sendgrid API Token for Email
EMAIL_FROM_ADDRESS When the application sends email, the From address
STOPWATCH_URL When the application sends links (for email verification) the url at which the user can find stopwatch
AWS_ACCESS_KEY The Access Key used to make AWS API Calls
AWS_SECRET_KEY The Secret Key used to make AWS API Calls

Endpoints

POST /register User registration

Request Body:

{
  "email": "some@email.com"
}
GET /verify/:token Email verification

Private Endpoints

Private endpoints require the Stopwatch-Api-Token header to be included with all requests. The value of this header should be your stopwatch api token.

GET /private/user Get user email from token
POST /private/aws/secrets Store AWS Access/Secret Keys

Request Body:

{
  "access_key_id": "fill_in",
  "secret_key_id": "secrets"
}
POST /private/aws/schedule Create schedule for AWS EC2 instance
{
  "access_key_id": "stuff",
  "instance_id": "placeholder",
  "start": {
    "minute": "38",
    "hour": "15",
    "day_of_month": "*",
    "month": "*",
    "day_of_week": "1-5"
  },
  "end": {
    "minute": "0",
    "hour": "20",
    "day_of_month": "*",
    "month": "*",
    "day_of_week": "1-5"
  },
  "region": "any valid region",
  "ddns": {
    "enabled": "true",
    "domain": "your.domain.com",
    "hosted_zone_id": "placeholder"
  }
}

TODOs

  • Add support for multiple data stores (not just redis)
    • Write data abstraction layer and backend storage drivers for each storage backend
  • Add support for more cloud providers (joyent, azure, google cloud) not just AWS

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/aws/aws-sdk-go/aws
Package aws provides core functionality for making requests to AWS services.
Package aws provides core functionality for making requests to AWS services.
_workspace/src/github.com/aws/aws-sdk-go/aws/awserr
Package awserr represents API error interface accessors for the SDK.
Package awserr represents API error interface accessors for the SDK.
_workspace/src/github.com/aws/aws-sdk-go/aws/credentials
Package credentials provides credential retrieval and management The Credentials is the primary method of getting access to and managing credentials Values.
Package credentials provides credential retrieval and management The Credentials is the primary method of getting access to and managing credentials Values.
_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds
Package stscreds are credential Providers to retrieve STS AWS credentials.
Package stscreds are credential Providers to retrieve STS AWS credentials.
_workspace/src/github.com/aws/aws-sdk-go/internal/endpoints
Package endpoints validates regional endpoints for services.
Package endpoints validates regional endpoints for services.
_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query
Package ec2query provides serialisation of AWS EC2 requests and responses.
Package ec2query provides serialisation of AWS EC2 requests and responses.
_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/query
Package query provides serialisation of AWS query requests, and responses.
Package query provides serialisation of AWS query requests, and responses.
_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/rest
Package rest provides RESTful serialization of AWS requests and responses.
Package rest provides RESTful serialization of AWS requests and responses.
_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/restxml
Package restxml provides RESTful XML serialisation of AWS requests and responses.
Package restxml provides RESTful XML serialisation of AWS requests and responses.
_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil
Package xmlutil provides XML serialisation of AWS requests and responses.
Package xmlutil provides XML serialisation of AWS requests and responses.
_workspace/src/github.com/aws/aws-sdk-go/internal/signer/v4
Package v4 implements signing for AWS V4 signer
Package v4 implements signing for AWS V4 signer
_workspace/src/github.com/aws/aws-sdk-go/service/ec2
Package ec2 provides a client for Amazon Elastic Compute Cloud.
Package ec2 provides a client for Amazon Elastic Compute Cloud.
_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface
Package ec2iface provides an interface for the Amazon Elastic Compute Cloud.
Package ec2iface provides an interface for the Amazon Elastic Compute Cloud.
_workspace/src/github.com/aws/aws-sdk-go/service/route53
Package route53 provides a client for Amazon Route 53.
Package route53 provides a client for Amazon Route 53.
_workspace/src/github.com/aws/aws-sdk-go/service/route53/route53iface
Package route53iface provides an interface for the Amazon Route 53.
Package route53iface provides an interface for the Amazon Route 53.
_workspace/src/github.com/garyburd/redigo/internal/redistest
Package redistest contains utilities for writing Redigo tests.
Package redistest contains utilities for writing Redigo tests.
_workspace/src/github.com/garyburd/redigo/redis
Package redis is a client for the Redis database.
Package redis is a client for the Redis database.
_workspace/src/github.com/hashicorp/hcl
hcl is a package for decoding HCL into usable Go structures.
hcl is a package for decoding HCL into usable Go structures.
_workspace/src/github.com/mitchellh/mapstructure
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure.
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure.
_workspace/src/github.com/robfig/cron
This library implements a cron spec parser and runner.
This library implements a cron spec parser and runner.
_workspace/src/github.com/sendgrid/sendgrid-go
Package sendgrid provides a simple interface to interact with the SendGrid API
Package sendgrid provides a simple interface to interact with the SendGrid API
_workspace/src/github.com/vaughan0/go-ini
Package ini provides functions for parsing INI configuration files.
Package ini provides functions for parsing INI configuration files.
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
_workspace/src/golang.org/x/net/context/ctxhttp
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
_workspace/src/gopkg.in/bluesuncorp/validator.v5
Package validator implements value validations for structs and individual fields based on tags.
Package validator implements value validations for structs and individual fields based on tags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL