Common errors
NoCredentialsError: Unable to locate credentials
NoCredentialsError: Unable to locate credentials
Error message:Cause: AWS credentials are not configured on your system.Solution:
ClientError: An error occurred (UnauthorizedOperation)
ClientError: An error occurred (UnauthorizedOperation)
ClientError: Request limit exceeded (RequestLimitExceeded)
ClientError: Request limit exceeded (RequestLimitExceeded)
Error message:Cause: AWS API throttling due to too many requests in a short time period.Solution:
Request a rate limit increase
If you have many resources, consider requesting a service quota increase through the AWS Service Quotas console.
DependencyViolation: Resource has a dependent object
DependencyViolation: Resource has a dependent object
Error message:Cause: The security group is referenced by another security group’s rules or has resources still attached.Solution:
Check the audit log
Review the
{account_id}_sg_log.txt file to see if the security group is referenced by other security groups:Remove references first
Before deleting, remove the security group from any rules that reference it in other security groups.
InvalidGroup.NotFound: The security group does not exist
InvalidGroup.NotFound: The security group does not exist
Error message:Cause: The security group was already deleted or doesn’t exist in the current region.Solution:
- Verify you’re running the script in the correct AWS region
- Check if the security group was deleted by another process
- Run a fresh audit to get current security group status
AccessDeniedException: User is not authorized for service APIs
AccessDeniedException: User is not authorized for service APIs
EndpointConnectionError: Could not connect to the endpoint
EndpointConnectionError: Could not connect to the endpoint
Error message:Cause: Network connectivity issues or service not available in your region.Solution:
Check network connectivity
Verify your internet connection and firewall settings allow HTTPS traffic to AWS endpoints.
Verify service availability
Not all AWS services are available in all regions. Check the AWS Regional Services List.
ParamValidationError: Parameter validation failed
ParamValidationError: Parameter validation failed
Error message:Cause: Unexpected None values or malformed data from AWS API responses.Solution:This typically indicates a bug in the script or unexpected API response format. File an issue on the GitHub repository with:
- The full error message
- Which AWS service was being checked when the error occurred
- Your AWS region
Regional considerations
The script only checks security groups in the region configured in your AWS CLI or environment variables. To audit multiple regions, run the script separately for each region:
Output file issues
Cannot write to log file
If you see permission errors when creating the log file:Log file shows incomplete results
If the script terminates early (check_sg_usage.py:44-364), the log file may be incomplete. Solution:- Check for errors in the console output
- Look for exception messages that stopped the script
- The log file is flushed continuously, so partial results are still saved
Performance issues
Script runs very slowly
The script checks 20+ AWS services sequentially for each security group. Optimization tips:- Run during off-peak hours to avoid API throttling
- Focus on specific VPCs by modifying the script
- Consider implementing parallel processing for independent service checks
Getting help
If you encounter an error not listed here:- Check the
{account_id}_sg_log.txtfile for detailed output - Search existing GitHub Issues
- Create a new issue with:
- Full error message and stack trace
- Python version (
python --version) - boto3 version (
pip show boto3) - AWS region
- Anonymized log output showing the error