From ede8b68665efa7c5e27735ec61c3c9abfb647d00 Mon Sep 17 00:00:00 2001 From: David Han Date: Tue, 13 Jan 2026 08:57:25 -0500 Subject: [PATCH 1/2] Use dedicated ccm-config endpoint --- aws_cloud_cost_cur2/datadog_ccm_api_call.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/aws_cloud_cost_cur2/datadog_ccm_api_call.py b/aws_cloud_cost_cur2/datadog_ccm_api_call.py index 0c45c7c..c81511c 100644 --- a/aws_cloud_cost_cur2/datadog_ccm_api_call.py +++ b/aws_cloud_cost_cur2/datadog_ccm_api_call.py @@ -40,8 +40,8 @@ def get_datadog_account_uuid(event): return None, f"Failed to get account: {e.code} - {error_body}" -def patch_ccm_config(event, uuid): - """PATCH the Datadog account with CCM data export config.""" +def create_ccm_config(event, uuid): + """Create CCM config using the dedicated CCM config endpoint.""" api_key = event["ResourceProperties"]["APIKey"] app_key = event["ResourceProperties"]["APPKey"] api_url = event["ResourceProperties"]["ApiURL"] @@ -50,7 +50,7 @@ def patch_ccm_config(event, uuid): report_name = event["ResourceProperties"]["ReportName"] report_prefix = event["ResourceProperties"]["ReportPrefix"] - url = f"https://api.{api_url}/api/v2/integration/aws/accounts/{uuid}" + url = f"https://api.{api_url}/api/v2/integration/aws/accounts/{uuid}/ccm_config" headers = { "DD-API-KEY": api_key, "DD-APPLICATION-KEY": app_key, @@ -79,8 +79,7 @@ def patch_ccm_config(event, uuid): } data = json.dumps(payload).encode("utf-8") - request = urllib.request.Request(url, data=data, headers=headers) - request.get_method = lambda: "PATCH" + request = urllib.request.Request(url, data=data, headers=headers, method="POST") try: response = urllib.request.urlopen(request) @@ -110,8 +109,8 @@ def handler(event, context): LOGGER.info(f"Found Datadog account UUID: {uuid}") - # PATCH the CCM config - status_code, response_data = patch_ccm_config(event, uuid) + # Create the CCM config using the dedicated endpoint + status_code, response_data = create_ccm_config(event, uuid) if status_code == 200: LOGGER.info("Successfully configured CCM data export") From b454da76009e2042b0f0a3a0d970a1de06c8cae1 Mon Sep 17 00:00:00 2001 From: David Han Date: Wed, 14 Jan 2026 14:57:44 -0500 Subject: [PATCH 2/2] bump version --- aws_cloud_cost_cur2/README.md | 2 +- aws_cloud_cost_cur2/version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aws_cloud_cost_cur2/README.md b/aws_cloud_cost_cur2/README.md index a1da7db..0609a82 100644 --- a/aws_cloud_cost_cur2/README.md +++ b/aws_cloud_cost_cur2/README.md @@ -46,4 +46,4 @@ Use `--private` to prevent granting public access (useful for testing): ./release.sh --private ``` -The template will be available at `s3:///aws_cloud_cost_cur2/v0.0.1/main.yaml`. +The template will be available at `s3:///aws_cloud_cost_cur2/v0.0.2/main.yaml`. diff --git a/aws_cloud_cost_cur2/version.txt b/aws_cloud_cost_cur2/version.txt index 95e94cd..a3dce6c 100644 --- a/aws_cloud_cost_cur2/version.txt +++ b/aws_cloud_cost_cur2/version.txt @@ -1 +1 @@ -v0.0.1 \ No newline at end of file +v0.0.2