old_contents: # Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  # This file is licensed under the Apache License, Version 2.0 (the "License").
  # You may not use this file except in compliance with the License. A copy of
  # the License is located at
  # 
  # http://aws.amazon.com/apache2.0/
  # 
  # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  # CONDITIONS OF ANY KIND, either express or implied. See the License for the
  # specific language governing permissions and limitations under the License.
  
  # snippet-sourcedescription:[assume_role.py demonstrates how to use the Boto3 interface to call AssumeRole. The temporary security credentials returned by AssumeRole are then used to list all Amazon S3 buckets in the account.]
  # snippet-service:[iam]
  # snippet-keyword:[Python]
  # snippet-keyword:[AWS Identity and Access Management (IAM)]
  # snippet-keyword:[Code Sample]
  # snippet-keyword:[AssumeRole]
  # snippet-sourcetype:[full-example]
  # snippet-sourcedate:[2019-01-22]
  # snippet-sourceauthor:[stephswo (AWS)]
  # snippet-start:[iam.python.assume_role.complete]
  
  import boto3
  
  # The calls to AWS STS AssumeRole must be signed with the access key ID
  # and secret access key of an existing IAM user or by using existing temporary 
  # credentials such as those from antoher role. (You cannot call AssumeRole 
  # with the access key for the root account.) The credentials can be in 
  # environment variables or in a configuration file and will be discovered 
  # automatically by the boto3.client() function. For more information, see the 
  # Python SDK documentation: 
  # http://boto3.readthedocs.io/en/latest/reference/services/sts.html#client
  
  # create an STS client object that represents a live connection to the 
  # STS service
  sts_client = boto3.client('sts')
  
  # Call the assume_role method of the STSConnection object and pass the role
  # ARN and a role session name.
  assumed_role_object=sts_client.assume_role(
      RoleArn="arn:aws:iam::account-of-role-to-assume:role/name-of-role",
      RoleSessionName="AssumeRoleSession1"
  )
  
  # From the response that contains the assumed role, get the temporary 
  # credentials that can be used to make subsequent API calls
  credentials=assumed_role_object['Credentials']
  
  # Use the temporary credentials that AssumeRole returns to make a 
  # connection to Amazon S3  
  s3_resource=boto3.resource(
      's3',
      aws_access_key_id=credentials['AccessKeyId'],
      aws_secret_access_key=credentials['SecretAccessKey'],
      aws_session_token=credentials['SessionToken'],
  )
  
  # Use the Amazon S3 resource object that is now configured with the 
  # credentials to access your S3 buckets. 
  for bucket in s3_resource.buckets.all():
      print(bucket.name)
  
  # snippet-end:[iam.python.assume_role.complete]
  
new_contents: # Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  # This file is licensed under the Apache License, Version 2.0 (the "License").
  # You may not use this file except in compliance with the License. A copy of
  # the License is located at
  # 
  # http://aws.amazon.com/apache2.0/
  # 
  # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  # CONDITIONS OF ANY KIND, either express or implied. See the License for the
  # specific language governing permissions and limitations under the License.
  
  # snippet-sourcedescription:[assume_role.py demonstrates how to use the Boto3 interface to call AssumeRole. The temporary security credentials returned by AssumeRole are then used to list all Amazon S3 buckets in the account.]
  # snippet-service:[iam]
  # snippet-keyword:[Python]
  # snippet-keyword:[AWS Identity and Access Management (IAM)]
  # snippet-keyword:[Code Sample]
  # snippet-keyword:[AssumeRole]
  # snippet-sourcetype:[full-example]
  # snippet-sourcedate:[2019-01-22]
  # snippet-sourceauthor:[stephswo (AWS)]
  # snippet-start:[iam.python.assume_role.complete]
  
  import boto3
  
  # The calls to AWS STS AssumeRole must be signed with the access key ID
  # and secret access key of an existing IAM user or by using existing temporary 
  # credentials such as those from antoher role. (You cannot call AssumeRole 
  # with the access key for the root account.) The credentials can be in 
  # environment variables or in a configuration file and will be discovered 
  # automatically by the boto3.client() function. For more information, see the 
  # Python SDK documentation: 
  # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sts.html#client
  
  # create an STS client object that represents a live connection to the 
  # STS service
  sts_client = boto3.client('sts')
  
  # Call the assume_role method of the STSConnection object and pass the role
  # ARN and a role session name.
  assumed_role_object=sts_client.assume_role(
      RoleArn="arn:aws:iam::account-of-role-to-assume:role/name-of-role",
      RoleSessionName="AssumeRoleSession1"
  )
  
  # From the response that contains the assumed role, get the temporary 
  # credentials that can be used to make subsequent API calls
  credentials=assumed_role_object['Credentials']
  
  # Use the temporary credentials that AssumeRole returns to make a 
  # connection to Amazon S3  
  s3_resource=boto3.resource(
      's3',
      aws_access_key_id=credentials['AccessKeyId'],
      aws_secret_access_key=credentials['SecretAccessKey'],
      aws_session_token=credentials['SessionToken'],
  )
  
  # Use the Amazon S3 resource object that is now configured with the 
  # credentials to access your S3 buckets. 
  for bucket in s3_resource.buckets.all():
      print(bucket.name)
  
  # snippet-end:[iam.python.assume_role.complete]
  
subject: Update link to boto