- Newest
- Most votes
- Most comments
Hi Mark,
If an ABAP program has created a session which has assumed a certain role aaa (using an SDK profile AAA), and now the ABAP program would like to assume a different role bbb, the easiest way is to create a second SDK profile (with a different IAM role mapping) and create another session.
DATA(lo_session_aaa) = /aws1/cl_rt_session_aws=>create( 'AAA' ). "
DATA(lo_s3) = /aws1/cl_s3_factory=>create( lo_session_aaa ). " access S3 with SDK profile AAA mapping to role aaa
DATA(lo_session_bbb) = /aws1/cl_rt_session_aws=>create( 'BBB' ).
DATA(lo_athena) = /aws1/cl_ath_factory=>create( lo_session_bbb ). " access athena with SDK profile BBB mapping to role bbb
We don't have a mechanism to create a session using credentials acquired manually (either from an explicit call to ASSUMEROLE or from other sources), as a way of discouraging insecure storage or handling of credentials. If you've got a use case where such a thing is necessary, we'd be happy to look into it. If your company has an AWS SA that you work with, please forward this thread to them and they'll help connect you with me directly, otherwise please send a ticket to AWS Support (under service IAM Roles Anywhere, Category Other) and link to this thread in the ticket and they will route it to me, and we can discuss your use case in depth.
Thanks, Jon
Relevant content
- asked 10 months ago
- AWS OFFICIALUpdated 9 months ago

Thanks Jon!
Ill forward this to our SA's. In our implementation, the bbb role would be in a different AWS account that does not run IAM Roles Anywhere. So we thought to have role aaa used by ABAP in account A (with IAM Roles Anywhere) trusted to assume role bbb in account b, and role bbb has the actual permissions.