def get_ec2_client(region, account): deploy_arn = get_arn_from_google_group(settings.AWS_CONFIG['accounts'][account]['deploy_group']) sts_creds = assume_role(deploy_arn, 'sso_app') return boto3.client('ec2', aws_access_key_id=sts_creds['access_key'], aws_secret_access_key=sts_creds['secret_key'], aws_session_token=sts_creds['sessionToken'], region_name=region)
def get_cf_client(region, account): app_role_arn = get_app_arn_from_account(account) sts_creds = assume_role(app_role_arn, 'sso') return boto3.client('cloudformation', aws_access_key_id=sts_creds['access_key'], aws_secret_access_key=sts_creds['secret_key'], aws_session_token=sts_creds['sessionToken'], region_name=region)