awsclient

package module
v0.0.0-...-2a37f5f Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

README

awsclient

Synopsis

Package for ease of use of AWS SDK for Go to query AWS resources

Pre-requisite

AWS credentials
The session is created from the configuration values from the shared credentials.
This support has be enabled by setting the environment variable, AWS_SDK_LOAD_CONFIG=1
PACKAGES
go get -u github.com/aws/aws-sdk-go
go get -u github.com/awslabs/aws-sdk-go/aws
go get -u github.com/aws/aws-sdk-go/service/ec2
go get -u github.com/aws/aws-sdk-go/service/elb

Exported Functions

New()

Loads session from shared config and returns a pointer to a client

Returns: *awsclient.AWSClient

(*awsclient.AWSClient) FindEC2InstancesByTagName

Takes a keyword string that can have a wildcard and looks for EC2 instances that have a tag Name with the value

Input:
  keyword string

Returns:
  []EC2InstanceInfo,
  error

(*awsclient.AWSClient) FindEC2InstanceByID

Finds an ec2 instance based on InstanceID

Input:
  instanceID string

Returns:
  []EC2InstanceInfo,
  error
(*awsclient.AWSClient) FindLoadBalancersByName

Looks for a load Balancer based on the name passed to it. No wildcard characters allowed. Full case sensitive names needed.

Input:
  name string

Returns:
  []ELBInfo,
  error

Reference

https://aws.amazon.com/sdk-for-go/

Contributors

Maria DeSouza maria.g.desouza@gmail.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSClient

type AWSClient struct {
	AWSSession *session.Session
	EC2Client  *ec2.EC2
	ELBClient  *elb.ELB
}

AWSClient : struct that has session varibales to use to qury AWS

func New

func New() *AWSClient

New : Establish aws session using SharedConfigState

func (*AWSClient) FindEC2InstanceByID

func (client *AWSClient) FindEC2InstanceByID(instanceID string) (*EC2InstanceInfo, error)

FindEC2InstanceByID : Find EC2 Instance By instance ID

func (*AWSClient) FindEC2InstancesByTagName

func (client *AWSClient) FindEC2InstancesByTagName(keyword string) ([]EC2InstanceInfo, error)

FindEC2InstancesByTagName : keyword string can have a wildcard

func (*AWSClient) FindLoadBalancersByName

func (client *AWSClient) FindLoadBalancersByName(name string) ([]ELBInfo, error)

FindLoadBalancersByName : FindLoadBalancers by Name - no wild card

type EC2InstanceInfo

type EC2InstanceInfo struct {
	InstanceID  string
	IPAddress   string
	Status      string
	Name        string
	Environment string
	KeyName     string
}

EC2InstanceInfo : Struct that contains basic info for ec2 instnaces

type ELBInfo

type ELBInfo struct {
	DNSName                string
	NumOfInstancesAttached int
	InstanceIDS            string
	SSLCert                string
	ListenStatus           string
}

ELBInfo : Struct that contains basic info for load balancer

Jump to

Keyboard shortcuts

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