Showing posts with label AWS Tutorial. Show all posts
Showing posts with label AWS Tutorial. Show all posts

Saturday, 20 September 2025

Stop Paying for DynamoDB – Use the Free Tier Instead!

🚀 Build for Free!

Subscribe to Ram N Java for more AWS cost-saving tips, cloud tutorials, and expert developer guides!

CLICK HERE TO SUBSCRIBE NOW

How to Use AWS DynamoDB for FREE Forever

One of the biggest fears developers have when moving to the cloud is a surprise bill. But did you know that Amazon DynamoDB has a "Forever Free" tier? Unlike many AWS services that expire after 12 months, DynamoDB gives you a generous amount of resources every single month at zero cost. Here’s how you can take advantage of it.

1. What's Included in the Free Tier?

AWS provides 25 GB of storage for free every month. That is enough to store millions of small data records! Additionally, you get 25 provisioned Write Capacity Units (WCU) and 25 provisioned Read Capacity Units (RCU). For a small to medium application, this is more than enough to handle your traffic without ever seeing a charge.

2. Choose the Right Capacity Mode

To stay within the free tier, you should generally use Provisioned Capacity and set your RCU and WCU to 25 or less. While "On-Demand" mode is convenient, its free tier limits are calculated differently and might lead to small charges if you have high bursts of traffic. Stick to provisioned limits to ensure a $0 bill.

3. Optimize Your Data Usage

To make that 25 GB last as long as possible, be smart about what you store. Don't store large images or files directly in DynamoDB—use Amazon S3 for that and just store the link in your database. Keep your attribute names short and avoid duplicating data unnecessarily.

4. Set Up Billing Alerts

Even though the free tier is great, it’s always a professional best practice to set up AWS Budgets. You can create an alert that sends you an email if your usage ever exceeds $0.01. This gives you peace of mind while you focus on building your amazing application!

💡 Key Takeaway: The DynamoDB free tier is the perfect sandbox for developers. You can learn, build, and even launch a small startup without paying a single rupee for your database!

Saturday, 8 March 2025

AWS SNS Delivery Status Logging Explained: How to Monitor Message Delivery Failures

💡 Master AWS & Java Today!

Want more deep dives into Cloud architecture? Join our growing community!

SUBSCRIBE TO RAM N JAVA

Guide to AWS SNS Delivery Status Logging

Have you ever sent a notification via AWS SNS and wondered if it actually reached the recipient? Delivery Status Logging is the answer. It allows you to track message success and failure, ensuring your communication is reliable and transparent.

What is Delivery Status Logging?

AWS SNS integrates with Amazon CloudWatch to record detailed information about every message delivery attempt. This feature helps you identify why a message failed—whether it was an invalid email, a blocked SMS, or a service timeout.

Understanding Delivery Statuses

  • Success: The message reached the subscriber (Email, SMS, Lambda, etc.) successfully.
  • Failure: Delivery failed. Common reasons include invalid phone numbers or full email inboxes.
  • Throttled: The receiving service is overloaded, causing SNS to slow down delivery.
  • Temporary Failure: A glitch occurred, but SNS will automatically retry the delivery.

How to Enable Logging in AWS Console

Enabling this feature is straightforward and highly recommended for production environments:

  1. Log into the AWS SNS Console.
  2. Select your SNS Topic from the list.
  3. Navigate to the Delivery status logging tab.
  4. Choose your protocol (e.g., SMS or Email) and select/create a CloudWatch Log Group.
  5. Save the settings.

Real-World Use Cases

  • E-commerce: Confirming that order alerts reach customers.
  • Banking: Verifying the delivery of critical OTP (One-Time Password) messages.
  • IoT: Monitoring status updates sent to smart devices.

Conclusion

By utilizing CloudWatch Logs, Metrics, and Alarms, you can build a robust monitoring system for your messaging infrastructure. Don't leave your notifications to chance—start logging today!

AWS SNS Dead-Letter Queue (DLQ): How to Handle Failed Messages | AWS SNS Subscription DLQ Explained

🔥 Never Miss a Cloud Tutorial!

Level up your AWS and Java skills by joining our growing developer community.

SUBSCRIBE TO RAM N JAVA

Mastering AWS SNS Dead-Letter Queues (DLQ)

In a distributed system, messages can fail for many reasons: network glitches, misconfigured endpoints, or temporary service outages. To ensure you never lose critical data, AWS provides a powerful tool called the Dead-Letter Queue (DLQ). Let's dive into how it works!

