• 沒有找到結果。

Creating an Amazon RDS DB instance

The basic building block of Amazon RDS is the DB instance, where you create your databases. You choose the engine-specific characteristics of the DB instance when you create it. You also choose the storage capacity, CPU, memory, and so on, of the AWS instance on which the database server runs.

Important

Before you can create or connect to a DB instance, you must complete the tasks in Setting up for Amazon RDS (p. 92).

Console

You can create a DB instance by using the AWS Management Console with Easy create enabled or not enabled. With Easy create enabled, you specify only the DB engine type, DB instance size, and DB instance identifier. Easy create uses the default setting for other configuration options. With Easy create not enabled, you specify more configuration options when you create a database, including ones for availability, security, backups, and maintenance.

Note

In the following procedure, Standard create is enabled, and Easy create isn't enabled. This procedure uses Microsoft SQL Server as an example.

For examples that use Easy create to walk you through creating and connecting to sample DB instances for each engine, see Getting started with Amazon RDS (p. 98). For an example that uses the original console to create a DB instance, see Original console example (p. 189).

To create a DB instance

1. Sign in to the AWS Management Console and open the Amazon RDS console at https://

console.aws.amazon.com/rds/.

2. In the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to create the DB instance.

3. In the navigation pane, choose Databases.

4. Choose Create database.

5. In Choose a database creation method, select Standard Create.

6. In Engine options, choose the engine type: MariaDB, Microsoft SQL Server, MySQL, Oracle, or PostgreSQL. Microsoft SQL Server is shown here.

Creating a DB instance

7. For Edition, if you're using Oracle or SQL Server choose the DB engine edition that you want to use.

MySQL has only one option for the edition, and MariaDB and PostgreSQL have none.

8. For Version, choose the engine version.

9. In Templates, choose the template that matches your use case. If you choose Production, the following are preselected in a later step:

Multi-AZ failover option

Provisioned IOPS storage option

Enable deletion protection option

We recommend these features for any production environment.

NoteTemplate choices vary by edition.

10. To enter your master password, do the following:

a. In the Settings section, open Credential Settings.

Creating a DB instance

b. If you want to specify a password, clear the Auto generate a password check box if it is selected.

c. (Optional) Change the Master username value.

d. Enter the same password in Master password and Confirm password.

11. For the remaining sections, specify your DB instance settings. For information about each setting, see Settings for DB instances (p. 177).

12. Choose Create database.

If you chose to use an automatically generated password, the View credential details button appears on the Databases page.

To view the master user name and password for the DB instance, choose View credential details.

To connect to the DB instance as the master user, use the user name and password that appear.

Important

You can't view the master user password again. If you don't record it, you might have to change it. If you need to change the master user password after the DB instance is available, modify the DB instance to do so. For more information about modifying a DB instance, see Modifying an Amazon RDS DB instance (p. 308).

13. For Databases, choose the name of the new DB instance.

On the RDS console, the details for the new DB instance appear. The DB instance has a status of Creating until the DB instance is created and ready for use. When the state changes to Available, you can connect to the DB instance. Depending on the DB instance class and storage allocated, it can take several minutes for the new instance to be available.

AWS CLI

To create a DB instance by using the AWS CLI, call the create-db-instance command with the following parameters:

• --db-instance-identifier

• --db-instance-class

• --vpc-security-group-ids

• --db-subnet-group

• --engine

Available settings

• --master-username

• --master-user-password

• --allocated-storage

• --backup-retention-period

For information about each setting, see Settings for DB instances (p. 177).

This example uses Microsoft SQL Server.

Example

For Linux, macOS, or Unix:

aws rds create-db-instance \ --engine sqlserver-se \

--db-instance-identifier mymsftsqlserver \ --allocated-storage 250 \

--db-instance-class db.t3.large \

--vpc-security-group-ids mysecuritygroup \ --db-subnet-group mydbsubnetgroup \ --master-username masterawsuser \

--master-user-password masteruserpassword \ --backup-retention-period 3

For Windows:

aws rds create-db-instance ^ --engine sqlserver-se ^

--db-instance-identifier mydbinstance ^ --allocated-storage 250 ^

--db-instance-class db.t3.large ^

--vpc-security-group-ids mysecuritygroup ^ --db-subnet-group mydbsubnetgroup ^ --master-username masterawsuser ^

--master-user-password masteruserpassword ^ --backup-retention-period 3

This command produces output similar to the following.

DBINSTANCE mydbinstance db.t3.large sqlserver-se 250 sa creating 3 **** n 10.50.2789

SECGROUP default active

PARAMGRP default.sqlserver-se-14 in-sync

RDS API

To create a DB instance by using the Amazon RDS API, call the CreateDBInstance operation.

For information about each setting, see Settings for DB instances (p. 177).

相關文件