aws

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const AwsResourceExclusionTagKey = "cloud-nuke-excluded"
View Source
const (
	GlobalRegion string = "global"
)

Variables

View Source
var GovCloudRegions = []string{
	"us-gov-east-1",
	"us-gov-west-1",
}

GovCloudRegions contains all of the U.S. GovCloud regions. In accounts with GovCloud enabled, these are the only available regions.

View Source
var OptInNotRequiredRegions = []string{
	"eu-north-1",
	"ap-south-1",
	"eu-west-3",
	"eu-west-2",
	"eu-west-1",
	"ap-northeast-2",
	"ap-northeast-1",
	"sa-east-1",
	"ca-central-1",
	"ap-southeast-1",
	"ap-southeast-2",
	"eu-central-1",
	"us-east-1",
	"us-east-2",
	"us-west-1",
	"us-west-2",
}

OptInNotRequiredRegions contains all regions that are enabled by default on new AWS accounts Beginning in Spring 2019, AWS requires new regions to be explicitly enabled See https://aws.amazon.com/blogs/security/setting-permissions-to-enable-accounts-for-upcoming-aws-regions/

Functions

func DescribeDefaultSecurityGroups

func DescribeDefaultSecurityGroups(svc ec2iface.EC2API) ([]string, error)

func GetDefaultVpcId

func GetDefaultVpcId(vpc Vpc) (string, error)

func GetEc2ServiceClient

func GetEc2ServiceClient(region string) ec2iface.EC2API

func GetEnabledRegions

func GetEnabledRegions() ([]string, error)

GetEnabledRegions - Get all regions that are enabled (DescribeRegions excludes those not enabled by default)

func GetTargetRegions

func GetTargetRegions(enabledRegions []string, selectedRegions []string, excludedRegions []string) ([]string, error)

GetTargetRegions - Used enabled, selected and excluded regions to create a final list of valid regions

func IsNukeable

func IsNukeable(resourceType string, resourceTypes []string) bool

IsNukeable - Checks if we should nuke a resource or not

func IsValidResourceType

func IsValidResourceType(resourceType string, allResourceTypes []string) bool

IsValidResourceType - Checks if a resourceType is valid or not

func ListResourceTypes

func ListResourceTypes() []string

ListResourceTypes - Returns list of resources which can be passed to --resource-type

func NukeAllResources

func NukeAllResources(account *AwsAccountResources, regions []string) error

NukeAllResources - Nukes all aws resources

func NukeDefaultSecurityGroupRules

func NukeDefaultSecurityGroupRules(sgs []DefaultSecurityGroup) error

func NukeVpcs

func NukeVpcs(vpcs []Vpc) error

Types

type AMIs

type AMIs struct {
	ImageIds []string
}

AMIs - represents all user owned AMIs

func (AMIs) MaxBatchSize

func (image AMIs) MaxBatchSize() int

func (AMIs) Nuke

func (image AMIs) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (AMIs) ResourceIdentifiers

func (image AMIs) ResourceIdentifiers() []string

ResourceIdentifiers - The AMI image ids

func (AMIs) ResourceName

func (image AMIs) ResourceName() string

ResourceName - the simple name of the aws resource

type ASGroups

type ASGroups struct {
	GroupNames []string
}

ASGroups - represents all auto scaling groups

func (ASGroups) MaxBatchSize

func (group ASGroups) MaxBatchSize() int

func (ASGroups) Nuke

func (group ASGroups) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (ASGroups) ResourceIdentifiers

func (group ASGroups) ResourceIdentifiers() []string

ResourceIdentifiers - The group names of the auto scaling groups

func (ASGroups) ResourceName

func (group ASGroups) ResourceName() string

ResourceName - the simple name of the aws resource

type AwsAccountResources

type AwsAccountResources struct {
	Resources map[string]AwsRegionResource
}

func GetAllResources

func GetAllResources(targetRegions []string, excludeAfter time.Time, resourceTypes []string, configObj config.Config) (*AwsAccountResources, error)

