Skip to content

Commit

Permalink
Merge pull request #20 from gruntwork-io/project-rename
Browse files Browse the repository at this point in the history
rename project from aws-nuke to cloud-nuke
  • Loading branch information
tonerdo authored Mar 19, 2018
2 parents ddf11be + ea70d3a commit 3fdf199
Show file tree
Hide file tree
Showing 21 changed files with 53 additions and 53 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# aws-nuke
# cloud-nuke

This repo contains a CLI tool to delete all AWS resources in an account. aws-nuke was created for situations when you might have an account you use for testing and need to clean up left over resources so AWS doesn't charge you for them. Also great for cleaning out accounts with redundant resources.
This repo contains a CLI tool to delete all AWS resources in an account. cloud-nuke was created for situations when you might have an account you use for testing and need to clean up left over resources so AWS doesn't charge you for them. Also great for cleaning out accounts with redundant resources.

The currently supported functionality includes:

Expand All @@ -15,36 +15,36 @@ The currently supported functionality includes:

## Install

1. Download the latest binary for your OS on the [releases page](https://github.com/gruntwork-io/aws-nuke/releases).
2. Move the binary to a folder on your `PATH`. E.g.: `mv aws-nuke_darwin_amd64 /usr/local/bin/aws-nuke`.
3. Add execute permissions to the binary. E.g.: `chmod u+x /usr/local/bin/aws-nuke`.
4. Test it installed correctly: `aws-nuke --help`.
1. Download the latest binary for your OS on the [releases page](https://github.com/gruntwork-io/cloud-nuke/releases).
2. Move the binary to a folder on your `PATH`. E.g.: `mv cloud-nuke_darwin_amd64 /usr/local/bin/cloud-nuke`.
3. Add execute permissions to the binary. E.g.: `chmod u+x /usr/local/bin/cloud-nuke`.
4. Test it installed correctly: `cloud-nuke --help`.

## Usage

Simply running `aws-nuke` will start the process of cleaning up your AWS account. You'll be shown a list of resources that'll be deleted as well as a prompt to confirm before any deletion actually takes place.
Simply running `cloud-nuke` will start the process of cleaning up your AWS account. You'll be shown a list of resources that'll be deleted as well as a prompt to confirm before any deletion actually takes place.

### Excluding Regions

You can use the `--exclude-region` flag to exclude resources in certain regions from being deleted. For example the following command does not nuke resources in `ap-south-1` and `ap-south-2` regions:

```shell
aws-nuke --exclude-region ap-south-1 --exclude-region ap-south-2
cloud-nuke --exclude-region ap-south-1 --exclude-region ap-south-2
```

### Excluding Resources by Age

You can use the `--older-than` flag to only nuke resources that were created before a certain period, the possible values are all valid values for [ParseDuration](https://golang.org/pkg/time/#ParseDuration) For example the following command nukes resources that are at least one day old:

```shell
aws-nuke --older-than 24h
cloud-nuke --older-than 24h
```

Happy Nuking!!!

## Credentials

In order for the `aws-nuke` CLI tool to access your AWS, you will need to provide your AWS credentials. You can used one of the [standard AWS CLI credential mechanisms](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html).
In order for the `cloud-nuke` CLI tool to access your AWS, you will need to provide your AWS credentials. You can used one of the [standard AWS CLI credential mechanisms](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html).

## Running Tests

Expand Down
2 changes: 1 addition & 1 deletion aws/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/aws-nuke/logging"
"github.com/gruntwork-io/cloud-nuke/logging"
"github.com/gruntwork-io/gruntwork-cli/errors"
)

Expand Down
6 changes: 3 additions & 3 deletions aws/ami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/aws-nuke/util"
"github.com/gruntwork-io/cloud-nuke/util"
"github.com/gruntwork-io/gruntwork-cli/errors"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestListAMIs(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
image := createTestAMI(t, session, uniqueTestID)
// clean up after this test
defer nukeAllAMIs(session, []*string{image.ImageId})
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestNukeAMIs(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
image := createTestAMI(t, session, uniqueTestID)

// clean up ec2 instance created by the above call
Expand Down
2 changes: 1 addition & 1 deletion aws/asg.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/gruntwork-io/aws-nuke/logging"
"github.com/gruntwork-io/cloud-nuke/logging"
"github.com/gruntwork-io/gruntwork-cli/errors"
)

Expand Down
6 changes: 3 additions & 3 deletions aws/asg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/gruntwork-io/aws-nuke/util"
"github.com/gruntwork-io/cloud-nuke/util"
"github.com/gruntwork-io/gruntwork-cli/errors"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -49,7 +49,7 @@ func TestListAutoScalingGroups(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
createTestAutoScalingGroup(t, session, uniqueTestID)
// clean up after this test
defer nukeAllAutoScalingGroups(session, []*string{&uniqueTestID})
Expand Down Expand Up @@ -83,7 +83,7 @@ func TestNukeAutoScalingGroups(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
createTestAutoScalingGroup(t, session, uniqueTestID)

// clean up ec2 instance created by the above call
Expand Down
2 changes: 1 addition & 1 deletion aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/gruntwork-io/aws-nuke/logging"
"github.com/gruntwork-io/cloud-nuke/logging"
"github.com/gruntwork-io/gruntwork-cli/collections"
"github.com/gruntwork-io/gruntwork-cli/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion aws/ebs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/aws-nuke/logging"
"github.com/gruntwork-io/cloud-nuke/logging"
"github.com/gruntwork-io/gruntwork-cli/errors"
)

Expand Down
8 changes: 4 additions & 4 deletions aws/ebs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/aws-nuke/util"
"github.com/gruntwork-io/cloud-nuke/util"
"github.com/gruntwork-io/gruntwork-cli/errors"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -92,7 +92,7 @@ func TestListEBSVolumes(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
az := awsgo.StringValue(session.Config.Region) + "a"
volume := createTestEBSVolume(t, session, uniqueTestID, az)
// clean up after this test
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestNukeEBSVolumes(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
az := awsgo.StringValue(session.Config.Region) + "a"
volume := createTestEBSVolume(t, session, uniqueTestID, az)

Expand Down Expand Up @@ -160,7 +160,7 @@ func TestNukeEBSVolumesInUse(t *testing.T) {

svc := ec2.New(session)

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
instance := createTestEC2Instance(t, session, uniqueTestID, true)
az := getAZFromSubnet(t, session, instance.SubnetId)
volume := createTestEBSVolume(t, session, uniqueTestID, az)
Expand Down
2 changes: 1 addition & 1 deletion aws/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/aws-nuke/logging"
"github.com/gruntwork-io/cloud-nuke/logging"
"github.com/gruntwork-io/gruntwork-cli/errors"
)

Expand Down
6 changes: 3 additions & 3 deletions aws/ec2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/aws-nuke/util"
"github.com/gruntwork-io/cloud-nuke/util"
"github.com/gruntwork-io/gruntwork-cli/errors"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -143,7 +143,7 @@ func TestListInstances(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
instance := createTestEC2Instance(t, session, uniqueTestID, false)
protectedInstance := createTestEC2Instance(t, session, uniqueTestID, true)
// clean up after this test
Expand Down Expand Up @@ -182,7 +182,7 @@ func TestNukeInstances(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
createTestEC2Instance(t, session, uniqueTestID, false)

instanceIds := findEC2InstancesByNameTag(t, session, uniqueTestID)
Expand Down
2 changes: 1 addition & 1 deletion aws/elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/elb"
"github.com/gruntwork-io/aws-nuke/logging"
"github.com/gruntwork-io/cloud-nuke/logging"
"github.com/gruntwork-io/gruntwork-cli/errors"
)

Expand Down
6 changes: 3 additions & 3 deletions aws/elb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/elb"
"github.com/gruntwork-io/aws-nuke/util"
"github.com/gruntwork-io/cloud-nuke/util"
"github.com/gruntwork-io/gruntwork-cli/errors"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -47,7 +47,7 @@ func TestListELBs(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

elbName := "aws-nuke-test-" + util.UniqueID()
elbName := "cloud-nuke-test-" + util.UniqueID()
createTestELB(t, session, elbName)
// clean up after this test
defer nukeAllElbInstances(session, []*string{&elbName})
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestNukeELBs(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

elbName := "aws-nuke-test-" + util.UniqueID()
elbName := "cloud-nuke-test-" + util.UniqueID()
createTestELB(t, session, elbName)

_, err = svc.DescribeLoadBalancers(&elb.DescribeLoadBalancersInput{
Expand Down
2 changes: 1 addition & 1 deletion aws/elbv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/elbv2"
"github.com/gruntwork-io/aws-nuke/logging"
"github.com/gruntwork-io/cloud-nuke/logging"
"github.com/gruntwork-io/gruntwork-cli/errors"
)

Expand Down
6 changes: 3 additions & 3 deletions aws/elbv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/elbv2"
"github.com/gruntwork-io/aws-nuke/util"
"github.com/gruntwork-io/cloud-nuke/util"
"github.com/gruntwork-io/gruntwork-cli/errors"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestListELBv2(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

elbName := "aws-nuke-test-" + util.UniqueID()
elbName := "cloud-nuke-test-" + util.UniqueID()
balancer := createTestELBv2(t, session, elbName)
// clean up after this test
defer nukeAllElbv2Instances(session, []*string{balancer.LoadBalancerArn})
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestNukeELBv2(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

elbName := "aws-nuke-test-" + util.UniqueID()
elbName := "cloud-nuke-test-" + util.UniqueID()
balancer := createTestELBv2(t, session, elbName)

_, err = svc.DescribeLoadBalancers(&elbv2.DescribeLoadBalancersInput{
Expand Down
2 changes: 1 addition & 1 deletion aws/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/aws-nuke/logging"
"github.com/gruntwork-io/cloud-nuke/logging"
"github.com/gruntwork-io/gruntwork-cli/errors"
)

Expand Down
6 changes: 3 additions & 3 deletions aws/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/aws-nuke/util"
"github.com/gruntwork-io/cloud-nuke/util"
"github.com/gruntwork-io/gruntwork-cli/errors"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -49,7 +49,7 @@ func TestListSnapshots(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
snapshot := createTestSnapshot(t, session, uniqueTestID)

// clean up after this test
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestNukeSnapshots(t *testing.T) {
assert.Fail(t, errors.WithStackTrace(err).Error())
}

uniqueTestID := "aws-nuke-test-" + util.UniqueID()
uniqueTestID := "cloud-nuke-test-" + util.UniqueID()
snapshot := createTestSnapshot(t, session, uniqueTestID)

// clean up ec2 instance created by the above call
Expand Down
16 changes: 8 additions & 8 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defaults: &defaults
working_directory: /go/src/github.com/gruntwork-io/aws-nuke
working_directory: /go/src/github.com/gruntwork-io/cloud-nuke
docker:
- image: 087285199408.dkr.ecr.us-east-1.amazonaws.com/circle-ci-test-image-base:latest

Expand All @@ -10,15 +10,15 @@ jobs:
steps:
- checkout
- attach_workspace:
at: /go/src/github.com/gruntwork-io/aws-nuke
at: /go/src/github.com/gruntwork-io/cloud-nuke
- restore_cache:
keys:
- dep-{{ checksum "Gopkg.lock" }}
- run: dep ensure
- save_cache:
key: dep-{{ checksum "Gopkg.lock" }}
paths:
- /go/src/github.com/gruntwork-io/aws-nuke/vendor
- /go/src/github.com/gruntwork-io/cloud-nuke/vendor
- persist_to_workspace:
root: .
paths: vendor
Expand All @@ -28,7 +28,7 @@ jobs:
steps:
- checkout
- attach_workspace:
at: /go/src/github.com/gruntwork-io/aws-nuke
at: /go/src/github.com/gruntwork-io/cloud-nuke
- run:
command: run-go-tests --circle-ci-2
no_output_timeout: 20m
Expand All @@ -38,8 +38,8 @@ jobs:
steps:
- checkout
- attach_workspace:
at: /go/src/github.com/gruntwork-io/aws-nuke
- run: build-go-binaries --circle-ci-2 --app-name aws-nuke --dest-path bin --ld-flags "-X main.VERSION=$CIRCLE_TAG"
at: /go/src/github.com/gruntwork-io/cloud-nuke
- run: build-go-binaries --circle-ci-2 --app-name cloud-nuke --dest-path bin --ld-flags "-X main.VERSION=$CIRCLE_TAG"
- persist_to_workspace:
root: .
paths: bin
Expand All @@ -49,15 +49,15 @@ jobs:
steps:
- checkout
- attach_workspace:
at: /go/src/github.com/gruntwork-io/aws-nuke
at: /go/src/github.com/gruntwork-io/cloud-nuke
- run: go run main.go --older-than 24h --exclude-region us-west-2 --force

deploy:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: /go/src/github.com/gruntwork-io/aws-nuke
at: /go/src/github.com/gruntwork-io/cloud-nuke
- run: upload-github-release-assets bin/*

workflows:
Expand Down
Binary file added cloud-nuke
Binary file not shown.
Loading

0 comments on commit 3fdf199

Please sign in to comment.