Home > Storage > ObjectScale and ECS > Product Documentation > ECS IAM Introduction > Same account access with AssumeRole
You can access the same account using AssumeRole by attaching a policy to the user (identical to the previous user in a different account) or by adding the user as a principal directly in the role trust policy.
#Trust policy for Role assumeRoleSameAccount in ns1:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "urn:ecs:iam::ns1:root"
},
"Action": "sts:AssumeRole"
}
]
}
# Policy is attached to the user1 in ns1 to AssumeRole:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"sts:AssumeRole"
],
"Resource": "urn:ecs:iam::ns1:role/
assumeRoleSameAccount",
"Effect": "Allow",
"Sid": "VisualEditor0"
}
]
}
#Trust policy for Role in ns1 with an ECS IAM user:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "urn:ecs:iam::ns1:user/user1"
},
"Action": "sts:AssumeRole"
}
]
}