What is a Subscription DLQ?

A Subscription DLQ is a specialized Amazon SQS queue that acts as a "safety net." If an SNS message cannot be delivered to a subscriber after several retry attempts, SNS moves that message into the DLQ instead of simply discarding it.

Why Should You Use a DLQ?

  • Prevents Message Loss: Ensures failed notifications are stored for later review.
  • Simplified Debugging: Inspect failed messages to find out exactly why delivery failed.
  • Message Recovery: Once the root cause (like a Lambda error) is fixed, you can re-process the messages.
  • Improved Reliability: Handles temporary issues gracefully without losing customer data.

How the Workflow Works

  1. A Publisher sends a message to an SNS Topic.
  2. The SNS Topic attempts to forward the message to its subscribers (e.g., Lambda, Email, SQS).
  3. If delivery fails, SNS follows a Retry Policy.
  4. If all retries are exhausted, the message is safely deposited into the Dead-Letter Queue.

Step-by-Step Setup

Setting up a DLQ is a simple four-step process:

  • Create an SQS Queue: This will serve as your destination for failed messages.
  • Link to SNS: In your SNS subscription settings, enable the DLQ and provide the SQS ARN.
  • Define Retry Policy: Set how many times SNS should try before giving up.
  • Monitor CloudWatch: Set alarms to notify you when the DLQ contains messages.

Conclusion

Using a Dead-Letter Queue is a best practice for building resilient cloud applications. It transforms "lost data" into "actionable insights," allowing you to maintain high system reliability.

AWS SNS Subscription Filter Policy: How to Reduce Unwanted Messages | AWS SNS Subscription Filtering

🚀 Master Cloud Computing with Us!

Join the Ram N Java community for the best Java and AWS tutorials.

SUBSCRIBE TO RAM N JAVA NOW

How to Use AWS SNS Subscription Filter Policies

AWS Simple Notification Service (SNS) is powerful because it can broadcast messages to many subscribers at once. But what if your subscribers only want specific messages? That's where Subscription Filter Policies come in. In this guide, I'll show you how to eliminate noise and save costs by filtering your messages.

What is a Subscription Filter Policy?

By default, every subscriber to an SNS topic receives every message published to that topic. A filter policy allows a subscriber to define exactly which messages they want to receive based on Message Attributes. If the attributes don't match the policy, SNS simply doesn't deliver the message to that specific subscriber.

A Real-World Example: Weather Alerts

Imagine a weather alert topic with three subscribers:

  • Alice: Only wants "Rain" alerts.
  • Bob: Only wants "Snow" alerts.
  • Charlie: Wants all alerts (no filter policy).

When the publisher sends a message with the attribute weather: rain, SNS checks the policies. Alice gets the message, Bob is skipped, and Charlie gets it because he has no restrictions. This ensures users aren't spammed with irrelevant data.

Top 4 Benefits of Filtering

  1. Reduces Noise: Subscribers only process the data they actually need.
  2. Saves Money: You don't pay for unnecessary message deliveries or downstream processing (like Lambda execution costs).
  3. Increases Efficiency: Your applications run faster by ignoring irrelevant data.
  4. Simplifies Code: No need to write complex filtering logic inside your application; AWS handles it for you at the infrastructure level.

How to Set It Up

Setting up a filter policy is easy via the AWS Management Console:

  • Go to SNS -> Subscriptions.
  • Select the subscription you want to edit.
  • Find the Subscription filter policy section.
  • Enter your policy in JSON format (e.g., {"weather": ["rain"]}).
  • Save changes!

Conclusion

Subscription Filter Policies are an essential tool for building clean, cost-effective, and scalable event-driven architectures. Start using them today to make your AWS SNS implementation more professional and efficient!

Sunday, 2 March 2025

AWS SNS Delivery Retries: What Happens When Messages Fail? ❌ | AWS SNS Delivery Retry Explained

🚀 Never Miss a Cloud Insight!

Join the Ram N Java community and master AWS with ease. Subscribe for weekly tutorials!

SUBSCRIBE TO RAM N JAVA NOW

AWS SNS Delivery Retries: Handling Failed Messages

What happens when AWS SNS tries to send a message but the receiver is down? Instead of giving up immediately, AWS uses Delivery Retry Policies. In this guide, we'll break down how SNS ensures your messages get delivered even when things go wrong.

Why are Retries Important?

In the world of cloud computing, temporary glitches (like a network timeout or a busy server) are common. Without a retry policy, a single small error could mean your customer never receives their OTP or critical alert. Retries provide a "second chance" for your data.

