I have a Lambda function that has an exposed API Gateway endpoint, and I can get the URL for that via the AWS console. However, I would like to get that URL via API call. Neithe
If you use CloudFormation you can get this with Python and Boto3:
import boto3
cloudformation = boto3.resource('cloudformation')
stack = cloudformation.Stack(name=stack_name)
api_url = next(
output['OutputValue'] for output in stack.outputs
if output['OutputKey'] == 'EndpointURL')
This is from a working example of a REST service using Chalice that I put on GitHub. Here's a link to the pertinent code, in context: aws-doc-sdk-examples.