Applications AWS

Sylius on AWS User Guide

| Product: Sylius on AWS

Overview

This image runs Sylius, the open source, API first e-commerce platform built on the Symfony framework and chosen by developers and agencies who want full control over their store rather than a rigid hosted template. Sylius is delivered as a production LEMP application so the storefront, the admin panel and the REST API are running within minutes of launch.

Sylius runs as a PHP 8.3 application under php-fpm, served by nginx on port 80. A MySQL 8 database stores every product, taxon, order, customer and admin user, and Sylius' media and uploads are stored alongside it. The MySQL data directory and the media live at /var/lib/sylius, which is a dedicated, independently resizable EBS data volume that survives instance replacement. Systemd manages MySQL, the PHP FastCGI workers and nginx, starting them on boot and restarting them on failure.

Sylius secures its admin panel with its own administrator login. On the first boot of every deployed instance a one shot service generates a fresh MySQL password, a fresh Symfony application secret and a fresh administrator password, all unique to that instance, recreates a clean database schema and creates the store administrator account, so two instances launched from the same Amazon Machine Image never share credentials. The application secret signs sessions and CSRF tokens, so rotating it per instance keeps every deployment cryptographically independent. The administrator password is written to /root/sylius-credentials.txt with mode 0600 so that only the root user can read it. The Sylius demo credential (sylius / sylius) that ships with the platform fixtures is scrambled during the image build and can never sign in to a deployed instance.

Prerequisites

Before you deploy this image you need:

  • An Amazon Web Services account where you can launch EC2 instances
  • IAM permissions to launch instances, create security groups, and subscribe to AWS Marketplace products
  • An EC2 key pair in the target Region for SSH access to the instance
  • A VPC and subnet in the target Region, with a security group allowing inbound port 22 from your management network and port 80 for the store
  • The AWS CLI (version 2) installed locally if you plan to deploy from the command line

Step 1: Launch the Instance from the AWS Marketplace

Sign in to the AWS Management Console, open the EC2 service, and select Launch instance. Under Application and OS Images choose AWS Marketplace AMIs and search for Sylius. Select the cloudimg listing and choose Select, then Continue on the subscription summary.

Pick an instance type of m5.large or larger. Choose your EC2 key pair under Key pair (login). Under Network settings select your VPC and subnet, and either create or select a security group that opens port 22 from your management network and port 80 for the store. Leave the root volume at the default size or larger.

Select Launch instance. First boot initialisation takes a short time after the instance state becomes Running and the status checks pass, while the per instance database password, application secret and administrator password are generated and a clean store schema is created.

Step 2: Launch the Instance from the AWS CLI

The following block launches an instance from the cloudimg Sylius Marketplace AMI into an existing subnet and security group. Replace <ami-id> with the AMI ID shown on the Marketplace listing, <key-name> with your EC2 key pair name, <subnet-id> with your subnet ID, and <security-group-id> with a security group that opens ports 22 and 80 as described above.

aws ec2 run-instances \
  --image-id <ami-id> \
  --instance-type m5.large \
  --key-name <key-name> \
  --subnet-id <subnet-id> \
  --security-group-ids <security-group-id> \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=sylius}]'

When the instance reaches the Running state and its status checks pass, note its public IP address or DNS name from the EC2 console or with aws ec2 describe-instances.

Step 3: Connect to Your Instance

Connect over SSH using your key pair and the login user for your operating system variant.

OS variant SSH login user
Ubuntu 24.04 ubuntu
ssh -i /path/to/your-key.pem ubuntu@<public-ip>

Step 4: Retrieve the Administrator Password

The store administrator password is generated on first boot and written to a root only file. Read it with sudo:

sudo cat /root/sylius-credentials.txt

You will see the store URL, the admin URL, the login and the generated password:

# Sylius 2.2.6 — generated on first boot by sylius-firstboot.service.
# These credentials are unique to this instance. Store them somewhere safe.

SYLIUS_URL=http://<instance-public-ip>/
SYLIUS_ADMIN_URL=http://<instance-public-ip>/admin
SYLIUS_ADMIN_LOGIN=sylius
SYLIUS_ADMIN_EMAIL=admin@cloudimg.local
SYLIUS_ADMIN_PASSWORD=<generated-password>

Step 5: Confirm Sylius Is Running

Confirm the three services are active and that the store answers on port 80. The storefront home redirects to the localised path (for example /en_US/) and returns 200, and the admin login page returns 200.

systemctl is-active mysql php8.3-fpm nginx
curl -s -o /dev/null -w 'storefront: %{http_code}\n' -L http://127.0.0.1/
curl -s -o /dev/null -w 'admin login: %{http_code}\n' http://127.0.0.1/admin/login
active
active
active
storefront: 200
admin login: 200