The Four Phases of a Retry Policy

AWS SNS follows a structured approach to retrying failed deliveries:

  • Immediate Retries: SNS tries to resend the message instantly.
  • Pre-backoff Phase: Retries continue with a small, consistent delay.
  • Backoff Phase: The delay between retries starts to increase (exponentially).
  • Post-backoff Phase: Retries happen at a fixed, longer interval until the maximum limit is reached.

Customizing Your Policy

While AWS has default policies for different protocols (like Lambda, SQS, or Email), you can customize these settings to fit your needs:

  1. Maximum Receives: Total number of times SNS will attempt delivery.
  2. Minimum Delay: The shortest time to wait before the next try.
  3. Maximum Delay: The longest time to wait before the next try.

What Happens After All Retries Fail?

If SNS exhausts all retry attempts and the message still hasn't been delivered, it can be sent to a Dead-Letter Queue (DLQ). This ensures the message isn't lost forever and can be analyzed later. Check out our previous guide on DLQs to learn more!

Conclusion

Understanding delivery retries is key to building reliable, "fault-tolerant" systems. By mastering these policies, you ensure that your application remains robust even when external services face issues.

AWS SNS Explained with Real-World Examples 🌍 | AWS SNS Basics: Everything You Need to Know! 📚

🚀 Level Up Your Cloud Skills!

Join the Ram N Java community for the best Java and AWS tutorials. Don't miss out!

SUBSCRIBE TO RAM N JAVA NOW

AWS SNS Basics: Everything You Need to Know!

In the world of cloud computing, communication is key. AWS Simple Notification Service (SNS) is a highly available, durable, secure, fully managed pub/sub messaging service that enables you to decouple microservices, distributed systems, and serverless applications.

What is AWS SNS?

At its core, SNS follows the Publisher-Subscriber (Pub/Sub) pattern. A "Publisher" sends a message to a "Topic," and AWS SNS automatically fans out that message to all "Subscribers" linked to that topic. This happens almost instantaneously!

Real-World Examples

  • E-commerce Notifications: When you place an order, a single event can trigger an email confirmation, an SMS alert, and update the inventory database simultaneously.
  • System Monitoring: If a server goes down, SNS can immediately alert the DevOps team via PagerDuty, Slack, or Email.
  • Mobile Push Alerts: News apps use SNS to send breaking news notifications to millions of mobile devices at once.

Key Benefits of AWS SNS

  1. Fully Managed: No need to worry about server maintenance or scaling.
  2. High Reliability: Messages are stored across multiple availability zones to prevent loss.
  3. Flexible Delivery: Supports SMS, Email, HTTP/S, SQS, Lambda, and Mobile Push.
  4. Cost-Effective: Pay only for what you use with no minimum fees.

Conclusion

AWS SNS is an essential tool for building modern, scalable architectures. Whether you're sending a simple email or managing complex microservices, SNS provides the reliability and speed your application needs.

Saturday, 1 March 2025

AWS SNS Hands-On Tutorial: Create & Configure SNS Topics! 🎯 | AWS SNS Explained for Beginners! 🔍

🚀 Master AWS with Ram N Java!

Want to become a Cloud expert? Subscribe for weekly high-quality Java and AWS tutorials!

SUBSCRIBE TO RAM N JAVA NOW

Master AWS SNS: Complete Setup & Configuration Guide

Setting up AWS Simple Notification Service (SNS) is the first step toward building a highly scalable, event-driven architecture. In this guide, I will walk you through the essential configurations and setup steps required to get your messaging system up and running.

Step 1: Accessing the SNS Dashboard

To begin, log in to your AWS Management Console and search for "SNS." Once inside the dashboard, you’ll see options to create topics, manage subscriptions, and configure mobile text messaging. This is the command center for all your notifications.

Step 2: Creating Your First Topic

A "Topic" is the fundamental building block of SNS. It acts as a communication channel. When creating a topic, you have two choices:

  • Standard: Best for high throughput with best-effort ordering.
  • FIFO (First-In-First-Out): Ensures messages are delivered exactly once and in the strict order they were sent.

Step 3: Configuring Access Policies

Security is critical. The Access Policy defines who can publish messages to your topic and who can subscribe to it. By default, only the topic owner has permissions. You can customize this using JSON policies to allow specific IAM users or other AWS services (like S3 or CloudWatch) to interact with the topic.

