Documentation ¶
Index ¶
- func GetCredentialsFromRole(sess *session.Session) (*credentials.Credentials, error)
- func GetCredentialsFromRoleWithoutSession(region string) (*credentials.Credentials, error)
- type Client
- func (c *Client) CreateInstance(instanceType string, iamProfile string, imageID string, subnetId string, ...) (*ec2.Reservation, error)
- func (c *Client) CreateInstanceAndWaitUntilReady(instanceName string, instanceType string, iamProfile string, imageID string, ...) error
- func (c *Client) CreateSpotInstanceAndWaitUntilReady(instanceName string, instanceType string, iamProfile string, imageID string, ...) error
- func (c *Client) GetAllPrivateIPsOfStackByChildPrivateDNSName(childPrivateDNSName string) ([]*string, error)
- func (c *Client) GetAllPrivateIPsOfStackByStackID(stackID *string) ([]*string, error)
- func (c *Client) GetAllRunningInstanceIDs() ([]*string, error)
- func (c *Client) GetAllRunningInstanceIDsFilteredByName(name string) ([]*string, error)
- func (c *Client) GetAllRunningInstancesFilteredByTag(tag string, value string) ([]*ec2.Instance, error)
- func (c *Client) GetInstancesInfos(params *ec2.DescribeInstancesInput, mapFunc interface{}) (interface{}, error)
- func (c *Client) GetStackIDByPrivateDNSName(dnsName string) (*string, error)
- func (c *Client) RequestSpotInstance(instanceType string, iamProfile string, imageID string, subnetId string, ...) (*ec2.RequestSpotInstancesOutput, error)
- func (c *Client) RestoreRunningInstancesByName(name string) error
- func (c *Client) SetTags(instanceName string, instanceIDs []*string) error
- func (c *Client) TerminateAllEC2Instances() (*ec2.TerminateInstancesOutput, error)
- func (c *Client) TerminateAllEC2InstancesAndWait() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCredentialsFromRole ¶
func GetCredentialsFromRole(sess *session.Session) (*credentials.Credentials, error)
GetCredentialsFromRole get credentials from role when app is running in ec2
func GetCredentialsFromRoleWithoutSession ¶
func GetCredentialsFromRoleWithoutSession(region string) (*credentials.Credentials, error)
GetCredentialsFromRoleWithoutSession get credentials from role when app is running in ec2
Types ¶
type Client ¶
type Client struct { Client *ec2.EC2 Session *session.Session Ec2InstanceIps []string Ec2InstancePrivateIps []string // contains filtered or unexported fields }
Client ...
func NewEC2Client ¶
NewEC2Client ... ctor region is the region of the bucket you want to access leave it blank to use AWS_REGION environment variable
func NewEC2ClientWithSession ¶
NewEC2ClientWithSession ... ctor
func (*Client) CreateInstance ¶
func (c *Client) CreateInstance(instanceType string, iamProfile string, imageID string, subnetId string, securityGroupIDs []string, userData string, keyName string, minCount int64, maxCount int64) (*ec2.Reservation, error)
CreateInstance creates an EC2 instance
func (*Client) CreateInstanceAndWaitUntilReady ¶
func (c *Client) CreateInstanceAndWaitUntilReady(instanceName string, instanceType string, iamProfile string, imageID string, subnetId string, securityGroupIDs []string, spotPrice string, userData string, keyName string, minCount int64, maxCount int64) error
CreateInstanceAndWaitUntilReady creates a ec2 spot instance and waits until it is ready
func (*Client) CreateSpotInstanceAndWaitUntilReady ¶
func (c *Client) CreateSpotInstanceAndWaitUntilReady(instanceName string, instanceType string, iamProfile string, imageID string, subnetId string, securityGroupIDs []string, spotPrice string, userData string, keyName string, instanceCount int64) error
CreateSpotInstanceAndWaitUntilReady creates a ec2 spot instance and waits until it is ready
func (*Client) GetAllPrivateIPsOfStackByChildPrivateDNSName ¶ added in v1.4.0
func (c *Client) GetAllPrivateIPsOfStackByChildPrivateDNSName(childPrivateDNSName string) ([]*string, error)
GetAllPrivateIPsOfStackByChildPrivateDNSName returns all private IPs of the stack of a given child private DNS name
func (*Client) GetAllPrivateIPsOfStackByStackID ¶ added in v1.4.0
GetAllPrivateIPsOfStackByStackID returns all private IPs of the stack of a given stack ID
func (*Client) GetAllRunningInstanceIDs ¶
GetAllRunningInstanceIDs returns all running instance IDs of region account
func (*Client) GetAllRunningInstanceIDsFilteredByName ¶
GetAllRunningInstanceIDsFilteredByName returns all running instances ids filtered by name name is the name of the instance as defined in the tag "Name" it is also possible to use wildcards in the name e.g. "*my-*" or "my-*"
func (*Client) GetAllRunningInstancesFilteredByTag ¶
func (c *Client) GetAllRunningInstancesFilteredByTag(tag string, value string) ([]*ec2.Instance, error)
GetAllRunningInstanceIDsFilteredByTagNameAndValue returns all running instances filtered by tag name and value
func (*Client) GetInstancesInfos ¶
func (c *Client) GetInstancesInfos(params *ec2.DescribeInstancesInput, mapFunc interface{}) (interface{}, error)
GetInstancesInfos returns a list of instances infos matching the given filters
func (*Client) GetStackIDByPrivateDNSName ¶ added in v1.4.0
GetStackIDByPrivateDNSName returns the stack ID of a given private DNS name of a stack child
func (*Client) RequestSpotInstance ¶
func (c *Client) RequestSpotInstance(instanceType string, iamProfile string, imageID string, subnetId string, securityGroupIDs []string, spotPrice string, userData string, keyName string, instanceCount int64) (*ec2.RequestSpotInstancesOutput, error)
CreateSpotInstance creates a ec2 spot instance
func (*Client) RestoreRunningInstancesByName ¶
GetAllRunningInstancesByName returns all running instances with the given name to the client name is the name of the instance as defined in the tag "Name" it is also possible to use wildcards in the name e.g. "*my-*" or "my-*"
func (*Client) TerminateAllEC2Instances ¶
func (c *Client) TerminateAllEC2Instances() (*ec2.TerminateInstancesOutput, error)
TerminateAllEC2Instances terminate all running EC2 instances created by this client
func (*Client) TerminateAllEC2InstancesAndWait ¶
TerminateAllEC2InstancesAndWait terminate all running EC2 instances created by this client and wait until shutdown