GetAllResources - Lists all aws resources

type AwsRegionResource

type AwsRegionResource struct {
	Resources []AwsResources
}

type AwsResources

type AwsResources interface {
	ResourceName() string
	ResourceIdentifiers() []string
	MaxBatchSize() int
	Nuke(session *session.Session, identifiers []string) error
}

type DBClusters

type DBClusters struct {
	InstanceNames []string
}

func (DBClusters) MaxBatchSize

func (instance DBClusters) MaxBatchSize() int

func (DBClusters) Nuke

func (instance DBClusters) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (DBClusters) ResourceIdentifiers

func (instance DBClusters) ResourceIdentifiers() []string

ResourceIdentifiers - The instance names of the rds db instances

func (DBClusters) ResourceName

func (instance DBClusters) ResourceName() string

type DBInstances

type DBInstances struct {
	InstanceNames []string
}

func (DBInstances) MaxBatchSize

func (instance DBInstances) MaxBatchSize() int

func (DBInstances) Nuke

func (instance DBInstances) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (DBInstances) ResourceIdentifiers

func (instance DBInstances) ResourceIdentifiers() []string

ResourceIdentifiers - The instance names of the rds db instances

func (DBInstances) ResourceName

func (instance DBInstances) ResourceName() string

type DefaultSecurityGroup

type DefaultSecurityGroup struct {
	GroupName string
	GroupId   string
	Region    string
	// contains filtered or unexported fields
}

func GetDefaultSecurityGroups

func GetDefaultSecurityGroups(regions []string) ([]DefaultSecurityGroup, error)

type EBSVolumes

type EBSVolumes struct {
	VolumeIds []string
}

EBSVolumes - represents all ebs volumes

func (EBSVolumes) MaxBatchSize

func (volume EBSVolumes) MaxBatchSize() int

func (EBSVolumes) Nuke

func (volume EBSVolumes) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (EBSVolumes) ResourceIdentifiers

func (volume EBSVolumes) ResourceIdentifiers() []string

ResourceIdentifiers - The volume ids of the ebs volumes

func (EBSVolumes) ResourceName

func (volume EBSVolumes) ResourceName() string

ResourceName - the simple name of the aws resource

type EC2Instances

type EC2Instances struct {
	InstanceIds []string
}

EC2Instances - represents all ec2 instances

func (EC2Instances) MaxBatchSize

func (instance EC2Instances) MaxBatchSize() int

func (EC2Instances) Nuke

func (instance EC2Instances) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (EC2Instances) ResourceIdentifiers

func (instance EC2Instances) ResourceIdentifiers() []string

ResourceIdentifiers - The instance ids of the ec2 instances

func (EC2Instances) ResourceName

func (instance EC2Instances) ResourceName() string

ResourceName - the simple name of the aws resource

type ECSClusters

type ECSClusters struct {
	ClusterArns []string
}

ECSClusters - Represents all ECS clusters found in a region

func (ECSClusters) MaxBatchSize

func (clusters ECSClusters) MaxBatchSize() int

func (ECSClusters) Nuke

func (clusters ECSClusters) Nuke(awsSession *session.Session, identifiers []string) error

Nuke - nuke all ECS Cluster resources

func (ECSClusters) ResourceIdentifiers

func (clusters ECSClusters) ResourceIdentifiers() []string

ResourceIdentifiers - the collected ECS clusters

func (ECSClusters) ResourceName

func (clusters ECSClusters) ResourceName() string

ResourceName - The simple name of the aws resource

type ECSServices

type ECSServices struct {
	Services          []string
	ServiceClusterMap map[string]string
}

ECSServices - Represents all ECS services found in a region

func (ECSServices) MaxBatchSize

func (services ECSServices) MaxBatchSize() int

func (ECSServices) Nuke

func (services ECSServices) Nuke(awsSession *session.Session, identifiers []string) error

Nuke - nuke all ECS service resources

func (ECSServices) ResourceIdentifiers

func (services ECSServices) ResourceIdentifiers() []string