Step 4: Setting Up Subscriptions

Once your topic is created, you need to add "Subscribers." These are the endpoints that will receive your messages. Common protocols include:

  • Email/Email-JSON: For sending alerts directly to inboxes.
  • SMS: For mobile text notifications.
  • AWS Lambda: To trigger serverless functions.
  • Amazon SQS: To queue messages for further processing.

Step 5: Testing Your Configuration

Always use the "Publish Message" button in the console to send a test message. This confirms that your topic, policies, and subscriptions are all working correctly before you start writing your Java code.

Conclusion

By mastering these configuration steps, you've laid a solid foundation for your cloud-native applications. AWS SNS simplifies the complex task of notification management, allowing you to focus on building great features.

Saturday, 30 November 2024

How to Enable Public Access for S3 Bucket Files | AWS S3: Make Your Bucket Objects Public

🚀 Level Up Your AWS Skills!

Join Ram N Java for easy-to-follow cloud and coding tutorials.

Subscribe Now

How to Make Your AWS S3 Bucket Public

By default, Amazon S3 buckets are private to keep your data secure. However, there are times when you need to host a public image, a website, or a downloadable file. In this guide, we'll break down the process into simple steps.

Step 1: Create Your S3 Bucket

Log into your AWS Console, search for S3, and click Create Bucket. Give your bucket a unique name and leave the default settings for now. Once created, you can upload your files or folders directly into the bucket.

Step 2: Unblock Public Access

Even if you want a file to be public, AWS "blocks" it by default at the bucket level for safety. To change this:

  • Go to the Permissions tab of your bucket.
  • Find Block public access (bucket settings) and click Edit.
  • Uncheck the box that says "Block all public access" and click Save changes.

Step 3: Add a Bucket Policy

To let the world see your files, you need to grant permission via a "Policy." You can use a simple JSON policy that allows s3:GetObject access to everyone. This ensures that any file inside the bucket can be viewed via its public URL.

Alternative: Making a Single File Public (ACLs)

Don't want the whole bucket public? You can enable Access Control Lists (ACLs) in the permissions tab. Once enabled, you can select a specific file, click Actions, and choose Make public using ACL. This is great for sharing just one specific document or image.

⚠️ Security & Cost Tips

Data Sensitivity: Only make files public if they don't contain private information.

Bandwidth Costs: If millions of people download your public files, you will be charged for the data transfer. Monitor your usage regularly!

Conclusion

Making an S3 bucket public is a powerful way to share content globally. Whether you use a Bucket Policy or ACLs, always remember to audit your permissions regularly to keep your cloud environment secure!

Wednesday, 20 November 2024

How to Use Amazon S3: A Beginner's Guide | Mastering Amazon S3: From Zero to Hero

🚀 Become an AWS Expert!

Subscribe to Ram N Java for the ultimate cloud and programming tutorials!

YES, I WANT TO SUBSCRIBE

How to Use Amazon S3: A Beginner's Guide

Welcome to the world of cloud storage! Amazon Simple Storage Service (S3) is a powerful, scalable object storage service from AWS. Whether you're storing documents, images, or massive data sets, S3 is built to retrieve any amount of data from anywhere on the web.

Core Concepts of S3

To master S3, you first need to understand its three building blocks:

  • Buckets: These are the containers for your data. Think of them as top-level folders. Every bucket must have a unique name across all of AWS!
  • Objects: These are the files you store. An object consists of the file itself (data) and metadata (information about the file like its type or size).
  • Keys: This is the unique identifier or "name" of your object within a bucket. It works just like a file path.

Why Choose Amazon S3?

Amazon S3 is the industry leader for several reasons:

  • Durability: Designed for 99.999999999% (11 nines) of durability to ensure your data is never lost.
  • Scalability: It grows with you. You can store 1 GB or 100 PB without ever worrying about server space.
  • Security: Includes robust access controls, encryption, and bucket policies to keep your data private.

Common Use Cases

From startups to giant enterprises, S3 is used for:

  • Backup & Restore: A reliable choice for off-site backups.
  • Static Website Hosting: Host your HTML/CSS/JS sites directly from a bucket!
  • Big Data Analytics: Store massive datasets to be analyzed by tools like Amazon Athena.
  • Content Distribution: Use it with CloudFront to deliver videos and images globally.

📥 Download Your Free Resources!

Want the PowerPoint presentation or the Java source code used in this tutorial? Head over to the video description on YouTube to find the direct download links and accelerate your learning!

Monday, 18 November 2024

