Skip to content

Instantly share code, notes, and snippets.

Created August 26, 2022 17:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mikegrima/b12a4ecad92eb8f71d2855e278efd791 to your computer and use it in GitHub Desktop.
Boto3 STS endpoint "fun"
# If doing STS things, you will need to make sure that you use the proper STS endpoint now.
# You need to remember that you need to pass in the endpoint URL. Use this for CloudAux:
from typing import Any, Dict, List
from botocore.client import BaseClient
from cloudaux import sts_conn
from import paginated
ROLE_TO_ASSUME = "AssumeThisRole"
ACCOUNT_NUMBER = "012345678910"
REGION = "af-south-1"
@paginated("Keys", request_pagination_marker="Marker", response_pagination_marker="NextMarker")
def list_keys(client: BaseClient = None, **kwargs) -> List[Dict[str, Any]]:
return client.list_keys(**kwargs)
# Using it:
kms_keys = list_keys(
sts_client_kwargs={"endpoint_url": f"https://sts.{REGION}", "region_name": REGION},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment