- Newest
- Most votes
- Most comments
Hello.
I was able to confirm that the application works properly by following the AppRunner tutorial and linking with the GitHub repository.
https://docs.aws.amazon.com/apprunner/latest/dg/getting-started.html
I also tried deploying from ECR using the Dockerfile in the GitHub repository you created, and confirmed that it could be deployed successfully.
https://github.com/Sathyvs/apprunner/tree/main
By the way, your Dockerfile installs python3.7, but in the case of Amazon Linux 2023, an error occurs because python3.7 is not included in the default repository.
So I modified it to install python3.11.
FROM public.ecr.aws/amazonlinux/amazonlinux:latest
RUN yum install python3.11 -y && curl -O https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && yum update -y
COPY . /app
WORKDIR /app
RUN pip3 install -r requirements.txt
CMD python3 server.py
EXPOSE 8080
By the way, where did you execute the "docker build" command?
Please note that using a container image created on M1 Mac as is will result in an error.
https://stackoverflow.com/questions/77822116/exec-sbin-tini-exec-format-error-running-meilisearch-on-aws-app-runner
Also, if you run your "server.py" as is, the following error occurred, so I modified the code.
SyntaxError: f-string: unmatched '('
An f-string error occurred, so I fixed it as follows.
Also, since we did not import "sys", we added an import.
from wsgiref.simple_server import make_server from pyramid.config import Configurator from pyramid.response import Response import os, logging, sys # edit logging.basicConfig(level=logging.INFO, stream=sys.stdout) logger = logging.getLogger(__name__) def hello_world(request): name = os.environ.get('NAME') if name == None or len(name) == 0: name = "world" message = "Hello, " + name + "!\n" logger.info("api called") return Response(message) if __name__ == '__main__': port = int(os.environ.get("PORT")) logger.info(f"running main application and listening on port {os.environ.get('PORT')}") # edit logger.info(f"value of my port {os.environ.get('MY_PORT')}") # edit with Configurator() as config: logger.info("configuring apis") config.add_route('hello', '/') config.add_view(hello_world, route_name='hello') app = config.make_wsgi_app() server = make_server('0.0.0.0', 8080, app) logger.info("starting server") server.serve_forever()
Once the application has been successfully deployed, access the AppRunner URL directly and the screen will be displayed.
https://yyyyyyy.ap-northeast-1.awsapprunner.com/
Basically the problem was something with the account. As all the attempts failed, I reached out to AWS customer support and they said they did something called account refresh and I can try afterwards, which actually did help and I was able to deploy the sample applications without any issue. Here is the explanation from aws customer support when I asked what account refresh meant
I would like to inform you that Based on your account usage, the quotas related to Apprunner service were restricted for your AWS Account due to which Apprunner instances were not getting launched in Apprunner service due to which the application wasn't getting started (consequently not generating application logs), as a result, the healthchecks were getting failed. Also, your account activity is constantly monitored within each Region, and these quotas are automatically increased based on your usage.
Thank you Riku_Kobayashi for your time and help in confirming and leading me towards the solution.
Sorry, I can't post a comment due to an error, so I'm going to separate the thread.
Thats the other thing I have been telling about, I dont see any application logs at all.. I can also try in a different region to see if there is anything wrong with us-east-1
https://jumpshare.com/s/Sk6wo3USjbY20rTn2dpX. ---> this is what I see, the application logs section is just empty
Umm...Please try deploying in the Tokyo region just to be sure.
Please try both GitHub integration and deployment from ECR.
By the way, when trying to deploy from ECR, please use CloudShell to build the container image.
https://docs.aws.amazon.com/cloudshell/latest/userguide/welcome.html
Okay, I will try the cloud shell for ECR, and give it a try
AWS App Runner does indeed support Python applications, but it seems you're encountering some issues with your health check configuration. Let's address your concerns and provide some troubleshooting steps:
-
Python Support: App Runner fully supports Python applications. It offers managed runtimes for building and running web applications based on Python.
-
Application Logs: To view your application logs in App Runner, you can check the Logs tab on your service page in the AWS console. If you're not seeing the startup logs, it might indicate that your application isn't starting correctly.
-
Health Check Issues: The health check is failing, which suggests that App Runner can't reach your application on the specified port and path. Here are some things to check:
- Ensure your application is listening on 0.0.0.0 (all interfaces) and not just localhost.
- Verify that the port your application is listening on matches the port specified in your App Runner configuration.
- Make sure your application is actually starting and not crashing on startup.
-
Troubleshooting Steps:
- Double-check your App Runner configuration, especially the port and health check settings.
- Review your Dockerfile to ensure it's correctly set up for App Runner.
- Try using the TCP protocol for health checks instead of HTTP initially, as it's less likely to fail due to application-specific issues.
- Examine the full application logs for any error messages or unexpected behavior.
-
Configuration File: Consider using an App Runner configuration file (apprunner.yaml) to specify your build and run commands. For a Python application, it might look like this:
version: 1.0 runtime: python3 build: commands: build: - pip install -r requirements.txt run: command: python server.py -
Port Configuration: Ensure that the port your application is listening on (in your code) matches the port specified in your App Runner configuration. App Runner typically expects your application to listen on port 8080 by default.
-
Health Check Configuration: You can customize the health check settings in App Runner. Try adjusting the path, interval, or timeout settings to see if it resolves the issue.
If you've tried these steps and are still encountering issues, you may need to review your application code to ensure it's compatible with the App Runner environment. Also, consider starting with a very simple Python application that just returns a basic HTTP response to isolate whether the problem is with your application or the App Runner configuration.
Sources
Troubleshooting - AWS App Runner
Configuring health checks for your service - AWS App Runner
HealthCheckConfiguration - AWS App Runner
AWS App Runner Features – Fully managed container application service – Amazon Web Services
Using the Python platform - AWS App Runner
All these are generic steps right ? I have tried them all. I created a separate new repo to just try this apprunner with a hello world and here is the code... does any of these look incorrect ? https://github.com/Sathyvs/apprunner/blob/main/server.py Also if you can see the server.py , it has the log lines I shared above from my local docker run. Now in app runner, I dont see them in application logs tab, event or deployment log groups, no where. And by that if I conclude the application has not started properly, what does the app runner log mean when it says application is deploy and its trying to perform health check ?
The only thing I have not tried with this sample hello world application is using apprunner yaml and I will try that as well. (but the apprunner didnt do any good for the actual application I was trying to deploy.
A couple of more questions, when I say public end point access and expose this application on port 8080, i should be able to see the page when I hit the apprunner url right ? I dont see the application running there too, so something is wrong, not sure if its the port forwarding or any vps settings that is not allowing my requests and the health check requests to go through or the application is failing to start
Relevant content
- asked 6 months ago
- asked 4 months ago

Thank you for checking this out. I have been messing around that dockerfile and tried different dockerfiles from different blogs... this is the one I used from ECR https://github.com/Sathyvs/apprunner/blob/main/Dockerfile
I tried this get started guide as well, but I couldn't get that running as well... https://docs.aws.amazon.com/apprunner/latest/dg/getting-started.html
I am on an older mac, which still has intel processor, not M1... however can you help me with these questions ?
Sorry for the questions, I have tried more than 20-30 deployments with different setups, and trying to follow the exact same steps you followed so I can get this working. Thank you in advance.
If you are just using AppRunner, you do not need to set up IAM Identity Center.
I was able to check the log from the AppRunner screen.
No, I did not change any network settings or port numbers from the defaults. Only environment variables are added.
Yes, I was able to deploy it without any problems. I have confirmed that it can be deployed using ECR and Github integration. By the way, I've submitted a pull request to your Github repository, so please check it out. https://github.com/Sathyvs/apprunner/pull/1
Thank you, I will try again with the github source with the pull request you added, thank you... however I am not sure of the application logs that you see there.. I couldnt get to see that
Hi Riku, I tried again from the source code repo... with the PR merged... and used the configure all settings on the console... I am unable to update any screen shot in the comment box,
used the below: Runtime: Python 3 Build Command: pip install -r requirements.txt start command: python server.py port: 8080
but still failing health check
01-01-2025 08:53:20 PM [AppRunner] Performing health check on protocol `TCP` [Port: '8080']. 01-01-2025 08:59:33 PM [AppRunner] Health check failed on protocol `TCP` [Port: '8080']. Check your configured port number. For more information, see the application logs. 01-01-2025 08:59:46 PM [AppRunner] Deployment with ID : 4db6391893e24a7da9f98c72437d262f failed. Failure reason : Health check failed.Is it possible for you to share all the settings screens as screenshots? By the way, my settings when testing were as follows.



Also, if you check "Create service" in Deployment logs, you can check the build logs, etc., so please check to see if any errors have occurred.
