SQL Server 2019 Express
Overview
This guide covers the deployment and configuration of SQL Server 2019 Express on Linux using SecureAnyCloud AMIs from the AWS Marketplace. SQL Server 2019 Express is a free, lightweight edition of SQL Server ideal for small databases, lightweight web applications, and learning SQL Server fundamentals.
What's included in this AMI:
- SQL Server 2019 Express edition installed at /opt/mssql
- SQL Server database port 1433 preconfigured and listening on boot
- SA (System Administrator) account with a randomly generated password
- sqlcmd command line tool for database interaction
- OS package update script for keeping the system current
- AWS CLI v2 for AWS service integration
- Systems Manager Agent (SSM) for remote management
- CloudWatch Agent for monitoring
- Latest security patches applied at build time
- 24/7 SecureAnyCloud support with guaranteed 24 hour response SLA
Edition Notes: SQL Server 2019 Express is free to use in production but has the following resource limits: maximum database size of 10 GB per database, maximum of 1 GB RAM utilisation for the buffer pool, and limited to the lesser of 1 socket or 4 cores. These limits make Express suitable for small applications, embedded databases, and learning environments. If your workload exceeds these limits, consider upgrading to Standard or Enterprise edition.
Prerequisites
Before you launch the AMI, make sure you have:
- An active AWS account
- An active subscription to the SQL Server 2019 Express listing on AWS Marketplace
- An EC2 key pair for SSH access
- Familiarity with EC2 instance management and SSH
Recommended instance type: t3.small (2 vCPU, 2 GB RAM). Express edition is limited to a 1 GB buffer pool and 4 cores, so a smaller instance is cost-effective.
Minimum requirements: 1 vCPU, 2 GB RAM and 6 GB of disk space.
Launch the AMI
- Open the AWS Marketplace and search for "SQL Server 2019 Express SecureAnyCloud".
- Choose Continue to Subscribe, accept the terms, then choose Continue to Configuration.
- Select your Region and Software Version.
- Choose Continue to Launch.
- Choose Launch through EC2 for full control over the instance configuration.
- Select your instance type (
t3.smallis recommended). - Configure storage with at least 6 GB of disk space. Individual databases are limited to 10 GB in Express edition.
- Configure your Security Group with the inbound rules below.
Port Protocol Source Purpose
22 TCP Your IP SSH access
1433 TCP Your IP SQL Server database port
Important: Restrict port 1433 to trusted application servers or your own IP address. Never expose the SQL Server port to the public internet.
- Select your EC2 key pair and launch the instance.
Connect via SSH
When your instance is running and has passed both status checks (2/2), connect over SSH:
ssh -i your-key.pem ec2-user@<public-ip-address>To switch to the root user:
sudo su -Important: Wait for the EC2 instance to reach 2/2 successful status checks before you connect. Early connection attempts may fail with "Permission denied" while the instance is still initializing.
Retrieve the SA password
The SA (System Administrator) password is randomly generated at build time and stored in a log file on the instance. Run this command to read it:
cat /stage/scripts/mssql_admin_password.logSave the password securely. You need it to connect to SQL Server.
Connect to SQL Server
Use the sqlcmd command-line tool to connect to the local SQL Server instance:
sqlcmd -S localhost -U SAWhen prompted, enter the SA password you retrieved in Step 3. The prompt looks like this:
1>You are now connected to SQL Server and can run T-SQL queries.
Create a database and table
Create a new database:
CREATE DATABASE MyAppDB; GOSwitch to the new database:
USE MyAppDB; GOCreate a table:
CREATE TABLE Users ( UserID INT IDENTITY(1,1) PRIMARY KEY, Name NVARCHAR(100), Email NVARCHAR(255), CreatedAt DATETIME DEFAULT GETDATE() ); GOInsert a row:
INSERT INTO Users (Name, Email) VALUES ('John Doe', 'john@example.com'); GOQuery the data:
SELECT * FROM Users; GOType QUIT to exit the sqlcmd shell.
Note: Each database in Express edition is limited to 10 GB. Monitor database size with this query:
SELECT name, size * 8 / 1024 AS SizeMB FROM sys.master_files WHERE type = 0; GOServer Components
Component Software Home
SQL Server 2019 Express /opt/mssql
Note: On first boot, the OS package update script can update component versions when it finds newer versions in the system package repositories.
Filesystem Layout
Mount Point Size Description
/ 38 GB Root filesystem
/boot 2 GB Operating system kernel files
/opt/mssql 9.8 GB SQL Server installation directory
Managing the SQL Server Service
systemd manages SQL Server, and the service starts automatically on boot.
Check the service status:
systemctl status mssql-serverStop SQL Server:
systemctl stop mssql-serverStart SQL Server:
systemctl start mssql-serverRestart SQL Server:
systemctl restart mssql-serverScripts and Log Files
Script/Log Path Description
initial_boot_update.sh /stage/scripts Updates the OS with the latest packages on first boot
initial_boot_update.log /stage/scripts Output log for the boot update script
mssql_admin_password.log /stage/scripts Contains the randomly generated SA password
On Startup
An OS package update script runs on first boot to bring the image fully up to date. To disable it, remove the script and its crontab entry:
rm -f /stage/scripts/initial_boot_update.sh crontab -e
# Delete the following line, save and exit: @reboot /stage/scripts/initial_boot_update.shTroubleshooting
Cannot connect via SSH
- Wait for the EC2 instance to reach 2/2 status checks.
- Verify that your security group allows port 22 from your IP address.
- Confirm that you are using the correct key pair and connecting as
ec2-user. - Check the instance system log in the AWS Console for boot errors.
SQL Server service not running
- Check the service status:
systemctl status mssql-server - Review the SQL Server error log:
cat /var/opt/mssql/log/errorlog - Verify that there is enough disk space:
df -h /opt/mssql - Make sure the instance has at least 2 GB of RAM.
Cannot connect to SQL Server on port 1433
- Verify that the service is running:
systemctl status mssql-server - Check that the security group allows port 1433 from your IP address.
- Test local connectivity:
sqlcmd -S localhost -U SA - Check that SQL Server is listening:
ss -tlnp | grep 1433
SA password not working
- Retrieve the password again:
cat /stage/scripts/mssql_admin_password.log - Make sure you copy the entire password without extra whitespace.
- If needed, reset the SA password with
mssql-conf:
sudo systemctl stop mssql-server
sudo /opt/mssql/bin/mssql-conf set-sa-password
sudo systemctl start mssql-serverDatabase size limit reached (10 GB)
- Check the current database sizes:
SELECT name, size * 8 / 1024 AS SizeMB FROM sys.master_files WHERE type = 0; GO- Archive or purge old data to free space.
- If 10 GB is not enough, consider upgrading to Standard or Enterprise edition.
Security Recommendations
- Restrict port access. Allow SQL Server port 1433 only from trusted application servers or specific IP addresses.
- Change the SA password. After your first login, replace the generated password with a strong, unique one.
- Create application-specific logins. Do not use the SA account for application connections. Create dedicated logins with the minimum permissions they need.
- Enable encrypted connections. Configure SQL Server to use TLS/SSL for client connections.
- Keep SQL Server updated. Apply cumulative updates and security patches when they become available.
- Monitor access. Review the SQL Server error logs regularly for failed login attempts.
- Use AWS security features. Use VPC security groups, NACLs and private subnets to restrict network access.
- Secure the password file. After you retrieve the SA password, consider removing the file or restricting access to
/stage/scripts/mssql_admin_password.log. - Monitor database sizes. Express edition has a 10 GB limit per database. Set up alerts before you reach it.
Support
If you encounter any issues with this product, contact SecureAnyCloud support:
- Email: sales@secureanycloud.com
- Website: secureanycloud.com
- Support hours: 24/7 with guaranteed 24 hour response SLA
Deploy on AWS
Launch SQL Server 2019 Express with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com