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

PostgreSQL データベースエンジンを実行する DB インスタンスの作成

Amazon RDS の基本的な構成要素は DB インスタンスです。これは PostgreSQL データベースを実行する環境です。

重要

DB インスタンスを作成したり、DB インスタンスに接続したりする前に、「Amazon RDS のセットアップ」セクションのタスクを実行する必要があります。

AWS マネジメントコンソール

To launch a PostgreSQL DB instance

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

  2. In the top right corner of the AWS マネジメントコンソール, select the region where you want to create the DB instance.

  3. In the navigation pane, click DB Instances.

  4. Click Launch DB Instance to start the Launch DB Instance Wizard.

    The wizard opens on the Select Engine page.

    
								Engine selection

  5. On the Select Engine page, click the PostgreSQL icon and then click the Select button for the PostgreSQL DB engine.

  6. Next, the Production? page asks if you are planning to use the DB instance you are creating for production. If you are, select Yes. By selecting Yes, the failover option Multi-AZ and the Provisioned IOPS storage option will be preselected in the following step. Click Next when you are finished.

  7. On the Specify DB Details page, specify your DB instance information. Click Next when you are finished.

    For this parameter... ...Do this:

    License Model

    PostgreSQL has only one license model. Select the default, postgresql-license, to use the general license agreement for PostgreSQL.

    DB Engine Version

    Select the version of PostgreSQL that you want to work with.

    DB Instance Class

    Select a DB instance class that defines the processing and memory requirements for the DB instance. For more information about all the DB instance class options, see DB インスタンスクラス.

    Multi-AZ Deployment

    Determine if you want to create a standby replica of your DB instance in another Availability Zone for failover support. For more information about multiple Availability Zones, see リージョンとアベイラビリティーゾーン.

    Allocated Storage

    Type a value to allocate storage for your database (in gigabytes). In some cases, allocating a higher amount of storage for your DB instance than the size of your database can improve I/O performance. The minimum allocated storage for a PostgreSQL instance is 5 GB. For more information about storage allocation, see Amazon Relational Database Service Features.

    Storage Type

    Select the storage type you want to use. For more information about storage, see Amazon RDS のストレージ.

    DB Instance Identifier

    Type a name for the DB instance that is unique for your account in the region you selected. You may chose to add some intelligence to the name such as including the region and DB engine you selected, for example postgresql-instance1.

    Master Username

    Type a name using alphanumeric characters that you will use as the master user name to log on to your DB instance. For information on the default privileges granted to the master user name, see Amazon RDS PostgreSQL 計画に必要になる情報

    Master Password and Confirm Password

    Type a password that contains from 8 to 128 printable ASCII characters (excluding /,", and @) for your master user password. Retype the password in the Confirm Password text box.

    
								DB instance details

  8. On the Configure Advanced Settings page, provide additional information that Amazon RDS needs to launch the PostgreSQL DB instance. The table shows settings for an example DB instance. Specify your DB instance information, then click Launch DB Instance.

    For this parameter... ...Do this:

    VPC

    This setting depends on the platform you are on. If you are a new customer to AWS, select the default VPC shown. If you are creating a DB instance on the previous E2-Classic platform that does not use a VPC, select Not in VPC. For more information about VPC, see Amazon Virtual Private Cloud (VPCs) と Amazon RDS.

    DB Subnet Group

    This setting depends on the platform you are on. If you are a new customer to AWS, select default, which will be the default DB subnet group that was created for your account. If you are creating a DB instance on the previous E2-Classic platform and you want your DB instance in a specific VPC, select the DB subnet group you created for that VPC. For more information about VPC, see Amazon Virtual Private Cloud (VPCs) と Amazon RDS.

    Publicly Accessible

    Select Yes to give the DB instance a public IP address, meaning that it will be accessible outside the VPC (the DB instance also needs to be in a public subnet in the VPC); otherwise, select No, so the DB instance will only be accessible from inside the VPC. For more information about hiding DB instances from public access, see VPC の DB インスタンスをインターネットから隠す.

    Availability Zone

    Use the default value of No Preference unless you want to specify an Availability Zone.

    VPC Security Group

    If you are a new customer to AWS, select the default VPC. If you created a VPC security group, select the VPC security group you previously created.

    Database Name

    If you want to specify a database name for the default database, type a name for your database of up to 63 alpha-numeric characters. If you do not provide a name, the default "postgres" database is created.

    To create additional databases, connect to the DB instance and use the SQL command CREATE DATABASE. For more information about connecting to the DB instance, see PostgreSQL データベースエンジンを実行する DB インスタンスへの接続.

    Database Port

    Specify a port you want to use to access the database. PostgreSQL installations default to port 5432 .

    Parameter Group

    Select a parameter group. Each PostgreSQL version has a default parameter group you can use, or you can create your own parameter group. For more information about parameter groups, see DB パラメータグループを使用する.

    Option Group

    Option groups are currently not used with PostgreSQL DB instances. For more information about option groups, see オプショングループを使用する.

    Copy Tags To Snapshots

    Choose this option to have any DB instance tags copied to a DB snapshot when you create a snapshot. For more information, see Amazon RDS リソースのタグ付け.

    Enable Encryption

    Select Yes to enable encryption at rest for this DB instance. For more information, see Amazon RDS リソースの暗号化.

    Backup Retention Period

    Set the number of days you want automatic backups of your database to be retained. For non-trivial instances set this value to 1 or greater.

    Backup Window

    Unless you have a specific time that you want to have your database backup, use the default of No Preference.

    Auto Minor Version Upgrade

    Select Yes to enable your DB instance to receive minor DB engine version upgrades automatically when they become available.

    Maintenance Window

    Select the 30 minute window in which pending modifications to your DB instance are applied. If you the time period doesn't matter, select No Preference.

    
								Additional Configuration panel

  9. On the final page of the wizard, click Close.

  10. On the Amazon RDS console, the new DB instance appears in the list of DB instances. The DB instance will have 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 store allocated, it could take several minutes for the new instance to be available.

    
						My DB instances list

CLI

PostgreSQL DB インスタンスを作成するには、以下のパラメータを指定して AWS CLI の create-db-instance コマンドを使用します。

  • --db-instance-identifier

  • --allocated-storage

  • --db-instance-class

  • --engine

  • --master-username

  • --master-user-password

Linux、OS X、Unix の場合:

Copy
aws rds create-db-instance --db-instance-identifier pgdbinstance \ --allocated-storage 20 \ --db-instance-class db.t2.small \ --engine postgres \ --master-username masterawsuser \ --master-user-password masteruserpassword

Windows の場合:

Copy
aws rds create-db-instance --db-instance-identifier pgdbinstance ^ --allocated-storage 20 ^ --db-instance-class db.t2.small ^ --engine postgres ^ --master-username masterawsuser ^ --master-user-password masteruserpassword

このコマンドでは、次のような出力が生成されます。

Copy
DBINSTANCE pgdbinstance db.t2.small postgres 20 sa creating 3 **** n 9.3 SECGROUP default active PARAMGRP default.PostgreSQL9.3 in-sync

API

PostgreSQL DB インスタンスを作成するには、以下のパラメータを指定して Amazon RDS APICreateDBInstance コマンドを使用します。

  • Engine = postgres

  • DBInstanceIdentifier = pgdbinstance

  • DBInstanceClass = db.t2.small

  • AllocatedStorage = 20

  • BackupRetentionPeriod = 3

  • MasterUsername = masterawsuser

  • MasterUserPassword = masteruserpassword

Copy
https://rds.amazonaws.com/ ?Action=CreateDBInstance &AllocatedStorage=20 &BackupRetentionPeriod=3 &DBInstanceClass=db.t2.small &DBInstanceIdentifier=pgdbinstance &DBName=mydatabase &DBSecurityGroups.member.1=mysecuritygroup &DBSubnetGroup=mydbsubnetgroup &Engine=postgres &MasterUserPassword=<masteruserpassword> &MasterUsername=<masterawsuser> &SignatureMethod=HmacSHA256 &SignatureVersion=4 &Version=2013-09-09 &X-Amz-Algorithm=AWS4-HMAC-SHA256 &X-Amz-Credential=AKIADQKE4SARGYLE/20140212/us-west-2/rds/aws4_request &X-Amz-Date=20140212T190137Z &X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date &X-Amz-Signature=60d520ca0576c191b9eac8dbfe5617ebb6a6a9f3994d96437a102c0c2c80f88d

関連トピック