Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect request limits when cleaning EC2 #20

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

dagguh
Copy link
Contributor

@dagguh dagguh commented Jan 22, 2024

Fix errors like:

1)
22-Jan-2024 12:02:54	12:02:54,188 WARN  {} Failed to terminate 1633 instances
22-Jan-2024 12:02:54	com.amazonaws.services.ec2.model.AmazonEC2Exception: You have exceeded the number of resources allowed in a single call of this type (Service: AmazonEC2; Status Code: 400; Error Code: ResourceCountExceeded; Request ID: b09c4c14-5f5f-4570-a4b6-a04762db0a5b; Proxy: null)
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1811) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1395) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1371) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:704) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.doInvoke(AmazonEC2Client.java:25451) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:25418) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:25407) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.executeTerminateInstances(AmazonEC2Client.java:24995) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.terminateInstances(AmazonEC2Client.java:24966) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.atlassian.performance.tools.aws.api.TerminationBatchingEc2.terminate(TerminationBatchingEc2.kt:60) ~[aws-resources-1.14.0.jar:?]
22-Jan-2024 12:02:54	        at com.atlassian.performance.tools.aws.api.TerminationBatchingEc2.tryToTerminate(TerminationBatchingEc2.kt:46) ~[aws-resources-1.14.0.jar:?]
22-Jan-2024 12:02:54	        at com.atlassian.performance.tools.aws.api.TerminationBatchingEc2.access$tryToTerminate(TerminationBatchingEc2.kt:18) ~[aws-resources-1.14.0.jar:?]
22-Jan-2024 12:02:54	        at com.atlassian.performance.tools.aws.api.TerminationBatchingEc2$$special$$inlined$timer$1.run(Timer.kt:149) ~[aws-resources-1.14.0.jar:?]
22-Jan-2024 12:02:54	        at java.util.TimerThread.mainLoop(Timer.java:556) ~[?:?]
22-Jan-2024 12:02:54	        at java.util.TimerThread.run(Timer.java:506) ~[?:?]

2)
2024-01-22T12:54:37,605Z WARN  ec2-polling {} [] [com.atlassian.performance.tools.aws.api.TerminationPollingEc2] Failed to poll instances
com.amazonaws.services.ec2.model.AmazonEC2Exception: The maximum number of filter values specified on a single call is 200 (Service: AmazonEC2; Status Code: 400; Error Code: FilterLimitExceeded; Request ID: 39d3fdde-d440-4106-b28f-bf76c4a0dcf9; Proxy: null)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1811) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1395) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1371) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:704) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.doInvoke(AmazonEC2Client.java:25451) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:25418) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:25407) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.executeDescribeInstances(AmazonEC2Client.java:12022) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.describeInstances(AmazonEC2Client.java:11993) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.atlassian.performance.tools.aws.TokenScrollingEc2.scrollThroughInstances(TokenScrollingEc2.kt:22) ~[main/:?]
	at com.atlassian.performance.tools.aws.api.TerminationPollingEc2.pollUntilTermination(TerminationPollingEc2.kt:64) ~[main/:?]
	at com.atlassian.performance.tools.aws.api.TerminationPollingEc2.tryPolling(TerminationPollingEc2.kt:49) [main/:?]
	at com.atlassian.performance.tools.aws.api.TerminationPollingEc2.access$tryPolling(TerminationPollingEc2.kt:19) [main/:?]
	at com.atlassian.performance.tools.aws.api.TerminationPollingEc2$$special$$inlined$timer$1.run(Timer.kt:149) [main/:?]
	at java.util.TimerThread.mainLoop(Timer.java:556) [?:?]
	at java.util.TimerThread.run(Timer.java:506) [?:?]