ResourceIdentifiers - The ARNs of the collected ECS services

func (ECSServices) ResourceName

func (services ECSServices) ResourceName() string

ResourceName - The simple name of the aws resource

type EIPAddresses

type EIPAddresses struct {
	AllocationIds []string
}

EBSVolumes - represents all ebs volumes

func (EIPAddresses) MaxBatchSize

func (address EIPAddresses) MaxBatchSize() int

func (EIPAddresses) Nuke

func (address EIPAddresses) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (EIPAddresses) ResourceIdentifiers

func (address EIPAddresses) ResourceIdentifiers() []string

ResourceIdentifiers - The instance ids of the eip addresses

func (EIPAddresses) ResourceName

func (address EIPAddresses) ResourceName() string

ResourceName - the simple name of the aws resource

type EKSClusters

type EKSClusters struct {
	Clusters []string
}

EKSClusters - Represents all EKS clusters found in a region

func (EKSClusters) MaxBatchSize

func (clusters EKSClusters) MaxBatchSize() int

func (EKSClusters) Nuke

func (clusters EKSClusters) Nuke(awsSession *session.Session, identifiers []string) error

Nuke - nuke all EKS Cluster resources

func (EKSClusters) ResourceIdentifiers

func (clusters EKSClusters) ResourceIdentifiers() []string

ResourceIdentifiers - The Name of the collected EKS clusters

func (EKSClusters) ResourceName

func (clusters EKSClusters) ResourceName() string

ResourceName - The simple name of the aws resource

type ElbDeleteError

type ElbDeleteError struct{}

func (ElbDeleteError) Error

func (e ElbDeleteError) Error() string

type IAMUsers

type IAMUsers struct {
	UserNames []string
}

IAMUsers - represents all IAMUsers on the AWS Account

func (IAMUsers) MaxBatchSize

func (u IAMUsers) MaxBatchSize() int

Tentative batch size to ensure AWS doesn't throttle

func (IAMUsers) Nuke

func (u IAMUsers) Nuke(session *session.Session, users []string) error

Nuke - nuke 'em all!!!

func (IAMUsers) ResourceIdentifiers

func (u IAMUsers) ResourceIdentifiers() []string

ResourceIdentifiers - The IAM UserNames

func (IAMUsers) ResourceName

func (u IAMUsers) ResourceName() string

ResourceName - the simple name of the aws resource

type ImageAvailableError

type ImageAvailableError struct{}

func (ImageAvailableError) Error

func (e ImageAvailableError) Error() string

type LambdaDeleteError

type LambdaDeleteError struct {
	// contains filtered or unexported fields
}

func (LambdaDeleteError) Error

func (e LambdaDeleteError) Error() string

type LambdaFunctions

type LambdaFunctions struct {
	LambdaFunctionNames []string
}

func (LambdaFunctions) MaxBatchSize

func (lambda LambdaFunctions) MaxBatchSize() int

func (LambdaFunctions) Nuke

func (lambda LambdaFunctions) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (LambdaFunctions) ResourceIdentifiers

func (lambda LambdaFunctions) ResourceIdentifiers() []string

ResourceIdentifiers - The names of the lambda functions

func (LambdaFunctions) ResourceName

func (lambda LambdaFunctions) ResourceName() string

type LaunchConfigs

type LaunchConfigs struct {
	LaunchConfigurationNames []string
}

LaunchConfigs - represents all launch configurations

func (LaunchConfigs) MaxBatchSize

func (config LaunchConfigs) MaxBatchSize() int

func (LaunchConfigs) Nuke

func (config LaunchConfigs) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (LaunchConfigs) ResourceIdentifiers

func (config LaunchConfigs) ResourceIdentifiers() []string

ResourceIdentifiers - The names of the launch configurations

func (LaunchConfigs) ResourceName

func (config LaunchConfigs) ResourceName() string

ResourceName - the simple name of the aws resource

type LoadBalancers

type LoadBalancers struct {
	Names []string
}

