-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from pratikkumar-mohite/pm/issue-11
Issue 11: Adding readme
- Loading branch information
Showing
9 changed files
with
87 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,4 @@ go.work.sum | |
*.txt | ||
|
||
# binary file | ||
/s3-cleanup | ||
/s3-cleaner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
.PHONY: mod build run test | ||
.PHONY: mod build run | ||
|
||
mod: | ||
@go mod download | ||
@go mod verify | ||
|
||
build: bench | ||
@CGO_ENABLED=0 go build -pgo=cpu.out -ldflags="-w -s" -v -o s3-cleanup ./cmd/s3-cleanup/ | ||
build: | ||
@CGO_ENABLED=0 go build -v -o s3-cleaner ./cmd/s3-cleaner/ | ||
|
||
run: | ||
@CGO_ENABLED=0 go run ./cmd/s3-cleanup/ | ||
@CGO_ENABLED=0 go run ./cmd/s3-cleaner/ | ||
|
||
test: | ||
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -v --timeout=10m | ||
@go test -v -timeout 20m -covermode=atomic -coverprofile=coverage.txt ./... | ||
# test: | ||
# @go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -v --timeout=10m | ||
# @go test -v -timeout 20m -covermode=atomic -coverprofile=coverage.txt ./... | ||
|
||
bench: | ||
@go test -v -bench=. -count=6 -cpuprofile=cpu.out -memprofile=mem.out ./cmd/s3-cleanup/ -run=^Benchmark$ > benchmark.txt | ||
# bench: | ||
# @go test -v -bench=. -count=6 -cpuprofile=cpu.out -memprofile=mem.out ./cmd/s3-cleaner/ -run=^Benchmark$ > benchmark.txt | ||
|
||
bench-heavy: | ||
@go test -v -bench=. -count=10 -cpu=1,2,4,8 -cpuprofile=cpu.out -memprofile=mem.out ./cmd/s3-cleanup/ -run=^Benchmark$ > benchmark.txt | ||
@benchstat benchmark.txt | ||
@echo top | go tool pprof mem.out | ||
@echo top | go tool pprof cpu.out | ||
# bench-heavy: | ||
# @go test -v -bench=. -count=10 -cpu=1,2,4,8 -cpuprofile=cpu.out -memprofile=mem.out ./cmd/s3-cleaner/ -run=^Benchmark$ > benchmark.txt | ||
# @benchstat benchmark.txt | ||
# @echo top | go tool pprof mem.out | ||
# @echo top | go tool pprof cpu.out | ||
|
||
result: | ||
@cp coverage.txt benchmark.txt mem.out cpu.out coverage | ||
@go tool cover -func coverage.txt | ||
@benchstat benchmark.txt | ||
@echo top | go tool pprof mem.out | ||
@echo top | go tool pprof cpu.out | ||
# result: | ||
# @cp coverage.txt benchmark.txt mem.out cpu.out coverage | ||
# @go tool cover -func coverage.txt | ||
# @benchstat benchmark.txt | ||
# @echo top | go tool pprof mem.out | ||
# @echo top | go tool pprof cpu.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,57 @@ | ||
# s3-cleanup | ||
# S3 Cleaner | ||
This project is a Go application designed to delete AWS S3 buckets. It retrieves the list of buckets from your AWS account and performs cleanup operations on specified buckets. | ||
|
||
## Prerequisites | ||
|
||
1. Go 20 and higher. | ||
2. AWS account with IAM priviledges to perform S3 operations. | ||
|
||
## Features | ||
|
||
- List all S3 buckets in your AWS account. | ||
- Delete specified S3 buckets and its Objects. | ||
- Works with Versioned and Non-Versioned buckets. | ||
- Utilize GO concurrency for delete operations. | ||
|
||
## Build | ||
|
||
1. Clone the repository: | ||
```sh | ||
git clone https://github.com/pratikkumar-mohite/s2-cleanup.git | ||
``` | ||
2. Navigate to the project directory: | ||
```sh | ||
cd s3-cleaner | ||
``` | ||
3. Build the application: | ||
```sh | ||
make build | ||
``` | ||
4. Move the binary to executable path | ||
```sh | ||
mv s3-cleaner /usr/local/bin/ | ||
``` | ||
|
||
## Test | ||
As of now the actual test are not there because we dont have s3 mock apis to mimic the s3 object behaviour specifically in go, this project has dependency on [S3Mock project](https://github.com/pratikkumar-mohite/S3Mock) to enable the `go test`. | ||
|
||
## Usage | ||
|
||
1. Ensure you have AWS credentials configured. You can set them up using the AWS CLI(ignore if already set): | ||
```sh | ||
aws configure --profile <your-aws-profile> | ||
``` | ||
2. Setup Environment variables | ||
```sh | ||
export AWS_REGION=us-east-1 | ||
export AWS_DELETE_S3_BUCKET=pratikkumar-mohite-test | ||
export AWS_PROFILE=pratikkumar-mohite-aws | ||
``` | ||
2. Run the application: | ||
```sh | ||
s3-cleaner | ||
``` | ||
|
||
## Contributing | ||
|
||
Contributions are greatly appreciated. We actively manage the issues list, and try to highlight issues suitable for newcomers. The project follows the typical GitHub pull request model. Before starting any work, please either comment on an existing issue, or file a new one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module github.com/pratikkumar-mohite/s3-cleanup | ||
module github.com/pratikkumar-mohite/s3-cleaner | ||
|
||
go 1.22.5 | ||
|
||
|