Note
Determining if App is Running in AWS AppRunner
May 27, 2023
This does not seem to be documented anywhere. If you need to tell, from within
your AWS AppRunner application, whether it’s running locally or in AWS you can
check the environment variable AWS_EXECUTION_ENV. The value for the
environment...
This does not seem to be documented anywhere. If you need to tell, from within
your AWS AppRunner application, whether it’s running locally or in AWS you can
check the environment variable AWS_EXECUTION_ENV. The value for the
environment variable will be set to AWS_ECS_FARGATE if it’s running on
AppRunner.
Here’s example:
aws_environment = os.environ.get('AWS_EXECUTION_ENV', None)
if aws_environment:
logger.info("Running on AWS: {}".format(aws_environment))
else:
logger.info("Running locally!")