Why Amazon Bedrock rejects Indian AWS accounts, and the one environment variable that fixed it
Four days before a hackathon deadline, Amazon Bedrock started refusing my prescription reading pipeline with INVALID_PAYMENT_INSTRUMENT. I spent three hours interrogating a credit card that had done nothing wrong. The real problem: Indian AWS accounts sit with AISPL, which cannot pay AWS Marketplace charges by card, and newer Anthropic inference profiles bill through Marketplace. The fix took one environment variable, because I had used the Bedrock Converse API instead of invoke_model. The whole story.
My card was fine. My continent wasn't.
Three hours with INVALID_PAYMENT_INSTRUMENT, and the one line of code that saved my hackathon
I am a third year CSE student in Allahabad. Four days before a hackathon deadline, I learned something about AWS billing that is not in any documentation I could find, and I lost most of an evening to an error message that pointed me at exactly the wrong thing.
This is that story, plus the fix, so the next person searching at 2am finds something.
The thing we were building
DoseAge reads prescriptions. You photograph the paper your doctor scribbled on, and it tells you which medicines you are actually taking, catches when two different brands are the same molecule, and reminds your grandmother in Hindi when it is time to take them.
The reason it exists is that my nani takes seven tablets a day from three doctors who have never spoken to each other. Two of those tablets were once the same drug under different brand names. Nobody caught it. Not the doctors, not the chemists, not us.
The whole thing turns on one step: reading messy Indian handwriting off a photo and turning it into strict JSON. That needs a vision model. So we reached for Amazon Bedrock.
Act one: Claude does not live in Mumbai
We deployed to ap-south-1, because our users are in India and I have opinions about latency.
First surprise: the newer Anthropic models are not sitting in Mumbai waiting for you. You reach them through a cross region inference profile, which is a model ID with a prefix on it. There is an
apac. flavour and a global. flavour.I read a blog post that said
apac. IDs fail from Mumbai, believed it, and went with global.anthropic.claude-haiku-4-5-20251001-v1:0 .Small aside, and genuinely my mistake: I should have just run
aws bedrock list-inference-profiles against my own account instead of trusting a stranger's blog post. When I eventually did, there were seven perfectly ACTIVE apac. Anthropic profiles sitting right there. Do not be me. Check your own account first. It takes eleven seconds.Anyway.
sam deploy went out clean. Forty seven resources, green across the board. I felt like a professional.Act two: the professional feeling evaporates
Uploaded a prescription. Watched the progress list. Watched it die.
AccessDeniedException: User is not authorized to perform:aws-marketplace:Subscribe
Marketplace? For a foundation model? Sure, fine, whatever. I added
aws-marketplace:ViewSubscriptions and aws-marketplace:Subscribe to the Lambda's IAM policy, redeployed, and felt clever for about ninety seconds.AccessDeniedException: Model access is denied due toINVALID_PAYMENT_INSTRUMENT
Now. Read that message as a tired student at 11pm. What does it tell you?
It tells you your card is bad.
So I went and looked at my card. Card was fine. Not expired, not blocked, not maxed out. I opened Billing, went to Payment preferences, stared at it, and re-entered the card anyway, the way you unplug a router you know is working.
Redeployed. Same error.
I checked my credits. There were credits. I checked my bill. Zero dollars, zero cents, perfectly healthy.
I did this for about three hours. If you have ever debugged something by repeatedly doing the thing that already did not work, we are the same.
Act three: the line I should have read first
Buried on the Bills page, in small grey text nobody reads, was this:
Amazon Web Services India Private Limited
Here is the thing nobody told me.
If you signed up for AWS from India, your account is not with Amazon Web Services, Inc. It is with AISPL, a separate legal entity, and it is the seller of record for everything you buy. That is normally invisible. Your console looks the same. Your services work the same.
But AISPL accounts cannot pay AWS Marketplace charges by credit card. Marketplace purchases on an AISPL account go through invoicing, which takes up to seven days to set up.
And newer Anthropic models delivered through a cross region inference profile are billed through Marketplace.
So the chain was:
- I want Claude in Mumbai
- Claude in Mumbai means an inference profile
- That inference profile bills through Marketplace
- My AISPL account cannot pay Marketplace by card
- AWS says
INVALID_PAYMENT_INSTRUMENT
My card was never the problem. My seller of record was the problem. But the error says "payment instrument", which is AWS's way of saying "card", so I spent an evening interrogating a card that had done nothing wrong.
Invoicing takes up to seven days. My deadline was in four.
This is the point in the evening where I put my head on the desk.
Act four: the accident that saved us
Here is the part I want you to take away, and I want to be honest that it was half luck.
Two days earlier, when I first wrote the extraction Lambda, I had a choice between
invoke_model and the Bedrock Converse API. I picked Converse, not out of foresight, but because the request shape was tidier and I did not want to hand craft a different JSON body for every model family.The Converse API is model agnostic. The same request works for Anthropic Claude, Amazon Nova, Meta Llama, Mistral and the rest. You change the model ID, everything else stays.
res = client.converse( modelId=config.BEDROCK_MODEL_ID, messages=[{ "role": "user", "content": [ {"image": {"format": fmt, "source": {"bytes": image_bytes}}}, {"text": prompt}, ], }], inferenceConfig={"maxTokens": 4000, "temperature": 0},)
Notice
config.BEDROCK_MODEL_ID . That is an environment variable, set from a CloudFormation parameter.So the fix for a project ending billing problem was:
BedrockModelId=apac.amazon.nova-pro-v1:0
One parameter. One redeploy. Zero lines of application code.
Amazon Nova is first party AWS, so it does not go through Marketplace at all, so AISPL pays for it the normal way, so it just works.
Fifteen minutes after I found the AISPL line, the pipeline was reading prescriptions again. On Nova. Which, for the record, handles Indian doctor handwriting well enough that our human review screen mostly confirms rather than corrects.
What I would tell past me
If you are on an Indian AWS account, check your seller of record before you plan around any Marketplace-delivered model. Billing page, small grey text, takes ten seconds. If it says Amazon Web Services India Private Limited, your card cannot pay Marketplace. Plan around it or start the invoicing paperwork a week early.
Run
list-inference-profiles against your own account. Not a blog post. Not a Reddit thread. Not even this blog post. Your account.Use the Converse API from day one. I cannot stress this enough. It costs you nothing to write it that way, and the day something goes wrong with one model family, you switch with an environment variable instead of a rewrite. This one accidental decision is the only reason we submitted anything.
Put your model ID in a parameter, never a constant. Same reason. If changing models means editing code, you will not change models under pressure, and under pressure is exactly when you need to.
A small request to AWS, said with love
INVALID_PAYMENT_INSTRUMENT is a technically correct error that sends people to the wrong place. Every single person who sees it will go and check their card. Nobody will think "ah yes, my seller of record."One extra sentence would fix it:
Model access denied. This model is billed through AWS Marketplace, and your account (AISPL) requires invoicing for Marketplace purchases. Set up invoicing here, or use a first party model.
That is it. That sentence would have saved me three hours and a small amount of dignity.
Similarly,
ListFoundationModels will cheerfully return models you cannot actually invoke. Listed, enabled, and billable are three different states and the API treats them as one.The ending
DoseAge shipped. It reads handwritten prescriptions on Amazon Nova Pro, catches duplicate salts across prescriptions from different doctors, reminds my grandmother in Hindi through Amazon Polly, and texts the family through SNS if she misses a dose.
The architecture I am proud of took planning. The decision that actually saved the project took no planning at all. I just happened to pick the flexible API because it looked neater, and two days later that was the difference between a submission and a shrug.
Sometimes engineering is like that. Write the version that is easy to change, and then be pleasantly surprised when you have to change it.
Built for the First Commit hackathon. DoseAge never changes a prescription. It flags what looks wrong and sends it to a doctor or pharmacist, because a salt lookup is deterministic and medical advice is not.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article