メニュー
Amazon Relational Database Service
ユーザーガイド (API Version 2014-10-31)

Microsoft SQL Server DB インスタンスを作成して DB インスタンスに接続する

Amazon RDS の基本的な構成要素は DB インスタンスです。Amazon RDS DB インスタンスが、オンプレミスの Microsoft SQL Server に類似しています。SQL Server DB インスタンスを作成した後、1 つ以上のカスタムデータベースを追加できます。

重要

DB インスタンスを作成する前に、AWS アカウントが必要です。AWS アカウントをまだ作成していない場合は、https://aws.amazon.com/ にアクセスし、[Create an AWS Account] を選択します。

このトピックでは、サンプルの SQL Server DB インスタンスを作成します。その後、DB インスタンスに接続し、シンプルなクエリを実行します。最後は、サンプルの DB インスタンスを削除します。

サンプルの SQL Server DB インスタンスを作成する

この手順では、AWS マネジメントコンソール を使用してサンプルの DB インスタンスを作成します。サンプルの DB インスタンスの作成のみを行うため、すべての設定を詳細には説明しません。各設定の詳細な説明については、「Microsoft SQL Server データベースエンジンを実行する DB インスタンスを作成する」を参照してください。

To create a DB instance running the Microsoft SQL Server DB engine

  1. AWS マネジメントコンソールにサインインし、Amazon RDS コンソール (https://console.aws.amazon.com/rds/) を開きます。

  2. In the top right corner of the Amazon RDS console, choose the region in which you want to create the DB instance.

  3. In the navigation pane, choose Instances.

  4. Choose Launch DB Instance.

    The Select Engine page appears.

    
						Engine selection
  5. Choose the SQL Server icon, and then choose Select for the SQL Server Express edition.

    The Specify DB Details page appears.

    
						DB instance details
  6. On the Specify DB Details page, provide the information for your DB instance as shown in the following table:

    For This Parameter Do This

    License Model

    Choose license-included to use the general license agreement for Microsoft SQL Server.

    DB Engine Version

    Choose the most recent version of SQL Server available in the list.

    DB Instance Class

    Choose db.t2.micro. This instance class is appropriate for testing.

    Time Zone

    Do not choose a time zone. If you don't choose a time zone, your DB instance uses the default time zone.

    Storage Type

    Choose the storage type General Purpose (SSD).

    Allocated Storage

    Type 20 to allocate 20 GB of storage for your database. There is a warning that you should consider allocating more storage, but since this is a sample DB instance, 20 GB is sufficient.

    DB Instance Identifier

    Type sample-instance.

    Master Username

    Type a name that you will use as the master user name to log on to your DB Instance with all database privileges. The master user name is a SQL Server Authentication login.

    Master Password and Confirm Password

    Type a password for your master user password. It must contain between 8 and 128 printable ASCII characters (excluding /,", and @).

  7. Choose Next to continue.

    The Configure Advanced Settings page appears.

    
    					Additional Configuration panel
  8. On the Configure Advanced Settings page, provide the information for your DB instance as shown in the following table:

    For This Parameter Do This

    VPC

    Choose Create new VPC.

    Subnet Group

    Choose Create new DB Subnet Group.

    Publicly Accessible

    Choose Yes.

    Availability Zone

    Choose No Preference.

    VPC Security Group

    Choose Create new Security Group.

    Database Port

    Leave the default value of 1433 unless you have a specific port you want to access the database through. SQL Server installations default to port 1433, but in some cases a firewall might block this port. If in doubt, ask your network administrator what port you should use.

    DB Parameter Group

    Leave the default value.

    Option Group

    Leave the default value.

    Copy Tags To Snapshots

    Leave this setting unselected.

    Backup Retention Period

    Choose 7.

    Backup Window

    Choose No Preference.

    Enable Enhanced Monitoring

    Choose No.

    Auto Minor Version Upgrade

    Choose Yes.

    Maintenance Window

    Choose No Preference.

  9. Choose Launch DB Instance.

  10. Choose View Your DB Instances.

    On the RDS console, the new DB instance appears in the list of DB instances. The DB instance has a status of creating until the DB instance is ready to use. When the state changes to available, you can connect to the DB instance. Depending on the DB instance class and the amount of storage, it can take up to 20 minutes before the new instance is available.

    
						My DB instances list

サンプルの SQL Server DB インスタンスへの接続

この手順では、Microsoft SQL Server Management Studio (SSMS) を使用してサンプル DB インスタンスに接続します。このユーティリティのスタンドアロンバージョンをダウンロードするには、Microsoft ドキュメントの「Download SQL Server Management Studio (SSMS)」を参照してください。

To connect to a DB Instance using SSMS

  1. Find the DNS name and port number for your DB Instance.

    1. Open the RDS console and then choose Instances to display a list of your DB instances.

    2. Choose the row for your SQL Server DB instance to display the summary information for the instance.

      
    				            Locate DB Instance endpoint and port
    3. Copy the endpoint. The Endpoint field has two parts separated by a colon (:). The part before the colon is the DNS name for the instance, the part following the colon is the port number. Copy both parts.

  2. Start SQL Server Management Studio.

    The Connect to Server dialog box appears.

    
    					Connect to Server dialog
  3. Provide the information for your sample DB instance.

    1. For Server type, choose Database Engine.

    2. For Server name, type or paste the DNS name and port number of your sample DB Instance, separated by a comma.

      重要

      Change the colon between the DNS name and port number to a comma.

      For example, your server name should look like the following:

      sample-instance.cg034hpkmmjt.us-east-1.rds.amazonaws.com,1433
    3. For Authentication, choose SQL Server Authentication.

    4. For Login, type the master user name you chose earlier for your sample DB instance.

    5. For Password, type the password you chose earlier for your sample DB instance.

  4. Choose Connect.

    After a few moments, SSMS connects to your DB instance. If you can't connect to your DB instance, see SQL Server DB インスタンスへの接続のトラブルシューティング.

初めてのサンプル SQL Server DB インスタンスの使用

この手順では、前の手順から引き続き、Microsoft SQL Server Management Studio (SSMS) を使用してサンプル DB インスタンスを使用します。

To explore a DB Instance using SSMS

  1. Your SQL Server DB instance comes with SQL Server's standard built-in system databases (master, model, msdb, and tempdb). To explore the system databases, do the following:

    1. In SSMS, on the View menu, choose Object Explorer.

    2. Expand your DB instance, expand Databases, and then expand System Databases as shown following.

      
								Object Explorer displaying the system databases
  2. Your SQL Server DB instance also comes with a database named rdsadmin. Amazon RDS uses this database to store the objects that it uses to manage your database. The rdsadmin database also includes stored procedures that you can run to perform advanced tasks.

  3. You can now start creating your own databases and running queries against your DB instance and databases as usual. To run a test query against your sample DB instance, do the following:

    1. In SSMS, on the File menu point to New and then choose Query with Current Connection.

    2. Type the following SQL query:

      Copy
      select @@VERSION
    3. Run the query. SSMS returns the SQL Server version of your Amazon RDS DB instance.

      
			                    SQL Query Window

サンプル SQL Server DB インスタンスの削除

作成したサンプル DB インスタンスの操作が完了したら、料金がこれ以上発生しないように、DB インスタンスを削除してください。

To delete a DB instance

  1. AWS マネジメントコンソールにサインインし、Amazon RDS コンソール (https://console.aws.amazon.com/rds/) を開きます。

  2. In the Instances list, choose your sample DB instance.

  3. Choose Instance Actions, and then choose Delete.

  4. For Create final Snapshot, choose No.

    注記

    You should create a final snapshot for any production DB instance that you delete.

  5. Choose Delete.

関連トピック