Step 6: Sign In to the Admin Panel

Browse to http://<instance-public-ip>/admin and sign in with the username sylius and the password from Step 4.

The Sylius administration panel login page

The dashboard shows your channels, sales and paid orders. The image ships with the Sylius demo catalogue (the Fashion Web Store) so every screen has data to explore; you replace it with your own catalogue.

The Sylius administration dashboard showing per channel sales and paid orders

Step 7: Manage Your Catalogue

Open Catalog → Products in the admin panel to manage products, variants, options, taxons and attributes. From here you create and edit products, assign them to taxons, set prices per channel and manage stock.

The Sylius product list in the administration panel

Step 8: View the Storefront

The storefront is served on port 80. Browse to http://<instance-public-ip>/ to see the shop your customers use. The demo storefront shows the channel, categories, product listings and cart that ship with the fixtures.

The Sylius storefront home page served on port 80

Step 9: Use the REST API

Sylius is API first: the same catalogue and checkout that power the storefront are exposed over a documented REST API served on port 80 under /api/v2, so you can build a custom storefront, a mobile app or a headless frontend against it. The interactive OpenAPI documentation is served at /api/v2/docs.

The API Platform OpenAPI documentation for the Sylius REST API

The public shop endpoints need no authentication. List the catalogue over the API:

curl -s -H 'Accept: application/ld+json' \
  'http://127.0.0.1/api/v2/shop/products?itemsPerPage=3' \
  | python3 -c 'import sys,json;d=json.load(sys.stdin);print("total products:",d.get("hydra:totalItems"));[print(" -",m["code"]) for m in d.get("hydra:member",[])[:3]]'
total products: 87
 - Adventurous_Aurora_Cap
 - Apollo_T_Shirt
 - Aurora_Surge_T_Shirt

The admin API under /api/v2/admin is protected: request a JSON Web Token from /api/v2/admin/administrators/token with your administrator email and password, then send it as a Bearer token. An unauthenticated admin request correctly returns 401:

curl -s -o /dev/null -w 'admin api (no token): %{http_code}\n' \
  -H 'Accept: application/ld+json' http://127.0.0.1/api/v2/admin/products
admin api (no token): 401

Step 10: Take Your Store Live

The image is the platform, ready for you to make it your own store. Before you take real orders, sign in to the admin panel and:

  • Build your own catalogue under Catalog, and remove or replace the demo products
  • Configure your shipping methods and zones, and your tax rates
  • Connect your payment gateways under Configuration → Payment methods (Sylius integrates with Stripe, PayPal, Mollie and others)
  • Set your store's channels, currencies and locales
  • Configure a mail transport so order confirmations and password resets are delivered. Sylius reads the mailer from the MAILER_DSN value in /var/www/sylius/.env.local; set it to your SMTP provider and clear the cache with sudo -u www-data APP_ENV=prod php /var/www/sylius/bin/console cache:clear

Step 11: The Data Volume

The MySQL database and Sylius' media and uploads live on a dedicated EBS data volume mounted at /var/lib/sylius, separate from the operating system disk, so you can resize or snapshot your store data independently. Confirm the mount:

findmnt /var/lib/sylius
df -h /var/lib/sylius

The MySQL data directory is /var/lib/sylius/mysql and the media directory is /var/lib/sylius/media. To grow the store, expand the EBS volume in the AWS console and then grow the filesystem with sudo resize2fs.

Step 12: Enable HTTPS with a Custom Domain

For production you should serve the store over HTTPS on your own domain. Point a DNS A record at the instance's public IP (allocate an Elastic IP so it is stable), open port 443 in the security group, then install a certificate with Certbot:

sudo apt-get update
sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d store.your-domain.com

After issuing the certificate, add your domain to the TRUSTED_HOSTS value and set the channel hostname to your domain in the admin panel under Configuration → Channels, then clear the cache so Sylius serves your domain.

Step 13: Backup and Maintenance

Back up the MySQL database regularly with mysqldump, and snapshot the /var/lib/sylius EBS volume to capture both the database and the uploaded media:

sudo mysqldump --single-transaction sylius > /var/lib/sylius/sylius-backup.sql

Apply operating system security updates with sudo apt-get update && sudo apt-get upgrade. Update Sylius itself with Composer inside /var/www/sylius following the official Sylius upgrade guide, and always take a database and volume snapshot before upgrading.

Support

This image is supported by cloudimg. If you need help deploying or operating Sylius, contact cloudimg support by email and chat, 24/7. We can help with deployment, catalogue and channel configuration, the REST API, payment and shipping integrations, mail setup, TLS and custom domains, database tuning and scaling.