@dagguh dagguh requested a review from a team as a code owner January 22, 2024 14:12
@dagguh dagguh enabled auto-merge (rebase) January 22, 2024 14:12
Fix errors like:
```
1)
22-Jan-2024 12:02:54	12:02:54,188 WARN  {} Failed to terminate 1633 instances
22-Jan-2024 12:02:54	com.amazonaws.services.ec2.model.AmazonEC2Exception: You have exceeded the number of resources allowed in a single call of this type (Service: AmazonEC2; Status Code: 400; Error Code: ResourceCountExceeded; Request ID: b09c4c14-5f5f-4570-a4b6-a04762db0a5b; Proxy: null)
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1811) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1395) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1371) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:704) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530) ~[aws-java-sdk-core-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.doInvoke(AmazonEC2Client.java:25451) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:25418) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:25407) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.executeTerminateInstances(AmazonEC2Client.java:24995) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.amazonaws.services.ec2.AmazonEC2Client.terminateInstances(AmazonEC2Client.java:24966) ~[aws-java-sdk-ec2-1.11.817.jar:?]
22-Jan-2024 12:02:54	        at com.atlassian.performance.tools.aws.api.TerminationBatchingEc2.terminate(TerminationBatchingEc2.kt:60) ~[aws-resources-1.14.0.jar:?]
22-Jan-2024 12:02:54	        at com.atlassian.performance.tools.aws.api.TerminationBatchingEc2.tryToTerminate(TerminationBatchingEc2.kt:46) ~[aws-resources-1.14.0.jar:?]
22-Jan-2024 12:02:54	        at com.atlassian.performance.tools.aws.api.TerminationBatchingEc2.access$tryToTerminate(TerminationBatchingEc2.kt:18) ~[aws-resources-1.14.0.jar:?]
22-Jan-2024 12:02:54	        at com.atlassian.performance.tools.aws.api.TerminationBatchingEc2$$special$$inlined$timer$1.run(Timer.kt:149) ~[aws-resources-1.14.0.jar:?]
22-Jan-2024 12:02:54	        at java.util.TimerThread.mainLoop(Timer.java:556) ~[?:?]
22-Jan-2024 12:02:54	        at java.util.TimerThread.run(Timer.java:506) ~[?:?]

2)
2024-01-22T12:54:37,605Z WARN  ec2-polling {} [] [com.atlassian.performance.tools.aws.api.TerminationPollingEc2] Failed to poll instances
com.amazonaws.services.ec2.model.AmazonEC2Exception: The maximum number of filter values specified on a single call is 200 (Service: AmazonEC2; Status Code: 400; Error Code: FilterLimitExceeded; Request ID: 39d3fdde-d440-4106-b28f-bf76c4a0dcf9; Proxy: null)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1811) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1395) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1371) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:704) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530) ~[aws-java-sdk-core-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.doInvoke(AmazonEC2Client.java:25451) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:25418) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:25407) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.executeDescribeInstances(AmazonEC2Client.java:12022) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.amazonaws.services.ec2.AmazonEC2Client.describeInstances(AmazonEC2Client.java:11993) ~[aws-java-sdk-ec2-1.11.817.jar:?]
	at com.atlassian.performance.tools.aws.TokenScrollingEc2.scrollThroughInstances(TokenScrollingEc2.kt:22) ~[main/:?]
	at com.atlassian.performance.tools.aws.api.TerminationPollingEc2.pollUntilTermination(TerminationPollingEc2.kt:64) ~[main/:?]
	at com.atlassian.performance.tools.aws.api.TerminationPollingEc2.tryPolling(TerminationPollingEc2.kt:49) [main/:?]
	at com.atlassian.performance.tools.aws.api.TerminationPollingEc2.access$tryPolling(TerminationPollingEc2.kt:19) [main/:?]
	at com.atlassian.performance.tools.aws.api.TerminationPollingEc2$$special$$inlined$timer$1.run(Timer.kt:149) [main/:?]
	at java.util.TimerThread.mainLoop(Timer.java:556) [?:?]
	at java.util.TimerThread.run(Timer.java:506) [?:?]
```
@dagguh dagguh changed the title Respec request limits when cleaning EC2 Respect request limits when cleaning EC2 Jan 22, 2024
@dagguh dagguh merged commit 831e7bb into master Jan 22, 2024
3 checks passed
@dagguh dagguh deleted the fix-termination-ec2-limits branch January 22, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants