Skip to content

Commit

Permalink
Merge branch 'release-1.33.2'
Browse files Browse the repository at this point in the history
* release-1.33.2:
  Bumping version to 1.33.2
  Update changelog based on model updates
  Update EC2 service principal
  • Loading branch information
aws-sdk-python-automation committed Jun 5, 2024
2 parents 159935a + 323dc8b commit dbddede
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 9 deletions.
22 changes: 22 additions & 0 deletions .changes/1.33.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"category": "``globalaccelerator``",
"description": "This release contains a new optional ip-addresses input field for the update accelerator and update custom routing accelerator apis. This input enables consumers to replace IPv4 addresses on existing accelerators with addresses provided in the input.",
"type": "api-change"
},
{
"category": "``glue``",
"description": "AWS Glue now supports native SaaS connectivity: Salesforce connector available now",
"type": "api-change"
},
{
"category": "``s3``",
"description": "Added new params copySource and key to copyObject API for supporting S3 Access Grants plugin. These changes will not change any of the existing S3 API functionality.",
"type": "api-change"
},
{
"category": "emr customization",
"description": "Update the EC2 service principal when creating the trust policy for EMR default roles to always be ec2.amazonaws.com.",
"type": "bugfix"
}
]
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
CHANGELOG
=========

1.33.2
======

* api-change:``globalaccelerator``: This release contains a new optional ip-addresses input field for the update accelerator and update custom routing accelerator apis. This input enables consumers to replace IPv4 addresses on existing accelerators with addresses provided in the input.
* api-change:``glue``: AWS Glue now supports native SaaS connectivity: Salesforce connector available now
* api-change:``s3``: Added new params copySource and key to copyObject API for supporting S3 Access Grants plugin. These changes will not change any of the existing S3 API functionality.
* bugfix:emr customization: Update the EC2 service principal when creating the trust policy for EMR default roles to always be ec2.amazonaws.com.


1.33.1
======

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.33.1'
__version__ = '1.33.2'

#
# Get our data path to be added to botocore's search path
Expand Down
1 change: 1 addition & 0 deletions awscli/customizations/emr/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
EMR_AUTOSCALING_ROLE_POLICY_NAME = "AmazonElasticMapReduceforAutoScalingRole"
EMR_AUTOSCALING_SERVICE_NAME = "application-autoscaling"
EMR_AUTOSCALING_SERVICE_PRINCIPAL = "application-autoscaling.amazonaws.com"
EC2_SERVICE_PRINCIPAL = "ec2.amazonaws.com"

# Action on failure
CONTINUE = 'CONTINUE'
Expand Down
6 changes: 5 additions & 1 deletion awscli/customizations/emr/createdefaultroles.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from awscli.customizations.emr.command import Command
from awscli.customizations.emr.constants import EC2
from awscli.customizations.emr.constants import EC2_ROLE_NAME
from awscli.customizations.emr.constants import EC2_SERVICE_PRINCIPAL
from awscli.customizations.emr.constants import ROLE_ARN_PATTERN
from awscli.customizations.emr.constants import EMR
from awscli.customizations.emr.constants import EMR_ROLE_NAME
Expand Down Expand Up @@ -64,6 +65,9 @@ def get_role_policy_arn(region, policy_name):


def get_service_principal(service, endpoint_host, session=None):
if service == EC2:
return EC2_SERVICE_PRINCIPAL

suffix, region = _get_suffix_and_region_from_endpoint_host(endpoint_host)
if session is None:
session = botocore.session.Session()
Expand Down Expand Up @@ -277,7 +281,7 @@ def _create_role_with_role_policy(
service_principal.append(get_service_principal(
service, self.emr_endpoint_url, self._session))

LOG.debug(service_principal)
LOG.debug(f'Adding service principal(s) to trust policy: {service_principal}')

parameters = {'RoleName': role_name}
_assume_role_policy = \
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# The short X.Y version.
version = '1.33'
# The full version, including alpha/beta/rc tags.
release = '1.33.1'
release = '1.33.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ universal = 0

[metadata]
requires_dist =
botocore==1.34.119
botocore==1.34.120
docutils>=0.10,<0.17
s3transfer>=0.10.0,<0.11.0
PyYAML>=3.10,<6.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def find_version(*file_paths):


install_requires = [
'botocore==1.34.119',
'botocore==1.34.120',
'docutils>=0.10,<0.17',
's3transfer>=0.10.0,<0.11.0',
'PyYAML>=3.10,<6.1',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/customizations/emr/test_create_default_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class TestCreateDefaultRole(BaseAWSCommandParamsTest):
{
"Sid": "",
"Effect": "Allow",
"Principal": {"Service": "ec2.amazonaws.com.cn"},
"Principal": {"Service": "ec2.amazonaws.com"},
"Action": "sts:AssumeRole"
}
]
Expand Down
12 changes: 9 additions & 3 deletions tests/unit/customizations/emr/test_get_service_principal.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@

class TestEmrConfig(unittest.TestCase):
ec2_service = "ec2"
ec2_service_principal = "ec2.amazonaws.com"
emr_service = "elasticmapreduce"
endpoint1 = "https://ap-southeast-1.elasticmapreduce.abc/"
endpoint2 = "https://elasticmapreduce.abcd.def.ghi"
endpoint3 = "https://grabage.nothing.com"
endpoint3 = "https://garbage.nothing.com"
expected_result1 = "elasticmapreduce.abc"
expected_result2 = "elasticmapreduce.def.ghi"

def test_get_service_principal(self):
def test_get_emr_service_principal(self):
msg = "Generated Service Principal does not match the expected" + \
"Service Principal"

Expand All @@ -37,9 +38,14 @@ def test_get_service_principal(self):
self.assertEqual(result2, self.expected_result2, msg)

self.assertRaises(ResolveServicePrincipalError,
get_service_principal, self.ec2_service,
get_service_principal, self.emr_service,
self.endpoint3)

def test_get_ec2_service_principal(self):
self.assertEqual(get_service_principal(self.ec2_service, self.endpoint1), self.ec2_service_principal)
self.assertEqual(get_service_principal(self.ec2_service, self.endpoint2), self.ec2_service_principal)
self.assertEqual(get_service_principal(self.ec2_service, self.endpoint3), self.ec2_service_principal)


if __name__ == "__main__":
unittest.main()

0 comments on commit dbddede

Please sign in to comment.