diff --git a/samples/cloudformation-cross-account/functions/packages/CfnStackAssumeRole/lambda.zip b/samples/cloudformation-cross-account/functions/packages/CfnStackAssumeRole/lambda.zip index 23f8f13..b2c5717 100644 Binary files a/samples/cloudformation-cross-account/functions/packages/CfnStackAssumeRole/lambda.zip and b/samples/cloudformation-cross-account/functions/packages/CfnStackAssumeRole/lambda.zip differ diff --git a/samples/cloudformation-cross-account/functions/source/CfnStackAssumeRole/lambda_function.py b/samples/cloudformation-cross-account/functions/source/CfnStackAssumeRole/lambda_function.py index cfc81c3..21773e2 100644 --- a/samples/cloudformation-cross-account/functions/source/CfnStackAssumeRole/lambda_function.py +++ b/samples/cloudformation-cross-account/functions/source/CfnStackAssumeRole/lambda_function.py @@ -3,7 +3,7 @@ import string import logging import threading -import requests +import urllib3 # Added by EM import json from botocore.credentials import ( AssumeRoleCredentialFetcher, @@ -14,6 +14,8 @@ from botocore.exceptions import ClientError +http = urllib3.PoolManager() # Added by EM + cfn_states = { "failed": ["CREATE_FAILED", "ROLLBACK_IN_PROGRESS", "ROLLBACK_FAILED", "ROLLBACK_COMPLETE", "DELETE_FAILED", "UPDATE_ROLLBACK_IN_PROGRESS", "UPDATE_ROLLBACK_FAILED", "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS", @@ -83,9 +85,8 @@ def send(event, context, response_status, response_data, physical_resource_id, l } try: - response = requests.put(response_url, - data=json_response_body, - headers=headers) + response = http.request('PUT', response_url, headers=headers, body=json_response_body) + logger.info("CloudFormation returned status code: " + response.reason) except Exception as e: logger.error("send(..) failed executing requests.put(..): " + str(e)) diff --git a/samples/cloudformation-cross-account/functions/source/CfnStackAssumeRole/requirements.txt b/samples/cloudformation-cross-account/functions/source/CfnStackAssumeRole/requirements.txt deleted file mode 100644 index f229360..0000000 --- a/samples/cloudformation-cross-account/functions/source/CfnStackAssumeRole/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -requests