Skip to content

IAM User receives "explicit deny" for Amazon Location Service (GeoPlaces) despite Allow policy

0

Summary

I'm unable to make API calls to Amazon Location Service (GeoPlaces/GeoRoutes) from my server-side application. Despite attaching a policy that explicitly allows all geo* actions, my IAM user receives "User is not authorized to access this resource with an explicit deny" errors.

Environment AWS Region: us-east-2 Services: Amazon Location Service (GeoPlaces, GeoRoutes) SDK: AWS SDK for JavaScript v3 (@aws-sdk/client-geo-places, @aws-sdk/client-geo-routes) Deployment: Railway.app (Node.js serverless environment) Authentication Method: IAM user credentials (Access Key ID + Secret Access Key)

What I'm Trying to Do

Make server-side geocoding requests using GeoPlacesClient and GeocodeCommand from my Next.js application deployed on Railway.

IAM Configuration IAM User: sales-ops-dashboard Attached Policy (inline): { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "geo:", "geo-places:", "geo-routes:", "geo-maps:" ], "Resource": "*" } ]}

Environment Variables Set:

AWS_ACCESS_KEY_ID = (IAM user access key, starts with AKIA...) AWS_SECRET_ACCESS_KEY = (corresponding secret) AWS_REGION = us-east-2

Code Sample

import { GeoPlacesClient, GeocodeCommand } from '@aws-sdk/client-geo-places';const client = new GeoPlacesClient({ region: 'us-east-2' });// SDK automatically picks up AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEYconst command = new GeocodeCommand({ QueryText: '123 Main St, Memphis, TN', MaxResults: 1,});const response = await client.send(command);

Error Message

User: arn:aws:iam::X:user/sales-ops-dashboard is not authorized to access this resource with an explicit deny

Troubleshooting Already Attempted

✅ Verified IAM policy is attached directly to the user (not just a group) ✅ Confirmed policy syntax is valid in IAM Policy Validator ✅ Verified environment variables are correctly set in Railway (checked via logs) ✅ Confirmed Access Key ID matches the IAM user created ✅ Rotated access keys and created new credentials ✅ Tried both inline policy and managed policy attachment ✅ Expanded permissions to include geo:, geo-places:, geo-routes:, geo-maps: ✅ Verified no explicit Deny statements exist in any attached policies ✅ Checked for Service Control Policies (SCPs) - account is not part of an AWS Organization

Questions

What is causing the "explicit deny"? My policy only contains Allow statements. Is there a specific permission or resource ARN required for GeoPlaces? The documentation suggests geo:* should cover all Location Service actions. Are there any account-level restrictions on Amazon Location Service that could cause this? Should I be using the API Key authentication method instead of IAM for server-side calls? I have an Amazon Location API Key (v1.public...) but understood that IAM credentials are the recommended approach for server-side applications.

Additional Context

The same IAM credentials work for other AWS services The error occurs immediately upon making the API call (not a timeout) I have NOT enabled any resource-based policies on Location Service resources The Amazon Location API Key (v1.public...) was created but is NOT being used in this flow - I'm using IAM authentication

**Requested Resolution

Please help identify:**

The source of the "explicit deny" The correct IAM policy for server-side GeoPlaces API access Any account-level settings that might be blocking access

2 Answers
1

An explicit deny usually points to 1 of 2 things.

  • Permission boundary
  • SCPs

One of these is likely causing the issue

EXPERT

answered 9 months ago

EXPERT

reviewed 9 months ago

1

You can also test your policy using the policy simulator. It could tell you whether your policy is blocking/allowing access. https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html

EXPERT

answered 9 months ago

EXPERT

reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.