Skip to content

Commit

Permalink
Added Nvidia Test to cleanup filter (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
okankoAMZ authored Jan 31, 2024
1 parent d8d8a8e commit 7c0e647
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tool/clean/clean_host/clean_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"github.com/aws/amazon-cloudwatch-agent/tool/clean"
)

var REGIONS = []string{"us-east-1", "us-west-2"}

// Clean integration hosts if they have been open longer than 1 day
func main() {
err := cleanHost()
Expand All @@ -31,13 +33,16 @@ func cleanHost() error {
log.Print("Begin to clean EC2 Host")

cxt := context.Background()
defaultConfig, err := config.LoadDefaultConfig(cxt)
if err != nil {
return err
}
ec2client := ec2.NewFromConfig(defaultConfig)
var err error
for _, region := range REGIONS {
defaultConfig, err := config.LoadDefaultConfig(cxt, config.WithRegion(region))
if err != nil {
return err
}
ec2client := ec2.NewFromConfig(defaultConfig)

terminateInstances(cxt, ec2client)
terminateInstances(cxt, ec2client)
}
return err
}

Expand All @@ -57,6 +62,7 @@ func terminateInstances(cxt context.Context, ec2client *ec2.Client) {
"cwagent-performance-*",
"cwagent-stress-*",
"LocalStackIntegrationTestInstance",
"NvidiaDataCollector-*",
}}

instanceInput := ec2.DescribeInstancesInput{
Expand Down

0 comments on commit 7c0e647

Please sign in to comment.