diff --git a/src/rpdk/core/boto_helpers.py b/src/rpdk/core/boto_helpers.py index eed4b9c6..f70273a4 100644 --- a/src/rpdk/core/boto_helpers.py +++ b/src/rpdk/core/boto_helpers.py @@ -44,7 +44,7 @@ def get_temporary_credentials(session, key_names=BOTO_CRED_KEYS, role_arn=None): ) try: response = sts_client.assume_role( - RoleArn=role_arn, RoleSessionName=session_name, DurationSeconds=21600 + RoleArn=role_arn, RoleSessionName=session_name, DurationSeconds=900 ) except ClientError: # pylint: disable=W1201 @@ -64,7 +64,7 @@ def get_temporary_credentials(session, key_names=BOTO_CRED_KEYS, role_arn=None): creds = (frozen.access_key, frozen.secret_key, frozen.token) else: try: - response = sts_client.get_session_token(DurationSeconds=21600) + response = sts_client.get_session_token(DurationSeconds=900) except ClientError as e: LOG.debug( "Getting session token resulted in unknown ClientError", exc_info=e diff --git a/tests/test_boto_helpers.py b/tests/test_boto_helpers.py index 540f3e7a..0cc24642 100644 --- a/tests/test_boto_helpers.py +++ b/tests/test_boto_helpers.py @@ -101,7 +101,7 @@ def test_get_temporary_credentials_needs_token(): endpoint_url="https://sts.us-east-2.amazonaws.com", region_name="us-east-2", ) - client.get_session_token.assert_called_once_with(DurationSeconds=21600) + client.get_session_token.assert_called_once_with(DurationSeconds=900) assert len(creds) == 3 assert tuple(creds.keys()) == LOWER_CAMEL_CRED_KEYS @@ -135,7 +135,7 @@ def test_get_temporary_credentials_invalid_credentials(): endpoint_url="https://sts.us-east-2.amazonaws.com", region_name="us-east-2", ) - client.get_session_token.assert_called_once_with(DurationSeconds=21600) + client.get_session_token.assert_called_once_with(DurationSeconds=900) def test_get_temporary_credentials_assume_role_fails(): @@ -163,7 +163,7 @@ def test_get_temporary_credentials_assume_role_fails(): region_name="us-east-2", ) client.assume_role.assert_called_once_with( - RoleArn=EXPECTED_ROLE, RoleSessionName=ANY, DurationSeconds=21600 + RoleArn=EXPECTED_ROLE, RoleSessionName=ANY, DurationSeconds=900 ) @@ -192,7 +192,7 @@ def test_get_temporary_credentials_assume_role(): region_name="cn-north-1", ) client.assume_role.assert_called_once_with( - RoleArn=EXPECTED_ROLE, RoleSessionName=ANY, DurationSeconds=21600 + RoleArn=EXPECTED_ROLE, RoleSessionName=ANY, DurationSeconds=900 ) assert len(creds) == 3