How to Set Up Magento with Bitnami AMI on AWS

Magento is one of the most powerful and widely used e-commerce platforms. If you want to deploy Magento quickly and efficiently, using a Bitnami Magento AMI (Amazon Machine Image) on AWS can be a great option. Bitnami offers pre-configured and optimized AMIs that allow you to set up Magento in just a few minutes without worrying about manually configuring LAMP stacks, PHP, or MySQL databases.

In this blog, we will guide you through the steps to set up Magento using a Bitnami AMI on AWS.

Prerequisites

  1. AWS Account: You must have an AWS account. If you don’t have one, sign up at aws.amazon.com.
  2. Magento Bitnami AMI: A pre-configured Bitnami Magento AMI, which can be found on the AWS Marketplace.
  3. AWS CLI or AWS Management Console: We’ll be using the AWS Management Console for this guide, but you can also use the AWS CLI if you prefer.

Step 1: Launch a Bitnami Magento AMI on AWS

  1. Login to AWS Console: Go to the AWS Management Console and log in.
  2. Search for Bitnami Magento AMI:
  3. Select an Instance Type: Choose the instance type. For a Magento installation, you may want to use at least a t3.medium instance to handle basic traffic. If you expect high traffic, consider more powerful instances like t3.large or t3.xlarge.
  4. Configure Instance Details: You can use the default settings for most options. Make sure to choose the correct VPC and subnet according to your requirements. Enable Auto-assign Public IP if you want the instance to be accessible from the internet.
  5. Add Storage: The default storage provided by the Bitnami AMI is usually sufficient. However, you can increase the storage size if your Magento store requires more space.
  6. Configure Security Group:
    • Ensure you open ports 22 (SSH), 80 (HTTP), and 443 (HTTPS).
    • If you want remote access to the Magento admin panel, you will need to allow port 443 for your IP.
  7. Launch Instance:
    • Review your instance details and click Launch.
    • You’ll be prompted to create or select a key pair. This key will be used to access your instance via SSH.

Step 2: Accessing Your Magento Instance

  1. Obtain Public IP:
    • Once the instance is launched, go to the EC2 Dashboard.
    • Select the instance you just created and note down the Public IP or Public DNS.
  2. SSH into Your Instance: Open a terminal (or PuTTY on Windows) and SSH into your instance using the key pair: ssh -i /path/to/your-key.pem bitnami@<your-public-ip>
  3. Check Services:
    • Once logged in, you can check that Apache, MySQL, and PHP are running by executing:bashCopy codesudo /opt/bitnami/ctlscript.sh status
    • If any services are not running, start them with:bashCopy codesudo /opt/bitnami/ctlscript.sh start

Step 3: Access Magento in Your Browser

Now that your instance is running, you can access Magento in your browser:

  1. Navigate to the Public IP: Open your browser and go to http://<your-public-ip>. This will take you to the default Magento storefront.
  2. Magento Admin Panel: The Magento admin panel is located at http://<your-public-ip>/admin.
  3. Get Admin Credentials: To retrieve the admin credentials, SSH into your instance and run the following command:bashCopy codesudo cat /opt/bitnami/credentials This will output the default username and password for the Magento admin panel.

Step 4: Configure Magento

  1. Change Admin Password: For security reasons, you should change the default admin password immediately. Log into the admin panel and update the password under System > All Users.
  2. Configure Domain and SSL: If you have a custom domain, configure it by pointing your domain’s DNS records to your instance’s public IP. After that, set up an SSL certificate using Let’s Encrypt or your preferred certificate authority. You can use the Bitnami tool to install Let’s Encrypt by running
    • sudo /opt/bitnami/bncert-tool
  3. Set the Base URLs to HTTPS via CLI
    • php bin/magento config:set web/unsecure/base_url https://yourdomain.com/
    • php bin/magento config:set web/secure/base_url https://yourdomain.com/
    • php bin/magento config:set web/secure/use_in_frontend 1
    • php bin/magento config:set web/secure/use_in_adminhtml 1
  4. Performance Tweaks:
    • Enable Varnish: Magento runs well with the Varnish cache. You can enable Varnish caching to boost performance.
    • Elasticsearch: Magento requires Elasticsearch for search functionality. The Bitnami Magento AMI comes pre-installed with it, but make sure it’s enabled.
  5. Security Best Practices:
    • Ensure that your security groups only allow necessary traffic (limit access to ports 22, 80, and 443).
    • Enable automatic backups for your instance, and regularly monitor server performance.

Step 5: Magento Customization and Extensions

Once Magento is up and running, you can begin customizing it:

  1. Install Extensions:
    • Head over to the Magento Marketplace to download and install extensions for payment gateways, shipping methods, and more.
    • Extensions can be installed directly from the admin panel under System > Web Setup Wizard.
  2. Custom Themes: If you want to change the look of your store, you can either install a pre-built theme or create a custom one.

Step 6: Monitoring and Maintenance

  1. Monitor Instance Health: Keep an eye on your instance’s performance metrics (CPU, memory, and disk usage) using AWS CloudWatch.
  2. Regular Backups: It’s a good practice to back up your Magento files and database regularly. You can use AWS’s native tools like AWS Backup or create manual snapshots of your EC2 instance.

Conclusion

Setting up Magento with Bitnami AMI on AWS is a fast and efficient way to launch your online store. The Bitnami stack simplifies the installation process, providing you with a fully configured and optimized environment. After launching, you can customize and optimize Magento to suit your needs.

With the right AWS instance, proper configuration, and security measures in place, you’ll be able to run a robust and scalable e-commerce platform with ease.

Good luck with your Magento store setup, and happy selling!

Atiqur Rahman

I am MD. Atiqur Rahman graduated from BUET and is an AWS-certified solutions architect. I have successfully achieved 6 certifications from AWS including Cloud Practitioner, Solutions Architect, SysOps Administrator, and Developer Associate. I have more than 8 years of working experience as a DevOps engineer designing complex SAAS applications.

Leave a Reply