Skip to content

Commit

Permalink
add missing service to auth instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdunnjpl committed Aug 26, 2024
1 parent d907e85 commit 9269ee3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pds/registrysweepers/utils/db/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_aws_credentials_from_ssm(iam_role_name: str) -> Credentials:
url = f"http://169.254.169.254/latest/meta-data/iam/security-credentials/{iam_role_name}"
response = requests.get(url)
if response.status_code != 200:
raise RuntimeError(f'Got HTTP{response.status_code} when attempting to retrieve SSM credentials from {url}')
raise RuntimeError(f"Got HTTP{response.status_code} when attempting to retrieve SSM credentials from {url}")
content = response.json()

access_key_id = content["AccessKeyId"]
Expand All @@ -79,7 +79,7 @@ def get_aws_credentials_from_ssm(iam_role_name: str) -> Credentials:
def get_aws_aoss_client_from_ssm(endpoint_url: str, iam_role_name: str) -> OpenSearch:
# https://opensearch.org/blog/aws-sigv4-support-for-clients/
credentials = get_aws_credentials_from_ssm(iam_role_name)
auth = RequestsAWSV4SignerAuth(credentials, "us-west-2")
auth = RequestsAWSV4SignerAuth(credentials, "us-west-2", "aoss")
return get_aws_opensearch_client(endpoint_url, auth)


Expand Down

0 comments on commit 9269ee3

Please sign in to comment.