How to create a free CockroachDB database on CockroachLabs
Welcome to the DevMaesters website! In this post, I will guide you through the process of creating a free CockroachDB database. CockroachDB is a relational, PostgreSQL wire-protocol-compatible database designed for cloud applications and services. It offers an awesome free plan with generous resource limits, including 250M request units and 5GB of database storage, making it suitable for projects on various platforms like Next.js and Django.
One of the fantastic features of CockroachDB's free plan is that you don't need to provide any credit card information, and your database remains active until you exceed its limits.
Let's dive into the step-by-step process of creating a free CockroachDB database:
Step 1: Sign Up for CockroachDB.
To get started, visit the CockroachDB website at https://cockroachlabs.cloud/signup and create a new account using your Github, email, or Google credentials.
Step 2: Access Clusters Page.
Upon successfully creating your account, you'll be redirected to the clusters page. Here, you can create a new AWS cluster for your project. A cluster is a regional grouping of one or more container instances where you can run task requests.
Step 3: Create a Cluster.
Create a cluster by clicking on the "Create Cluster" button and select the free plan from the list of available plans.
Step 4: Choose the Free Plan.
Once you've selected the free plan, click on "Create Your Free Cluster." The process should complete within approximately 10 seconds.
Step 5: Generate a SQL User.
Next, you'll be prompted to generate an SQL user. The default value will likely be your name or username. Click on "Generate & Save Password" to automatically create a database connection password for your user.
Step 6: Save the Password.
After the password is generated, click on "Reveal Password" to view it. Be sure to save this password in a safe place, such as a notepad, as you won't have access to it again.
Step 7: Obtain the Connection String In the same modal,
click on "Next," and then change the select option/language to "Python." Scroll down, and you will find the connection string for your newly created database. Copy it and save it in your notepad.
Step 8: Congratulations! That's it! You now have a fully functional CockroachDB database hosted on CockroachLabs. You can connect any of your projects to this database using the connection string you copied in Step 7.
Congratulations on setting up your free CockroachDB database!. In my next articles, I'll show you how to use this CockroachDB database for your Django and Next.js projects. If you encounter any issues or problems while following the instructions above, please leave a comment below, and I'll respond as soon as possible. Happy coding!