Sudeep Mishra
3 Powerful Secrets to Bulletproof Cross Account Assume Role Implementation via CloudFormation

Contents
Juggling AWS accounts? Tired of playing security whack-a-mole? Me too. Sharing credentials is like using a community toothbrush – technically possible but deeply disturbing.Enter cross account assume role with CloudFormation – the dynamic duo your AWS environment desperately needs.
Key Concepts of Cross Account Assume Role
1. Trusting Account
Where your stuff lives. Has roles that say, “Fine, you can pretend to be me, but just for a bit.” Like lending someone your car but keeping the ability to remotely shut it down.
2. Trusted Account
Where your people live. They temporarily “borrow” permissions instead of getting permanent all-access passes. No more “No one noticed Safal still had access after his internship ended.” situations.
3. CloudFormation IAM Role
Your digital bouncer with two key items:
- A Trust Policy: The VIP list checking IDs at the door
- A Permissions Policy: Determining if you get the good champagne or just tap water
4. Security Token Service (STS)
AWS’s no-nonsense security guard who issues temporary badges. The credentials equivalent of disappearing ink.
Real-World Example
At my last gig, our CI/CD pipeline needed to deploy from Dev into Production. Instead of giving it permanent keys to the kingdom, we:
- Created a role in production with just enough permissions
- Let our development pipeline temporarily assume that role
- observed that, for once, none of our security personnel had migraines.
Magic.
This type of Cross Account Assume Role setup with CloudFormation transforms chaos into neat, secure automation.
CloudFormation Implementation
No more clicking around the console like you’re playing an AWS-themed hidden object game. Let’s code this thing.
Step 1: Create Role in Trusting Account

The trust policy is basically saying, “I’ll let this specific account in, but only if they know the secret handshake.”
Step 2: Create Policy in Trusted Account
This is just permission to knock on the door. Getting in is a whole other story.
StackSets for Multi-Account Wizardry
Still clicking “deploy” in 20 different accounts? That’s adorable. Let’s scale your AWS Cross Account Assume Role strategy across several environments with a single deployment using StackSets.
Admin Account Setup

Giving CloudFormation the keys to your AWS kingdom. What could possibly go wrong?
Target Account Setup


Security Best Practices
Lessons I’ve learned from painful audit meetings:
Use External IDs
Add this extra password to prevent confused deputy attacks. It’s like having a secret code word before someone can borrow your identity.
Limit Session Duration
Temporary is good. The 1-hour default means even leaked credentials self-destruct. Mission Impossible style.
Enable MFA
For sensitive roles:

Because sometimes passwords just aren’t enough.
Audit Everything
Turn on CloudTrail. If you don’t know who’s in your accounts its like inviting cybercriminals to the party.
Common Use Cases
Centralized Logging
Security folks can pull logs from everywhere without needing 20 different logins.
CI/CD Pipelines
Deploy to prod without compromising security. Like visiting a foreign country without getting citizenship.
Third-party Access
Give consultants just enough access without wondering what else they’re poking around in.
Troubleshooting Tips
“Access Denied”
Check your account IDs. It’s always the account IDs.
Invalid External ID
Case sensitivity matters. “Secret” and “secret” are different, just like my coffee order is not up for creative interpretation.
Role Not Found
Typos in ARNs are the hide-and-seek champions of AWS issues.
Permission Boundaries
These can block otherwise valid permissions. They’re the overprotective parents of AWS.
Conclusion
CloudFormation’s AWS Cross Account Assume Role transformed my life, or at least my approach to cloud computing. Start small, then expand like Cloudlaya.
Your security team will think you’ve finally seen the light. Your developers will stop creating shadow IT solutions. Everyone wins.
Congrats on mastering access control! Now stop lighting money on fire. CostQ keeps your cloud spend from going full chaos mode.
Now go assume some roles! Just don’t assume your security team isn’t watching—they’ve got alerts for that.
Sudeep Mishra
Cloud Expert
Expert in cloud infrastructure and cost optimization with over a decade of experience in helping companies reduce their cloud spending while maintaining performance.