LoadBalancers - represents all load balancers

func (LoadBalancers) MaxBatchSize

func (balancer LoadBalancers) MaxBatchSize() int

func (LoadBalancers) Nuke

func (balancer LoadBalancers) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (LoadBalancers) ResourceIdentifiers

func (balancer LoadBalancers) ResourceIdentifiers() []string

ResourceIdentifiers - The names of the load balancers

func (LoadBalancers) ResourceName

func (balancer LoadBalancers) ResourceName() string

ResourceName - the simple name of the aws resource

type LoadBalancersV2

type LoadBalancersV2 struct {
	Arns []string
}

LoadBalancersV2 - represents all load balancers

func (LoadBalancersV2) MaxBatchSize

func (balancer LoadBalancersV2) MaxBatchSize() int

func (LoadBalancersV2) Nuke

func (balancer LoadBalancersV2) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (LoadBalancersV2) ResourceIdentifiers

func (balancer LoadBalancersV2) ResourceIdentifiers() []string

ResourceIdentifiers - The arns of the load balancers

func (LoadBalancersV2) ResourceName

func (balancer LoadBalancersV2) ResourceName() string

ResourceName - the simple name of the aws resource

type RdsDeleteError

type RdsDeleteError struct {
	// contains filtered or unexported fields
}

func (RdsDeleteError) Error

func (e RdsDeleteError) Error() string

type S3Bucket

type S3Bucket struct {
	Name          string
	CreationDate  time.Time
	Region        string
	Tags          []map[string]string
	Error         error
	IsValid       bool
	InvalidReason string
}

S3Bucket - represents S3 bucket

type S3Buckets

type S3Buckets struct {
	Names []string
}

S3Buckets - represents all S3 Buckets

func (S3Buckets) MaxBatchSize

func (bucket S3Buckets) MaxBatchSize() int

MaxBatchSize decides how many S3 buckets to delete in one call.

func (S3Buckets) MaxConcurrentGetSize

func (bucket S3Buckets) MaxConcurrentGetSize() int

MaxConcurrentGetSize decides how many S3 buckets to fetch in one call.

func (S3Buckets) Nuke

func (bucket S3Buckets) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (S3Buckets) ObjectMaxBatchSize

func (bucket S3Buckets) ObjectMaxBatchSize() int

ObjectMaxBatchSize decides how many unique objects of an S3 bucket (object + version = unique object) to delete in one call.

func (S3Buckets) ResourceIdentifiers

func (bucket S3Buckets) ResourceIdentifiers() []string

ResourceIdentifiers - The names of the S3 buckets

func (S3Buckets) ResourceName

func (bucket S3Buckets) ResourceName() string

ResourceName - the simple name of the aws resource

type SecretsManagerSecrets

type SecretsManagerSecrets struct {
	SecretIDs []string
}

SecretsManagerSecrets - represents all AWS secrets manager secrets that should be deleted.

func (SecretsManagerSecrets) MaxBatchSize

func (secret SecretsManagerSecrets) MaxBatchSize() int

func (SecretsManagerSecrets) Nuke

func (secret SecretsManagerSecrets) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (SecretsManagerSecrets) ResourceIdentifiers

func (secret SecretsManagerSecrets) ResourceIdentifiers() []string

ResourceIdentifiers - The instance ids of the ec2 instances

func (SecretsManagerSecrets) ResourceName

func (secret SecretsManagerSecrets) ResourceName() string

ResourceName - the simple name of the aws resource

type Snapshots

type Snapshots struct {
	SnapshotIds []string
}

Snapshots - represents all user owned Snapshots

func (Snapshots) MaxBatchSize

func (snapshot Snapshots) MaxBatchSize() int

func (Snapshots) Nuke

func (snapshot Snapshots) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (Snapshots) ResourceIdentifiers

func (snapshot Snapshots) ResourceIdentifiers() []string

ResourceIdentifiers - The Snapshot snapshot ids

func (Snapshots) ResourceName

func (snapshot Snapshots) ResourceName() string

