Check out example codes for "aws sts assume-role example". It will help you in understanding the concepts better.

Code Example 1

aws sts assume-role --role-arn arn:aws:iam::123456789012:role/xaccounts3access --role-session-name s3-access-example

Learn ReactJs, React Native from akashmittal.com