ASi このページをアンテナに追加 RSSフィード

2017/11/17 Friday

[]CLI での RDS MySQLインスタンスの作り方

DB の ParameterGroup はあらかじめ作っておく。下記では "DBParameterGroupName": "db-1"

の db-1。

create-db-instance.json

{
    "DBName": "ADatabase", 
    "DBInstanceIdentifier": "db-1", 
    "AllocatedStorage": 5, 
    "DBInstanceClass": "db.t2.micro", 
    "Engine": "mysql", 
    "MasterUsername": "root", 
    "MasterUserPassword": "1234567890", 
    "VpcSecurityGroupIds": [
        "sg-12345678",
    ], 
    "AvailabilityZone": "us-west-1a", 
    "DBSubnetGroupName": "main-subnet", 
    "PreferredMaintenanceWindow": "tue:01:00-tue:02:00", 
    "DBParameterGroupName": "db-1", 
    "BackupRetentionPeriod": 7, 
    "PreferredBackupWindow": "19:00-20:00", 
    "Port": 3306, 
    "MultiAZ": false, 
    "EngineVersion": "5.7.17", 
    "AutoMinorVersionUpgrade": true, 
    "LicenseModel": "general-public-license", 
    "OptionGroupName": "default:mysql-5-7", 
    "PubliclyAccessible": false, 
    "Tags": [
        {"Key": "owner", "Value": "someone"},
        {"Key": "workload-type", "Value": "development"}
    ], 
    "StorageType": "gp2", 
    "StorageEncrypted": false, 
    "CopyTagsToSnapshot": false, 
    "EnableIAMDatabaseAuthentication": false
}

$ aws --profile someone rds create-db-instance --cli-input-json file://`pwd`/create-db-instance.json


なぜか OSX では "file://" が要る。

成功すると下記の様な出力が得られる。

{
    "DBInstance": {
        "PubliclyAccessible": false, 
        "MasterUsername": "root", 
        "MonitoringInterval": 0, 
        "LicenseModel": "general-public-license", 
        "VpcSecurityGroups": [
            {
                "Status": "active", 
                "VpcSecurityGroupId": "sg-12345678"
            }
        ], 
        "CopyTagsToSnapshot": false, 
        "OptionGroupMemberships": [
            {
                "Status": "in-sync", 
                "OptionGroupName": "default:mysql-5-7"
            }
        ], 
        "PendingModifiedValues": {
            "MasterUserPassword": "****"
        }, 
        "Engine": "mysql", 
        "MultiAZ": false, 
        "DBSecurityGroups": [], 
        "DBParameterGroups": [
            {
                "DBParameterGroupName": "db-1", 
                "ParameterApplyStatus": "in-sync"
            }
        ], 
        "AutoMinorVersionUpgrade": true, 
        "PreferredBackupWindow": "19:00-20:00", 
        "DBSubnetGroup": {
            "Subnets": [
                {
                    "SubnetStatus": "Active", 
                    "SubnetIdentifier": "subnet-12345678", 
                    "SubnetAvailabilityZone": {
                        "Name": "us-west-1a"
                    }
                }
            ], 
            "DBSubnetGroupName": "main-subnet", 
            "VpcId": "vpc-12345678", 
            "DBSubnetGroupDescription": "Main subnet", 
            "SubnetGroupStatus": "Complete"
        }, 
        "ReadReplicaDBInstanceIdentifiers": [], 
        "AllocatedStorage": 5, 
        "DBInstanceArn": "arn:aws:rds:us-west-1:111122223333:db:db-1", 
        "BackupRetentionPeriod": 7, 
        "DBName": "ADatabase", 
        "PreferredMaintenanceWindow": "tue:01:00-tue:02:00", 
        "DBInstanceStatus": "creating", 
        "IAMDatabaseAuthenticationEnabled": false, 
        "EngineVersion": "5.7.17", 
        "AvailabilityZone": "us-west-1a", 
        "DomainMemberships": [], 
        "StorageType": "gp2", 
        "DbiResourceId": "db-XXXXXXXXXXXXXXXXXXXXXXXXXX", 
        "CACertificateIdentifier": "rds-ca-2015", 
        "StorageEncrypted": false, 
        "DBInstanceClass": "db.t2.micro", 
        "DbInstancePort": 0, 
        "DBInstanceIdentifier": "db-1"
    }
}

スパム対策のためのダミーです。もし見えても何も入力しないでください
ゲスト


画像認証

トラックバック - http://d.hatena.ne.jp/ashura156/20171117/1510903464