ResourceName - the simple name of the aws resource

type SqsQueue

type SqsQueue struct {
	QueueUrls []string
}

SqsQueue - represents all sqs queues

func (SqsQueue) MaxBatchSize

func (queue SqsQueue) MaxBatchSize() int

func (SqsQueue) Nuke

func (queue SqsQueue) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (SqsQueue) ResourceIdentifiers

func (queue SqsQueue) ResourceIdentifiers() []string

ResourceIdentifiers - The arns of the sqs queues

func (SqsQueue) ResourceName

func (queue SqsQueue) ResourceName() string

ResourceName - the simple name of the aws resource

type TransitGateways

type TransitGateways struct {
	Ids []string
}

TransitGateways - represents all transit gateways

func (TransitGateways) MaxBatchSize

func (tgw TransitGateways) MaxBatchSize() int

MaxBatchSize - Tentative batch size to ensure AWS doesn't throttle

func (TransitGateways) Nuke

func (tgw TransitGateways) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (TransitGateways) ResourceIdentifiers

func (tgw TransitGateways) ResourceIdentifiers() []string

ResourceIdentifiers - The Ids of the transit gateways

func (TransitGateways) ResourceName

func (tgw TransitGateways) ResourceName() string

ResourceName - the simple name of the aws resource

type TransitGatewaysRouteTables

type TransitGatewaysRouteTables struct {
	Ids []string
}

TransitGatewaysRouteTables - represents all transit gateways route tables

func (TransitGatewaysRouteTables) MaxBatchSize

func (tgw TransitGatewaysRouteTables) MaxBatchSize() int

MaxBatchSize - Tentative batch size to ensure AWS doesn't throttle

func (TransitGatewaysRouteTables) Nuke

func (tgw TransitGatewaysRouteTables) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (TransitGatewaysRouteTables) ResourceIdentifiers

func (tgw TransitGatewaysRouteTables) ResourceIdentifiers() []string

ResourceIdentifiers - The arns of the transit gateways route tables

func (TransitGatewaysRouteTables) ResourceName

func (tgw TransitGatewaysRouteTables) ResourceName() string

ResourceName - the simple name of the aws resource

type TransitGatewaysVpcAttachment

type TransitGatewaysVpcAttachment struct {
	Ids []string
}

TransitGatewaysVpcAttachment - represents all transit gateways vpc attachments

func (TransitGatewaysVpcAttachment) MaxBatchSize

func (tgw TransitGatewaysVpcAttachment) MaxBatchSize() int

MaxBatchSize - Tentative batch size to ensure AWS doesn't throttle

func (TransitGatewaysVpcAttachment) Nuke

func (tgw TransitGatewaysVpcAttachment) Nuke(session *session.Session, identifiers []string) error

Nuke - nuke 'em all!!!

func (TransitGatewaysVpcAttachment) ResourceIdentifiers

func (tgw TransitGatewaysVpcAttachment) ResourceIdentifiers() []string

ResourceIdentifiers - The Ids of the transit gateways

func (TransitGatewaysVpcAttachment) ResourceName

func (tgw TransitGatewaysVpcAttachment) ResourceName() string

ResourceName - the simple name of the aws resource

type Vpc

type Vpc struct {
	Region string
	VpcId  string
	// contains filtered or unexported fields
}

func GetDefaultVpcs

func GetDefaultVpcs(vpcs []Vpc) ([]Vpc, error)

GetDefaultVpcs needs a slice of vpcs that already have service clients and regions assigned, either via NewVpcPerRegion() (as in the CLI) or manually (as in the mock tests)

func NewVpcPerRegion

func NewVpcPerRegion(regions []string) []Vpc

NewVpcPerRegion merely assigns a service client and region to a VPC object The CLI calls this, but the tests don't because the tests need to use a mocked service client.

Directories

Path Synopsis
Package mock_ec2iface is a generated GoMock package.
Package mock_ec2iface is a generated GoMock package.

Jump to

Keyboard shortcuts

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