Skip to content

Commit

Permalink
Merge branch 'release-1.11.11'
Browse files Browse the repository at this point in the history
* release-1.11.11:
  Bumping version to 1.11.11
  Update changelog based on model updates
  Update changelog for cloudrail
  Fix typo (?) in sync documentation
  Remove dead code after integration with s3transfer
  Replace IAM with STS in CreateSubscription
  • Loading branch information
AWS committed Nov 1, 2016
2 parents 748caf6 + 66ffbbd commit 65f6cad
Show file tree
Hide file tree
Showing 26 changed files with 71 additions and 4,282 deletions.
12 changes: 12 additions & 0 deletions .changes/1.11.11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"category": "``cloudtrail``",
"description": "Use STS instead of IAM in CreateSubscription",
"type": "bugfix"
},
{
"category": "``cloudformation``",
"description": "Update cloudformation command to latest version",
"type": "feature"
}
]
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
CHANGELOG
=========

1.11.11
=======

* bugfix:``cloudtrail``: Use STS instead of IAM in CreateSubscription
* feature:``cloudformation``: Update cloudformation command to latest version


1.11.10
=======

Expand Down
2 changes: 1 addition & 1 deletion awscli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""
import os

__version__ = '1.11.10'
__version__ = '1.11.11'

#
# Get our data path to be added to botocore's search path
Expand Down
6 changes: 3 additions & 3 deletions awscli/customizations/cloudtrail/subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def setup_services(self, args, parsed_globals):

# Initialize services
LOG.debug('Initializing S3, SNS and CloudTrail...')
self.iam = self._session.create_client('iam', **client_args)
self.sts = self._session.create_client('sts', **client_args)
self.s3 = self._session.create_client('s3', **client_args)
self.sns = self._session.create_client('sns', **client_args)
self.region_name = self.s3.meta.region_name
Expand Down Expand Up @@ -187,7 +187,7 @@ def setup_new_bucket(self, bucket, prefix, custom_policy=None):
sys.stdout.write(
'Setting up new S3 bucket {bucket}...\n'.format(bucket=bucket))

account_id = get_account_id(self.iam)
account_id = get_account_id(self.sts)

# Clean up the prefix - it requires a trailing slash if set
if prefix and not prefix.endswith('/'):
Expand Down Expand Up @@ -239,7 +239,7 @@ def setup_new_topic(self, topic, custom_policy=None):
sys.stdout.write(
'Setting up new SNS topic {topic}...\n'.format(topic=topic))

account_id = get_account_id(self.iam)
account_id = get_account_id(self.sts)

# Make sure topic doesn't already exist
# Warn but do not fail if ListTopics permissions
Expand Down
8 changes: 4 additions & 4 deletions awscli/customizations/cloudtrail/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def get_account_id_from_arn(trail_arn):
return trail_arn.split(':')[4]


def get_account_id(iam_client):
"""Retrieve the AWS account ID for the authenticated user"""
response = iam_client.get_user()
return get_account_id_from_arn(response['User']['Arn'])
def get_account_id(sts_client):
"""Retrieve the AWS account ID for the authenticated user or role"""
response = sts_client.get_caller_identity()
return response['Account']


def get_trail_by_arn(cloudtrail_client, trail_arn):
Expand Down
Loading

0 comments on commit 65f6cad

Please sign in to comment.