[AWS] How to access a SQL Server on Linux instance
1. preparation
1.1 Checking instance information
On the AWS EC2 instance page, obtain the instance ID and public IP address.
Note that the instance ID is the default password for your database server sa user.
1.2. Checking SQL Server Service Status
Password initialization with starting the service is usually done within a few minutes after the instance is started. You can access the instance via SSH to check the service status. For more information on how to access the Linux instance via SSH, please refer to Connect to your Linux instance.
$ systemctl status mssql-server
Wait until the service has finished starting and is active (running) before going any further.
2. Access via SQL Server Management Studio (recommended)
To download SSMS for Windows, please visit: Download SQL Server Management Studio (SSMS). Once the installation is complete, find SQL Server Management Studio 20 in the Start menu and open it.
Enter the following information in the Connect to Server window:
Server name -----------------> <Public IPv4 address of your instance>
Authentication --------------> SQL Server Authentication
Login -------------------------> sa
Password ---------------------> <your instance ID>
Then check the “Trust server certificate” box, but then click the Connect button.
Connection successful:
3. Access via command line (optional)
You can also access the command line:
sqlcmd -S localhost -C -U sa -P 'i-0665f007fe1c07383'
Please replace i-0665f007fe1c07383 with your actual instance ID
For more information on using the command line, see the documentation: “sqlcmd – use the utility”.