Amazon S3 Made Easy: Beginner's Walkthrough | Amazon S3 Crash Course for Beginners

🚀 Become a Cloud Expert!

Join the Ram N Java family for simplified AWS & Java tutorials!

CLICK TO SUBSCRIBE NOW

Amazon S3 Crash Course: Storage Made Simple

If you are looking for a reliable way to store data in the cloud, Amazon S3 (Simple Storage Service) is the industry standard. It’s designed to store and retrieve any amount of data from anywhere on the web.

Key Features of Amazon S3

  • Scalability: Whether you have 1MB or 1PB of data, S3 grows with you.
  • Durability: Designed for "11 nines" (99.999999999%) of durability to keep your data safe.
  • Security: Features like encryption at rest and fine-grained access controls.
  • Cost-Effective: You only pay for what you use with no upfront commitments.

Core Building Blocks: Buckets & Objects

To use S3, you only need to understand two main things:

1. Buckets: These are the containers for your data. Think of them as top-level folders. Remember, bucket names must be globally unique across all of AWS!

2. Objects: These are the files you store inside buckets. Every object has its data, metadata, and a unique Key (identifier).

Common Use Cases

  • Backup & Restore: Reliable off-site storage for your important files.
  • Data Archiving: Use S3 Glacier for long-term, low-cost storage.
  • Static Website Hosting: Host HTML, CSS, and JS files directly.
  • Big Data Analytics: Use it as a "Data Lake" for massive analysis.

📥 Get the Resources!

I've made the PowerPoint presentation and Java source code used in this demo available for you. Check the links in the video description on YouTube to download them!

Tuesday, 3 September 2024

How to Set Up and Use Amazon AWS CLI on Windows/Mac/Linux | AWS CLI Installation and Basic Usage

Ready to Level Up Your Cloud Skills? ☁️

Don't miss out on more AWS and Java tutorials. Join our growing community today!

👉 SUBSCRIBE TO RAM N JAVA

Introduction

The AWS Command Line Interface (CLI) is a unified tool that allows you to manage your AWS services from the terminal. Instead of clicking through the AWS Management Console, you can run powerful commands to automate your workflows and manage resources like S3, EC2, and SQS efficiently.

Step 1: Installing AWS CLI

Depending on your operating system, follow the steps below:

Windows

  • Download the AWS CLI MSI Installer from the official AWS website.
  • Run the installer and follow the "Next" prompts until finished.

macOS

brew install awscli

Linux

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Step 2: Configuring Your Credentials

Once installed, you need to link the CLI to your AWS account. First, create an IAM User in the AWS Console to get your Access Key and Secret Key. Then, run:

aws configure

Provide the following when prompted:

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default region name (e.g., us-east-1)
  • Default output format (e.g., json)

Step 3: Essential AWS Commands

Amazon S3 (Storage)

List all your buckets:

aws s3 ls

Create a new bucket:

aws s3 mb s3://my-unique-bucket-name

Amazon EC2 (Servers)

List your running instances:

aws ec2 describe-instances

Amazon SQS (Queues)

Create a simple message queue:

aws sqs create-queue --queue-name MyQueue

Conclusion

Mastering the AWS CLI is a game-changer for cloud engineers. It allows for faster management, easy scripting, and powerful automation. Start practicing these commands today to streamline your cloud operations!

Wednesday, 7 August 2024

Amazon SQS DLQ Explained: How to Use Dead-Letter Queues | Amazon SQS Tutorial

🚀 Master Cloud Development with Ram N Java!

Subscribe for deep dives into AWS, Spring Boot, and Microservices.

SUBSCRIBE ON YOUTUBE

What is a Dead-letter Queue (DLQ)?

In a distributed system, not every message is processed successfully on the first try. Sometimes, a consumer crashes or the data is malformed. A Dead-letter Queue (DLQ) is a separate SQS queue where "failed" messages are moved automatically, allowing you to debug issues without losing data.

The Lifecycle of a Failed Message

When a message is sent to a primary queue, it enters a cycle of processing. If it isn't deleted by a consumer within the Visibility Timeout, it becomes visible again for another attempt. This happens multiple times until it hits the Maximum Receives threshold.

Configuring the DLQ

To set up a DLQ, you essentially need two queues. The configuration is done on the Primary Queue settings:

  • Dead-letter queue: Choose the target queue for failed messages.
  • Maximum receives: Set the number of times a message can be polled before being moved to the DLQ (typically between 1 and 1000).

