Documentation ¶
Overview ¶
Package aws allows to interact with resources on Amazon Web Services.
Index ¶
- Constants
- func AddTagsToResource(t *testing.T, region string, resource string, tags map[string]string)
- func AddTagsToResourceE(t *testing.T, region string, resource string, tags map[string]string) error
- func AssertS3BucketExists(t *testing.T, region string, name string)
- func AssertS3BucketExistsE(t *testing.T, region string, name string) error
- func AssumeRole(sess *session.Session, roleARN string) *session.Session
- func CreateAwsCredentials(accessKeyID string, secretAccessKey string) *credentials.Credentials
- func CreateAwsCredentialsWithSessionToken(accessKeyID, secretAccessKey, sessionToken string) *credentials.Credentials
- func CreateAwsSessionFromRole(region string, roleARN string) (*session.Session, error)
- func CreateAwsSessionWithCreds(region string, accessKeyID string, secretAccessKey string) (*session.Session, error)
- func CreateAwsSessionWithMfa(region string, stsClient *sts.STS, mfaDevice *iam.VirtualMFADevice) (*session.Session, error)
- func CreateMfaDevice(t *testing.T, iamClient *iam.IAM, deviceName string) *iam.VirtualMFADevice
- func CreateMfaDeviceE(t *testing.T, iamClient *iam.IAM, deviceName string) (*iam.VirtualMFADevice, error)
- func CreateRandomQueue(t *testing.T, awsRegion string, prefix string) string
- func CreateRandomQueueE(t *testing.T, awsRegion string, prefix string) (string, error)
- func CreateS3Bucket(t *testing.T, region string, name string)
- func CreateS3BucketE(t *testing.T, region string, name string) error
- func CreateSnsTopic(t *testing.T, region string, snsTopicName string) string
- func CreateSnsTopicE(t *testing.T, region string, snsTopicName string) (string, error)
- func DeleteAmi(t *testing.T, region string, imageID string)
- func DeleteAmiAndAllSnapshots(t *testing.T, region string, ami string)
- func DeleteAmiAndAllSnapshotsE(t *testing.T, region string, ami string) error
- func DeleteAmiE(t *testing.T, region string, imageID string) error
- func DeleteEC2KeyPair(t *testing.T, keyPair *Ec2Keypair)
- func DeleteEC2KeyPairE(t *testing.T, keyPair *Ec2Keypair) error
- func DeleteEbsSnapshot(t *testing.T, region string, snapshot string)
- func DeleteEbsSnapshotE(t *testing.T, region string, snapshot string) error
- func DeleteMessageFromQueue(t *testing.T, awsRegion string, queueURL string, receipt string)
- func DeleteMessageFromQueueE(t *testing.T, awsRegion string, queueURL string, receipt string) error
- func DeleteQueue(t *testing.T, awsRegion string, queueURL string)
- func DeleteQueueE(t *testing.T, awsRegion string, queueURL string) error
- func DeleteS3Bucket(t *testing.T, region string, name string)
- func DeleteS3BucketE(t *testing.T, region string, name string) error
- func DeleteSNSTopic(t *testing.T, region string, snsTopicArn string)
- func DeleteSNSTopicE(t *testing.T, region string, snsTopicArn string) error
- func EmptyS3Bucket(t *testing.T, region string, name string)
- func EmptyS3BucketE(t *testing.T, region string, name string) error
- func EnableMfaDevice(t *testing.T, iamClient *iam.IAM, mfaDevice *iam.VirtualMFADevice)
- func EnableMfaDeviceE(t *testing.T, iamClient *iam.IAM, mfaDevice *iam.VirtualMFADevice) error
- func FindS3BucketWithTag(t *testing.T, awsRegion string, key string, value string) string
- func FindS3BucketWithTagE(t *testing.T, awsRegion string, key string, value string) (string, error)
- func FindVpcName(vpc *ec2.Vpc) string
- func GetAccountId(t *testing.T) string
- func GetAccountIdE(t *testing.T) (string, error)
- func GetAcmCertificateArn(t *testing.T, awsRegion string, certDomainName string) string
- func GetAcmCertificateArnE(t *testing.T, awsRegion string, certDomainName string) (string, error)
- func GetAllAwsRegions(t *testing.T) []string
- func GetAllAwsRegionsE(t *testing.T) ([]string, error)
- func GetAmazonLinuxAmi(t *testing.T, region string) string
- func GetAmazonLinuxAmiE(t *testing.T, region string) (string, error)
- func GetAvailabilityZones(t *testing.T, region string) []string
- func GetAvailabilityZonesE(t *testing.T, region string) ([]string, error)
- func GetCentos7Ami(t *testing.T, region string) string
- func GetCentos7AmiE(t *testing.T, region string) (string, error)
- func GetCloudWatchLogEntries(t *testing.T, awsRegion string, logStreamName string, logGroupName string) []string
- func GetCloudWatchLogEntriesE(t *testing.T, awsRegion string, logStreamName string, logGroupName string) ([]string, error)
- func GetCmkArn(t *testing.T, region string, cmkID string) string
- func GetCmkArnE(t *testing.T, region string, cmkID string) (string, error)
- func GetEbsSnapshotsForAmi(t *testing.T, region string, ami string) []string
- func GetEbsSnapshotsForAmiE(t *testing.T, region string, ami string) ([]string, error)
- func GetEc2InstanceIdsByTag(t *testing.T, region string, tagName string, tagValue string) []string
- func GetEc2InstanceIdsByTagE(t *testing.T, region string, tagName string, tagValue string) ([]string, error)
- func GetEcsOptimizedAmazonLinuxAmi(t *testing.T, region string) string
- func GetEcsOptimizedAmazonLinuxAmiE(t *testing.T, region string) (string, error)
- func GetFirstTwoOctets(cidrBlock string) string
- func GetIamCurrentUserArn(t *testing.T) string
- func GetIamCurrentUserArnE(t *testing.T) (string, error)
- func GetIamCurrentUserName(t *testing.T) string
- func GetIamCurrentUserNameE(t *testing.T) (string, error)
- func GetInstanceIdsForAsg(t *testing.T, asgName string, awsRegion string) []string
- func GetInstanceIdsForAsgE(t *testing.T, asgName string, awsRegion string) ([]string, error)
- func GetMostRecentAmiId(t *testing.T, region string, ownerId string, filters map[string][]string) string
- func GetMostRecentAmiIdE(t *testing.T, region string, ownerId string, filters map[string][]string) (string, error)
- func GetPublicIpOfEc2Instance(t *testing.T, instanceID string, awsRegion string) string
- func GetPublicIpOfEc2InstanceE(t *testing.T, instanceID string, awsRegion string) (string, error)
- func GetPublicIpsOfEc2Instances(t *testing.T, instanceIDs []string, awsRegion string) map[string]string
- func GetPublicIpsOfEc2InstancesE(t *testing.T, instanceIDs []string, awsRegion string) (map[string]string, error)
- func GetRandomPrivateCidrBlock(routingPrefix int) string
- func GetRandomRegion(t *testing.T, approvedRegions []string, forbiddenRegions []string) string
- func GetRandomRegionE(t *testing.T, approvedRegions []string, forbiddenRegions []string) (string, error)
- func GetS3ObjectContents(t *testing.T, awsRegion string, bucket string, key string) string
- func GetS3ObjectContentsE(t *testing.T, awsRegion string, bucket string, key string) (string, error)
- func GetSyslogForInstance(t *testing.T, instanceID string, awsRegion string) string
- func GetSyslogForInstanceE(t *testing.T, instanceID string, region string) (string, error)
- func GetSyslogForInstancesInAsg(t *testing.T, asgName string, awsRegion string) map[string]string
- func GetSyslogForInstancesInAsgE(t *testing.T, asgName string, awsRegion string) (map[string]string, error)
- func GetTagsForEc2Instance(t *testing.T, region string, instanceID string) map[string]string
- func GetTagsForEc2InstanceE(t *testing.T, region string, instanceID string) (map[string]string, error)
- func GetTimeBasedOneTimePassword(mfaDevice *iam.VirtualMFADevice) (string, error)
- func GetUbuntu1404Ami(t *testing.T, region string) string
- func GetUbuntu1404AmiE(t *testing.T, region string) (string, error)
- func GetUbuntu1604Ami(t *testing.T, region string) string
- func GetUbuntu1604AmiE(t *testing.T, region string) (string, error)
- func NewAcmClient(t *testing.T, region string) *acm.ACM
- func NewAcmClientE(t *testing.T, awsRegion string) (*acm.ACM, error)
- func NewAsgClient(t *testing.T, region string) *autoscaling.AutoScaling
- func NewAsgClientE(t *testing.T, region string) (*autoscaling.AutoScaling, error)
- func NewAuthenticatedSession(region string) (*session.Session, error)
- func NewAuthenticatedSessionFromRole(region string, roleARN string) (*session.Session, error)
- func NewCloudWatchLogsClient(t *testing.T, region string) *cloudwatchlogs.CloudWatchLogs
- func NewCloudWatchLogsClientE(t *testing.T, region string) (*cloudwatchlogs.CloudWatchLogs, error)
- func NewEc2Client(t *testing.T, region string) *ec2.EC2
- func NewEc2ClientE(t *testing.T, region string) (*ec2.EC2, error)
- func NewIamClient(t *testing.T, region string) *iam.IAM
- func NewIamClientE(t *testing.T, region string) (*iam.IAM, error)
- func NewKmsClient(t *testing.T, region string) *kms.KMS
- func NewKmsClientE(t *testing.T, region string) (*kms.KMS, error)
- func NewS3Client(t *testing.T, region string) *s3.S3
- func NewS3ClientE(t *testing.T, region string) (*s3.S3, error)
- func NewS3Uploader(t *testing.T, region string) *s3manager.Uploader
- func NewS3UploaderE(t *testing.T, region string) (*s3manager.Uploader, error)
- func NewSnsClient(t *testing.T, region string) *sns.SNS
- func NewSnsClientE(t *testing.T, region string) (*sns.SNS, error)
- func NewSqsClient(t *testing.T, region string) *sqs.SQS
- func NewSqsClientE(t *testing.T, region string) (*sqs.SQS, error)
- func ReadPasswordPolicyMinPasswordLength(iamClient *iam.IAM) (int, error)
- func SendMessageToQueue(t *testing.T, awsRegion string, queueURL string, message string)
- func SendMessageToQueueE(t *testing.T, awsRegion string, queueURL string, message string) error
- func TerminateInstance(t *testing.T, region string, instanceID string)
- func TerminateInstanceE(t *testing.T, region string, instanceID string) error
- type CredentialsError
- type Ec2Keypair
- func CreateAndImportEC2KeyPair(t *testing.T, region string, name string) *Ec2Keypair
- func CreateAndImportEC2KeyPairE(t *testing.T, region string, name string) (*Ec2Keypair, error)
- func ImportEC2KeyPair(t *testing.T, region string, name string, keyPair *ssh.KeyPair) *Ec2Keypair
- func ImportEC2KeyPairE(t *testing.T, region string, name string, keyPair *ssh.KeyPair) (*Ec2Keypair, error)
- type IpForEc2InstanceNotFound
- type NoImagesFound
- type QueueMessageResponse
- type ReceiveMessageTimeout
- type Subnet
- type Vpc
Constants ¶
const ( CanonicalAccountId = "099720109477" CentOsAccountId = "679593333241" AmazonAccountId = "amazon" )
These are commonly used AMI account IDs.
Variables ¶
This section is empty.
Functions ¶
func AddTagsToResource ¶ added in v0.9.11
AddTagsToResource adds the tags to the given taggable AWS resource such as EC2, AMI or VPC.
func AddTagsToResourceE ¶ added in v0.9.11
AddTagsToResourceE adds the tags to the given taggable AWS resource such as EC2, AMI or VPC.
func AssertS3BucketExists ¶
AssertS3BucketExists checks if the given S3 bucket exists in the given region and fail the test if it does not.
func AssertS3BucketExistsE ¶
AssertS3BucketExistsE checks if the given S3 bucket exists in the given region and return an error if it does not.
func AssumeRole ¶ added in v0.9.3
AssumeRole mutates the provided session by obtaining new credentials by assuming the role provided in roleARN.
func CreateAwsCredentials ¶
func CreateAwsCredentials(accessKeyID string, secretAccessKey string) *credentials.Credentials
CreateAwsCredentials creates an AWS Credentials configuration with specific AWS credentials.
func CreateAwsCredentialsWithSessionToken ¶
func CreateAwsCredentialsWithSessionToken(accessKeyID, secretAccessKey, sessionToken string) *credentials.Credentials
CreateAwsCredentialsWithSessionToken creates an AWS Credentials configuration with temporary AWS credentials by including a session token (used for authenticating with MFA).
func CreateAwsSessionFromRole ¶ added in v0.9.3
CreateAwsSessionFromRole returns a new AWS session after assuming the role whose ARN is provided in roleARN.
func CreateAwsSessionWithCreds ¶
func CreateAwsSessionWithCreds(region string, accessKeyID string, secretAccessKey string) (*session.Session, error)
CreateAwsSessionWithCreds creates a new AWS session using explicit credentials. This is useful if you want to create an IAM User dynamically and create an AWS session authenticated as the new IAM User.
func CreateAwsSessionWithMfa ¶
func CreateAwsSessionWithMfa(region string, stsClient *sts.STS, mfaDevice *iam.VirtualMFADevice) (*session.Session, error)
CreateAwsSessionWithMfa creates a new AWS session authenticated using an MFA token retrieved using the given STS client and MFA Device.
func CreateMfaDevice ¶
CreateMfaDevice creates an MFA device using the given IAM client.
func CreateMfaDeviceE ¶
func CreateMfaDeviceE(t *testing.T, iamClient *iam.IAM, deviceName string) (*iam.VirtualMFADevice, error)
CreateMfaDeviceE creates an MFA device using the given IAM client.
func CreateRandomQueue ¶
CreateRandomQueue creates a new SQS queue with a random name that starts with the given prefix and return the queue URL.
func CreateRandomQueueE ¶
CreateRandomQueueE creates a new SQS queue with a random name that starts with the given prefix and return the queue URL.
func CreateS3Bucket ¶
CreateS3Bucket creates an S3 bucket in the given region with the given name. Note that S3 bucket names must be globally unique.
func CreateS3BucketE ¶
CreateS3BucketE creates an S3 bucket in the given region with the given name. Note that S3 bucket names must be globally unique.
func CreateSnsTopic ¶
CreateSnsTopic creates an SNS Topic and return the ARN.
func CreateSnsTopicE ¶
CreateSnsTopicE creates an SNS Topic and return the ARN.
func DeleteAmiAndAllSnapshots ¶ added in v0.9.9
DeleteAmiAndAllSnapshots will delete the given AMI along with all EBS snapshots that backed that AMI
func DeleteAmiAndAllSnapshotsE ¶ added in v0.9.9
DeleteAmiAndAllSnapshotsE will delete the given AMI along with all EBS snapshots that backed that AMI
func DeleteAmiE ¶
DeleteAmiE deletes the given AMI in the given region.
func DeleteEC2KeyPair ¶
func DeleteEC2KeyPair(t *testing.T, keyPair *Ec2Keypair)
DeleteEC2KeyPair deletes an EC2 key pair.
func DeleteEC2KeyPairE ¶
func DeleteEC2KeyPairE(t *testing.T, keyPair *Ec2Keypair) error
DeleteEC2KeyPairE deletes an EC2 key pair.
func DeleteEbsSnapshot ¶ added in v0.9.9
DeleteEbsSnapshot deletes the given EBS snapshot
func DeleteEbsSnapshotE ¶ added in v0.9.9
DeleteEbsSnapshot deletes the given EBS snapshot
func DeleteMessageFromQueue ¶
DeleteMessageFromQueue deletes the message with the given receipt from the SQS queue with the given URL.
func DeleteMessageFromQueueE ¶
DeleteMessageFromQueueE deletes the message with the given receipt from the SQS queue with the given URL.
func DeleteQueue ¶
DeleteQueue deletes the SQS queue with the given URL.
func DeleteQueueE ¶
DeleteQueueE deletes the SQS queue with the given URL.
func DeleteS3Bucket ¶
DeleteS3Bucket destroys the S3 bucket in the given region with the given name.
func DeleteS3BucketE ¶
DeleteS3BucketE destroys the S3 bucket in the given region with the given name.
func DeleteSNSTopic ¶
DeleteSNSTopic deletes an SNS Topic.
func DeleteSNSTopicE ¶
DeleteSNSTopicE deletes an SNS Topic.
func EmptyS3Bucket ¶ added in v0.9.15
EmptyS3BucketE removes the contents of an S3 bucket in the given region with the given name.
func EmptyS3BucketE ¶ added in v0.9.15
EmptyS3BucketE removes the contents of an S3 bucket in the given region with the given name.
func EnableMfaDevice ¶
EnableMfaDevice enables a newly created MFA Device by supplying the first two one-time passwords, so that it can be used for future logins by the given IAM User.
func EnableMfaDeviceE ¶
EnableMfaDeviceE enables a newly created MFA Device by supplying the first two one-time passwords, so that it can be used for future logins by the given IAM User.
func FindS3BucketWithTag ¶
FindS3BucketWithTag finds the name of the S3 bucket in the given region with the given tag key=value.
func FindS3BucketWithTagE ¶
FindS3BucketWithTagE finds the name of the S3 bucket in the given region with the given tag key=value.
func FindVpcName ¶
FindVpcName extracts the VPC name from its tags (if any). Fall back to "Default" if it's the default VPC or empty string otherwise.
func GetAccountId ¶
GetAccountId gets the Account ID for the currently logged in IAM User.
func GetAccountIdE ¶
GetAccountIdE gets the Account ID for the currently logged in IAM User.
func GetAcmCertificateArn ¶
GetAcmCertificateArn gets the ACM certificate for the given domain name in the given region.
func GetAcmCertificateArnE ¶ added in v0.9.0
GetAcmCertificateArnE gets the ACM certificate for the given domain name in the given region.
func GetAllAwsRegions ¶
GetAllAwsRegions gets the list of AWS regions available in this account.
func GetAllAwsRegionsE ¶
GetAllAwsRegionsE gets the list of AWS regions available in this account.
func GetAmazonLinuxAmi ¶
GetAmazonLinuxAmi returns an Amazon Linux AMI HVM, SSD Volume Type public AMI for the given region.
func GetAmazonLinuxAmiE ¶
GetAmazonLinuxAmiE returns an Amazon Linux AMI HVM, SSD Volume Type public AMI for the given region.
func GetAvailabilityZones ¶
GetAvailabilityZones gets the Availability Zones for a given AWS region. Note that for certain regions (e.g. us-east-1), different AWS accounts have access to different availability zones.
func GetAvailabilityZonesE ¶
GetAvailabilityZonesE gets the Availability Zones for a given AWS region. Note that for certain regions (e.g. us-east-1), different AWS accounts have access to different availability zones.
func GetCentos7Ami ¶
GetCentos7Ami returns a CentOS 7 public AMI from the given region. WARNING: you may have to accept the terms & conditions of this AMI in AWS MarketPlace for your AWS Account before you can successfully launch the AMI.
func GetCentos7AmiE ¶
GetCentos7AmiE returns a CentOS 7 public AMI from the given region. WARNING: you may have to accept the terms & conditions of this AMI in AWS MarketPlace for your AWS Account before you can successfully launch the AMI.
func GetCloudWatchLogEntries ¶
func GetCloudWatchLogEntries(t *testing.T, awsRegion string, logStreamName string, logGroupName string) []string
GetCloudWatchLogEntries returns the CloudWatch log messages in the given region for the given log stream and log group.
func GetCloudWatchLogEntriesE ¶
func GetCloudWatchLogEntriesE(t *testing.T, awsRegion string, logStreamName string, logGroupName string) ([]string, error)
GetCloudWatchLogEntriesE returns the CloudWatch log messages in the given region for the given log stream and log group.
func GetCmkArn ¶
GetCmkArn gets the ARN of a KMS Customer Master Key (CMK) in the given region with the given ID. The ID can be an alias, such as "alias/my-cmk".
func GetCmkArnE ¶
GetCmkArnE gets the ARN of a KMS Customer Master Key (CMK) in the given region with the given ID. The ID can be an alias, such as "alias/my-cmk".
func GetEbsSnapshotsForAmi ¶ added in v0.9.9
GetEbsSnapshotsForAmi retrieves the EBS snapshots which back the given AMI
func GetEbsSnapshotsForAmiE ¶ added in v0.9.9
GetEbsSnapshotsForAmi retrieves the EBS snapshots which back the given AMI
func GetEc2InstanceIdsByTag ¶
GetEc2InstanceIdsByTag returns all the IDs of EC2 instances in the given region with the given tag.
func GetEc2InstanceIdsByTagE ¶
func GetEc2InstanceIdsByTagE(t *testing.T, region string, tagName string, tagValue string) ([]string, error)
GetEc2InstanceIdsByTagE returns all the IDs of EC2 instances in the given region with the given tag.
func GetEcsOptimizedAmazonLinuxAmi ¶
GetEcsOptimizedAmazonLinuxAmi returns an Amazon ECS-Optimized Amazon Linux AMI for the given region. This AMI is useful for running an ECS cluster.
func GetEcsOptimizedAmazonLinuxAmiE ¶
GetEcsOptimizedAmazonLinuxAmiE returns an Amazon ECS-Optimized Amazon Linux AMI for the given region. This AMI is useful for running an ECS cluster.
func GetFirstTwoOctets ¶
GetFirstTwoOctets gets the first two octets from a CIDR block.
func GetIamCurrentUserArn ¶
GetIamCurrentUserArn gets the ARN for the current IAM user.
func GetIamCurrentUserArnE ¶
GetIamCurrentUserArnE gets the ARN for the current IAM user.
func GetIamCurrentUserName ¶
GetIamCurrentUserName gets the username for the current IAM user.
func GetIamCurrentUserNameE ¶
GetIamCurrentUserNameE gets the username for the current IAM user.
func GetInstanceIdsForAsg ¶ added in v0.9.0
GetInstanceIdsForAsg gets the IDs of EC2 Instances in the given ASG.
func GetInstanceIdsForAsgE ¶ added in v0.9.0
GetInstanceIdsForAsgE gets the IDs of EC2 Instances in the given ASG.
func GetMostRecentAmiId ¶
func GetMostRecentAmiId(t *testing.T, region string, ownerId string, filters map[string][]string) string
GetMostRecentAmiId gets the ID of the most recent AMI in the given region that has the given owner and matches the given filters. Each filter should correspond to the name and values of a filter supported by DescribeImagesInput: https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#DescribeImagesInput
func GetMostRecentAmiIdE ¶
func GetMostRecentAmiIdE(t *testing.T, region string, ownerId string, filters map[string][]string) (string, error)
GetMostRecentAmiIdE gets the ID of the most recent AMI in the given region that has the given owner and matches the given filters. Each filter should correspond to the name and values of a filter supported by DescribeImagesInput: https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#DescribeImagesInput
func GetPublicIpOfEc2Instance ¶ added in v0.9.0
GetPublicIpOfEc2Instance gets the public IP address of the given EC2 Instance in the given region.
func GetPublicIpOfEc2InstanceE ¶ added in v0.9.0
GetPublicIpOfEc2InstanceE gets the public IP address of the given EC2 Instance in the given region.
func GetPublicIpsOfEc2Instances ¶ added in v0.9.1
func GetPublicIpsOfEc2Instances(t *testing.T, instanceIDs []string, awsRegion string) map[string]string
GetPublicIpsOfEc2Instances gets the public IP address of the given EC2 Instance in the given region. Returns a map of instance ID to IP address.
func GetPublicIpsOfEc2InstancesE ¶ added in v0.9.1
func GetPublicIpsOfEc2InstancesE(t *testing.T, instanceIDs []string, awsRegion string) (map[string]string, error)
GetPublicIpsOfEc2InstancesE gets the public IP address of the given EC2 Instance in the given region. Returns a map of instance ID to IP address.
func GetRandomPrivateCidrBlock ¶
GetRandomPrivateCidrBlock gets a random CIDR block from the range of acceptable private IP addresses per RFC 1918 (https://tools.ietf.org/html/rfc1918#section-3) The routingPrefix refers to the "/28" in 1.2.3.4/28. Note that, as written, this function will return a subset of all valid ranges. Since we will probably use this function mostly for generating random CIDR ranges for VPCs and Subnets, having comprehensive set coverage is not essential.
func GetRandomRegion ¶
GetRandomRegion gets a randomly chosen AWS region. If approvedRegions is not empty, this will be a region from the approvedRegions list; otherwise, this method will fetch the latest list of regions from the AWS APIs and pick one of those. If forbiddenRegions is not empty, this method will make sure the returned region is not in the forbiddenRegions list.
func GetRandomRegionE ¶
func GetRandomRegionE(t *testing.T, approvedRegions []string, forbiddenRegions []string) (string, error)
GetRandomRegionE gets a randomly chosen AWS region. If approvedRegions is not empty, this will be a region from the approvedRegions list; otherwise, this method will fetch the latest list of regions from the AWS APIs and pick one of those. If forbiddenRegions is not empty, this method will make sure the returned region is not in the forbiddenRegions list.
func GetS3ObjectContents ¶
GetS3ObjectContents fetches the contents of the object in the given bucket with the given key and return it as a string.
func GetS3ObjectContentsE ¶
func GetS3ObjectContentsE(t *testing.T, awsRegion string, bucket string, key string) (string, error)
GetS3ObjectContentsE fetches the contents of the object in the given bucket with the given key and return it as a string.
func GetSyslogForInstance ¶
GetSyslogForInstance gets the syslog for the Instance with the given ID in the given region. This should be available ~1 minute after an Instance boots and is very useful for debugging boot-time issues, such as an error in User Data.
func GetSyslogForInstanceE ¶
GetSyslogForInstanceE gets the syslog for the Instance with the given ID in the given region. This should be available ~1 minute after an Instance boots and is very useful for debugging boot-time issues, such as an error in User Data.
func GetSyslogForInstancesInAsg ¶
GetSyslogForInstancesInAsg gets the syslog for each of the Instances in the given ASG in the given region. These logs should be available ~1 minute after the Instance boots and are very useful for debugging boot-time issues, such as an error in User Data. Returns a map of Instance Id -> Syslog for that Instance.
func GetSyslogForInstancesInAsgE ¶
func GetSyslogForInstancesInAsgE(t *testing.T, asgName string, awsRegion string) (map[string]string, error)
GetSyslogForInstancesInAsgE gets the syslog for each of the Instances in the given ASG in the given region. These logs should be available ~1 minute after the Instance boots and are very useful for debugging boot-time issues, such as an error in User Data. Returns a map of Instance Id -> Syslog for that Instance.
func GetTagsForEc2Instance ¶
GetTagsForEc2Instance returns all the tags for the given EC2 Instance.
func GetTagsForEc2InstanceE ¶
func GetTagsForEc2InstanceE(t *testing.T, region string, instanceID string) (map[string]string, error)
GetTagsForEc2InstanceE returns all the tags for the given EC2 Instance.
func GetTimeBasedOneTimePassword ¶
func GetTimeBasedOneTimePassword(mfaDevice *iam.VirtualMFADevice) (string, error)
GetTimeBasedOneTimePassword gets a One-Time Password from the given mfaDevice. Per the RFC 6238 standard, this value will be different every 30 seconds.
func GetUbuntu1404Ami ¶
GetUbuntu1404Ami gets the ID of the most recent Ubuntu 14.04 HVM x86_64 EBS GP2 AMI in the given region.
func GetUbuntu1404AmiE ¶
GetUbuntu1404AmiE gets the ID of the most recent Ubuntu 14.04 HVM x86_64 EBS GP2 AMI in the given region.
func GetUbuntu1604Ami ¶
GetUbuntu1604Ami gets the ID of the most recent Ubuntu 16.04 HVM x86_64 EBS GP2 AMI in the given region.
func GetUbuntu1604AmiE ¶
GetUbuntu1604AmiE gets the ID of the most recent Ubuntu 16.04 HVM x86_64 EBS GP2 AMI in the given region.
func NewAcmClient ¶
NewAcmClient create a new ACM client.
func NewAcmClientE ¶ added in v0.9.0
NewAcmClientE creates a new ACM client.
func NewAsgClient ¶ added in v0.9.0
func NewAsgClient(t *testing.T, region string) *autoscaling.AutoScaling
NewAsgClient creates an Auto Scaling Group client.
func NewAsgClientE ¶ added in v0.9.0
func NewAsgClientE(t *testing.T, region string) (*autoscaling.AutoScaling, error)
NewAsgClientE creates an Auto Scaling Group client.
func NewAuthenticatedSession ¶
NewAuthenticatedSession gets an AWS Session, checking that the user has credentials properly configured in their environment.
func NewAuthenticatedSessionFromRole ¶ added in v0.9.3
NewAuthenticatedSessionFromRole returns a new AWS Session after assuming the role whose ARN is provided in roleARN. If the credentials are not properly configured in the underlying environment, an error is returned.
func NewCloudWatchLogsClient ¶
func NewCloudWatchLogsClient(t *testing.T, region string) *cloudwatchlogs.CloudWatchLogs
NewCloudWatchLogsClient creates a new CloudWatch Logs client.
func NewCloudWatchLogsClientE ¶ added in v0.9.0
func NewCloudWatchLogsClientE(t *testing.T, region string) (*cloudwatchlogs.CloudWatchLogs, error)
NewCloudWatchLogsClientE creates a new CloudWatch Logs client.
func NewEc2Client ¶
NewEc2Client creates an EC2 client.
func NewEc2ClientE ¶ added in v0.9.0
NewEc2ClientE creates an EC2 client.
func NewIamClient ¶
NewIamClient creates a new IAM client.
func NewIamClientE ¶ added in v0.9.0
NewIamClientE creates a new IAM client.
func NewKmsClient ¶
NewKmsClient creates a KMS client.
func NewKmsClientE ¶ added in v0.9.0
NewKmsClientE creates a KMS client.
func NewS3Client ¶
NewS3Client creates an S3 client.
func NewS3ClientE ¶ added in v0.9.0
NewS3ClientE creates an S3 client.
func NewS3Uploader ¶ added in v0.9.15
NewS3Uploader creates an S3 Uploader.
func NewS3UploaderE ¶ added in v0.9.15
NewS3UploaderE creates an S3 Uploader.
func NewSnsClient ¶
NewSnsClient creates a new SNS client.
func NewSnsClientE ¶ added in v0.9.0
NewSnsClientE creates a new SNS client.
func NewSqsClient ¶
NewSqsClient creates a new SQS client.
func NewSqsClientE ¶ added in v0.9.0
NewSqsClientE creates a new SQS client.
func ReadPasswordPolicyMinPasswordLength ¶
ReadPasswordPolicyMinPasswordLength returns the minimal password length.
func SendMessageToQueue ¶
SendMessageToQueue sends the given message to the SQS queue with the given URL.
func SendMessageToQueueE ¶
SendMessageToQueueE sends the given message to the SQS queue with the given URL.
func TerminateInstance ¶
TerminateInstance terminates the EC2 instance with the given ID in the given region.
Types ¶
type CredentialsError ¶
type CredentialsError struct {
UnderlyingErr error
}
CredentialsError is an error that occurs because AWS credentials can't be found.
func (CredentialsError) Error ¶
func (err CredentialsError) Error() string
type Ec2Keypair ¶
type Ec2Keypair struct { *ssh.KeyPair Name string // The name assigned in AWS to the EC2 Key Pair Region string // The AWS region where the EC2 Key Pair lives }
Ec2Keypair is an EC2 key pair.
func CreateAndImportEC2KeyPair ¶
func CreateAndImportEC2KeyPair(t *testing.T, region string, name string) *Ec2Keypair
CreateAndImportEC2KeyPair generates a public/private KeyPair and import it into EC2 in the given region under the given name.
func CreateAndImportEC2KeyPairE ¶
CreateAndImportEC2KeyPairE generates a public/private KeyPair and import it into EC2 in the given region under the given name.
func ImportEC2KeyPair ¶
ImportEC2KeyPair creates a Key Pair in EC2 by importing an existing public key.
func ImportEC2KeyPairE ¶
func ImportEC2KeyPairE(t *testing.T, region string, name string, keyPair *ssh.KeyPair) (*Ec2Keypair, error)
ImportEC2KeyPairE creates a Key Pair in EC2 by importing an existing public key.
type IpForEc2InstanceNotFound ¶ added in v0.9.0
IpForEc2InstanceNotFound is an error that occurs when the IP for an EC2 instance is not found.
func (IpForEc2InstanceNotFound) Error ¶ added in v0.9.0
func (err IpForEc2InstanceNotFound) Error() string
type NoImagesFound ¶
NoImagesFound is an error that occurs if no images were found.
func (NoImagesFound) Error ¶
func (err NoImagesFound) Error() string
type QueueMessageResponse ¶
QueueMessageResponse contains a queue message.
func WaitForQueueMessage ¶
func WaitForQueueMessage(t *testing.T, awsRegion string, queueURL string, timeout int) QueueMessageResponse
WaitForQueueMessage waits to receive a message from on the queueURL. Since the API only allows us to wait a max 20 seconds for a new message to arrive, we must loop TIMEOUT/20 number of times to be able to wait for a total of TIMEOUT seconds
type ReceiveMessageTimeout ¶
ReceiveMessageTimeout is an error that occurs if receiving a message times out.
func (ReceiveMessageTimeout) Error ¶
func (err ReceiveMessageTimeout) Error() string
type Subnet ¶
type Subnet struct { Id string // The ID of the Subnet AvailabilityZone string // The Availability Zone the subnet is in }
Subnet is a subnet in an availability zone.
func GetSubnetsForVpc ¶
GetSubnetsForVpc gets the subnets in the specified VPC.