- Newest
- Most votes
- Most comments
To troubleshoot this issue with one EC2 instance not being able to call Secrets Manager while the other can, despite having the same IAM role, you can try the following steps:
-
Double-check the IAM role permissions: Ensure that the IAM role attached to both EC2 instances has the necessary permissions for Secrets Manager operations, particularly the "secretsmanager:ListSecrets" action.
-
Verify network connectivity: Check if both instances have proper network access to the Secrets Manager service. Ensure that the VPC, subnet, and security group settings allow outbound traffic to AWS services.
-
Compare AWS CLI versions: Make sure both instances are running the same, up-to-date version of the AWS CLI. You can check this by running "aws --version" on both instances.
-
Check for any differences in AWS configuration: Verify that both instances have the same AWS configuration, including region settings. You can check this in the ~/.aws/config file.
-
Examine CloudTrail logs: Look for any API calls or error messages related to Secrets Manager operations from both instances.
-
Monitor system resources: Check if the non-responsive instance has any resource constraints (CPU, memory, disk space) that might be affecting its performance.
-
Test with other AWS services: Try running commands for other AWS services to see if the issue is specific to Secrets Manager or if it's a broader problem with AWS API access.
-
Verify instance metadata: Ensure both instances can access the EC2 instance metadata service by running "curl http://169.254.169.254/latest/meta-data/".
-
Check for any custom configurations or proxy settings that might be interfering with AWS API calls on the problematic instance.
-
If the issue persists, try terminating and relaunching the problematic instance to see if it resolves the problem.
If none of these steps resolve the issue, you may need to contact AWS support for further assistance, as there could be an underlying problem with the instance or the AWS services in your region.
Sources
Possib;e bug with IAM permissions and the secretsmanager:BatchGetSecretValue permission? | AWS re:Post
Troubleshoot Secrets Manager code 400 | AWS re:Post
Resolve Secrets Manager integration issues with MWAA | AWS re:Post
Additional information: I can access other services. Only secrets manager service does not work for that instance.
I added --debug option and the process hung at this line: MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): secretsmanager.[...].amazonaws.com:443.
Initial indication would be that network connectivity is not in place for that destination.
This could be due to networking and security in the VPC or on the instance.
I would take a look at the following:
- Can you resolve that endpoint dns entry on the box? Use ping or nslookup to do this and make a note of the returned IPs.
- Are the IPs returned correct? verify against working machine and your local machine.
- If the IPs are not correct verify host files or ip tables on the instance to see why a different address is returned.
- Are there any NACLs that would be restricting those IP destinations?
- Is routing in place for that destination?
- If routing is via a VPC Endpoint is there a security group or resource policy in place.
- Is the box running a firewall service that might be blocking the destination? if something like ufw on ubuntu is running temporarily turn it off to validate.
Hope this helps and gets you to see where the issue might be.
Relevant content
- asked 4 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 9 months ago