Why Should You Use a DLQ?

  • Isolate Errors: Don't let "poison pill" messages block your main processing logic.
  • Data Durability: Failed messages aren't deleted; they are parked safely for manual inspection.
  • Simplified Debugging: Easily identify trends in failing messages by inspecting the DLQ separately.

Conclusion

Dead-letter queues are an essential safety net for any production-grade messaging architecture. By isolating failures, you ensure your system remains resilient and your data remains safe. Watch the full walkthrough above to see how to configure a DLQ in the AWS Console!

Sunday, 17 September 2023

AWS Free Tier Expiring? Here's What to Do Next | Your AWS Free Tier Ending Soon? Follow These Steps

🚀 Level Up Your Cloud Skills!

Subscribe to Ram N Java for more AWS tips and Java tutorials!

SUBSCRIBE NOW

Introduction

If you've received an email saying your AWS Free Tier is expiring, don't panic! However, you must take action immediately. Many users assume that closing an account or ignoring it will stop the charges, but active resources will continue to bill you. In this guide, we'll show you how to clean up your account safely.

Step 1: Check Your Billing Dashboard

First, you need to see what is currently costing you money. Navigate to the AWS Billing Dashboard to view your current usage and projected costs.

  • Log in to your AWS Console.
  • Search for "Billing" and click on Billing and Cost Management.
  • Review the "Top Free Tier Services by Usage" section to identify active resources.

Step 2: Identify Active Resources

AWS provides a summary of running services. Even if you think you aren't using anything, services like Elastic IPs, EBS Volumes, or NAT Gateways can often hidden costs.

Step 3: Terminating EC2 Instances

One of the most common sources of charges is the EC2 instance. To stop charges, you must Terminate the instance, not just stop it.

Handling Termination Protection

Sometimes, AWS won't let you terminate an instance because "Termination Protection" is enabled. Follow these steps to fix it:

  1. Select your running instance.
  2. Go to Actions > Instance Settings > Change Termination Protection.
  3. Uncheck the "Enable" box and click Save.
  4. Now, select the instance again, go to Instance State, and click Terminate Instance.

Important Checklist

  • Delete S3 Buckets: Empty and delete buckets you no longer need.
  • Release Elastic IPs: Unattached Elastic IPs incur hourly charges!
  • Snapshots: Delete any old EBS snapshots.
  • RDS Databases: Ensure any test databases are deleted.

Conclusion

Managing your AWS costs is a vital skill for any cloud professional. By manually terminating your resources and disabling protection when necessary, you can explore AWS without the fear of unexpected bills. Stay proactive and keep your dashboard clean!

Friday, 6 May 2022

Amazon WebService | AWS Tutorial

How To Install MariaDB on Amazon EC2 Linux Server? | MariaDB Installation Linux | AWS EC2 Tutorial

🔥 Want to Master AWS & Java?

Subscribe to Ram N Java for more easy-to-follow technical tutorials!

SUBSCRIBE ON YOUTUBE

Introduction

MariaDB is one of the most popular open-source relational databases. In this guide, we will walk through the entire process of installing MariaDB on an Amazon EC2 Linux instance and show you how to set up a secure root password.

Step 1: Install MariaDB

First, connect to your EC2 instance via SSH. To check for available MariaDB packages and install the server, run these commands:

# Check available packages
sudo yum list mariadb*

# Install MariaDB Server
sudo yum install mariadb-server

Step 2: Start and Enable the Service

After installation, you need to start the MariaDB service and enable it so that it starts automatically when the server boots up.

# Start MariaDB
sudo systemctl start mariadb

# Enable MariaDB to start on boot
sudo systemctl enable mariadb

Step 3: Setting the Root Password

By default, MariaDB installs without a root password. To set a new password, follow these specialized steps:

  1. Stop the service: sudo systemctl stop mariadb
  2. Start in safe mode: sudo mysqld_safe --skip-grant-tables &
  3. Log in without a password: mysql -u root
  4. Update the password:
    UPDATE mysql.user SET password=PASSWORD('your_new_password') WHERE User='root';
    FLUSH PRIVILEGES;
    exit;

Step 4: Verify the Installation

Restart the service normally and log in using your new password:

# Log in with password
mysql -u root -p

# Once logged in, show databases
SHOW DATABASES;

Conclusion

You have successfully installed MariaDB on your AWS EC2 instance! You now have a robust database ready to power your applications. Stay tuned for more tutorials on how to connect your Java applications to this database.

Tutorials