Django CloudWatch Logs

Share post:

You can setup sending logs to cloudwatch and have easier access to them instead looking through files or built-in Appliku log viewer.

Currently it only works for servers deployed on AWS.

All EC2 Instances are created by Appliku with CloudWatch Logs Agent, so the only thing you need to setup is the Role for server in AWS Dashboard and change in Application setting.

In order to switch to sending logs to CloudWatch you should:

Create IAM Role

Go to AWS Dashboard, IAM console, select "Roles" and click "Create role", or click this link: https://console.aws.amazon.com/iam/home#/roles$new?step=type

Select EC2 from the common use cases and click "Next: Permissions":

IAM Console Create Role

On the Permissions page search for "CloudWatchAgentServerPolicy" and check the checkbox for this policy and click Next:

CloudWatchAgentServerPolicy

On the "Add Tags" page click "Next: Review".

AWS IAM Role

Attach IAM Role to EC2 Instance

To attach the role, go to EC2 dashboard and select your instance.

Click "Actions" -> "Security" -> "Modify IAM role".

EC2 Dashboard Actions Security Modify IAM role

Pick the IAM Role and click save

Modify IAM role for ec2 instance

Create CloudWatch Log Group

Go to CloudWatch Console , find Logs -> Log Groups.

CloudWatch Console Logs Log Groups

Click "Create log group" Cloudwatch create log group

Give your log group a name and click the "Create" button:

Create cloudwatch log group screen

Configure application to send logs to CloudWatch

Go to Appliku dashboard and open your application settings.

Find the block "AWS CloudWatch log settings" and click "Expand Settings"

Appliku dashboard AWS CloudWatch log settings

Type your log group name from the previous step and select the region where you created the log group, enable Sending logs to AWS CloudWatch and click the "Save Log Settings" button.

AWS CloudWatch logs settings in Appliku

Redeploy the application

Click "Deploy Now" and wait for the process to finish. After that you can see logs from all your containers in CloudWatch Log Groups Streams. Streams will be named after containers automatically.

Stop wasting time manually
deploying your apps!

Try our application deployment tool that allows you to set up servers automatically, deploy apps from git, manage Postgres backups and cron tasks.

  • Use a server from any cloud provider
  • Setup is done automatically
  • Deploy Django, Flask, FastAPI, Node apps
  • Unlimited number of databases
  • Custom domains and HTTPS
  • Focus on apps, we take care of deployments

As developers ourselves, we hated wasting time writing configuration files for web servers, CI pipelines and managing apps via SSH – so we built the system that we always wanted.

Appliku takes care of everything you need to deploy, run and manage your apps, while you can still do customized configuration if you choose to.

Try it with a free plan and see for yourself.

Start Free
Simple 5-minute setup – No credit card required
Share post:
Top