Skip to content
Get Started for Free
To improve reliability, we’ve moved to a single, authenticated LocalStack for AWS image that requires an auth token. For more details on plans and pricing, see our pricing page.

AWS Python Boto3

Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK) for Python, which allows Python developers to write software that makes use of AWS services.

You can easily create a boto3 client that interacts with your LocalStack instance. The example below creates a boto3 client that lists all available Lambda functions:

import boto3
endpoint_url = "http://localhost.localstack.cloud:4566"
# alternatively, to use HTTPS endpoint on port 443:
# endpoint_url = "https://localhost.localstack.cloud"
def main():
client = boto3.client("lambda", endpoint_url=endpoint_url)
result = client.list_functions()
print(result)
if __name__ == "__main__":
main()
client = boto3.client("lambda")
...

Alternatively, if you prefer to (or need to) set the endpoints directly, you can use the environment variable AWS_ENDPOINT_URL, which is available when executing user code (e.g., Lambda functions) in LocalStack:

import os
client = boto3.client("lambda", endpoint_url=os.getenv("AWS_ENDPOINT_URL"))
...
Was this page helpful?