This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "Statement1", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": [ | |
"arn:aws:iam::390096245597:role/roleserviceA" | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
sts_client = boto3.client('sts') | |
response = sts_client.assume_role( | |
RoleArn='arn:aws:iam::123456789012:role/YourRole', | |
RoleSessionName='mysession', | |
) | |
temp_credentials = response["Credentials"] | |
sns_client = boto3.client( | |
'sns', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
client = boto3.client('sns') | |
response = client.publish( | |
TopicArn='arn:aws:sns:region:account-id:service_c_topic', | |
Message='Hello, this is a test message from my SNS topic!' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2008-10-17", | |
"Id": "__default_policy_ID", | |
"Statement": [ | |
{ | |
"Sid": "serviceA_can_publish", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": [ | |
"service_A_Account" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "sns:Publish", | |
"Resource": "arn:aws:sns:region:123456789012:topic-name" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "execute-api:Invoke", | |
"Resource": "arn:aws:execute-api:region:123456789012:api-id/stage-name/HTTP-VERB/resource-path" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "Statement1", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": [ | |
"arn:aws:iam::390096245597:role/roleserviceA", | |
"arn:aws:iam::390096245597:role/roleserviceB" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import requests | |
from aws_requests_auth.aws_auth import AWSRequestsAuth | |
sts_client = boto3.client('sts') | |
response = sts_client.assume_role( | |
RoleArn='arn:aws:iam::123456789012:role/YourRole', | |
RoleSessionName='mysession', | |
) | |
temp_credentials = response["Credentials"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import requests | |
from aws_requests_auth.aws_auth import AWSRequestsAuth | |
session = boto3.Session() | |
credentials = session.get_credentials() | |
auth = AWSRequestsAuth( | |
aws_access_key=credentials.access_key, | |
aws_secret_access_key=credentials.secret_key, | |
aws_token=credentials.token, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": [ | |
"arn:aws:iam::{{otherAWSAccountID}}:root", | |
"arn:aws:iam::{{otherAWSAccountID}}:role/{{otherAWSRoleName}}" | |
] |
NewerOlder