Amazonrds 简明教程

Amazon RDS - PostgresSQL creating DB

作为云平台,AWS 为您提供了在 RDS 中设置一个数据库所需的极少步骤。创建 PostgreSQL 有三种方法:使用 AWS 管理控制台、AWS CLI 或 AWS API。我们将逐步了解每一种方法。

As a cloud platform AWS gives you very minimal number of steps to setup a DB in RDS. Creating a PostgreSQL can be done in three ways. Using AWS management console, AWS CLI or AWS API. We will look at each of these approaches one by one.

Using AWS management Console

AWS 管理控制台是开始使用 RDS 的最便捷方式。使用您的 AWS 账户详细信息登录 AWS 控制台,找到 RDS 服务,然后按照以下所示步骤操作,以创建 PostgreSQL 实例。

AWS management console is the most convenient way to get started with RDS. You login to the AWS console using your AWS account details, locate the RDS service and then follow the steps shown below to create a PostgreSQL instance.

Step-1

从控制台中选择 PostgreSQL 引擎。

Select the PostgreSQL Engine form the console.

create postgresSQL step 1

Step-2

指定所需的数据库详细信息。

Specify the required DB details.

mariadb step 2

Step-3

在本步骤中,您确定数据库实例类型、分配的存储量、设置主密码以及其他一些详细信息。

In this step you decide on the db instance class, amount of storage allocated also set the master password along with few other details.

create postgresSQL step 3

Stpe—4

这是最后一步,其中您提到了 vpc 和安全设置、加密、备份选项和日志导出等。为了简洁起见,屏幕截图已缩短,仅显示最终选项。

This is the final step when you mention the vpc and security settings, encryption, backup options and log export etc. For brevity the screen shot has been shortened showing only the final options.

create postgresSQL step 4

Stpe—5

最后一步,我们选择创建数据库选项。

In the final step we choose the create Data base option.

create postgresSQL step 5

Using CLI

要使用 AWS CLI 创建 PostgreSQL DB 实例,请使用以下参数调用 create-db-instance 命令:

To create a PostgreSQL DB instance by using the AWS CLI, call the create-db-instance command with the parameters below.

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

Using API

要使用 Amazon RDS API 创建一个 PostgreSQL 实例,我们调用 CreateDBInstance 操作,其参数如下所示:

To create a PostgreSQL instance by using the Amazon RDS API, we call the CreateDBInstance action with the parameters as shown below.

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=
    &MasterUsername=
    &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