LinuxCommandLibrary

aws-rds

Manage Amazon Relational Database Service (RDS) instances

TLDR

Display help for a specific RDS subcommand

$ aws rds [subcommand] help
copy

Stop instance
$ aws rds stop-db-instance --db-instance-identifier [instance_identifier]
copy

Start instance
$ aws rds start-db-instance --db-instance-identifier [instance_identifier]
copy

Modify an RDS instance
$ aws rds modify-db-instance --db-instance-identifier [instance_identifier] [parameters] --apply-immediately
copy

Apply updates to an RDS instance
$ aws rds apply-pending-maintenance-action --resource-identifier [database_arn] --apply-action [system-update] --opt-in-type [immediate]
copy

Change an instance identifier
$ aws rds modify-db-instance --db-instance-identifier [old_instance_identifier] --new-db-instance-identifier [new_instance_identifier]
copy

Reboot an instance
$ aws rds reboot-db-instance --db-instance-identifier [instance_identifier]
copy

Delete an instance
$ aws rds delete-db-instance --db-instance-identifier [instance_identifier] --final-db-snapshot-identifier [snapshot_identifier] --delete-automated-backups
copy

SYNOPSIS

aws [global-options] rds subcommand [subcommand-options] [parameters]

PARAMETERS

Global AWS CLI Options (applicable to any AWS CLI command, including aws rds operations)
    These options are passed to the main aws command and affect its overall behavior, such as region and output format.

--region value
    Specifies the AWS region to send the request to (e.g., us-east-1).

--output value
    Specifies the output format (e.g., json, text, table).

--profile value
    Uses a specific named profile from your credential file (e.g., default, dev).

--endpoint-url value
    Overrides the default endpoint for the RDS service, useful for local development or private endpoints.

--no-paginate
    Disables pagination for commands that return a large number of results.

Subcommand-specific Parameters (vary greatly by RDS operation)
    These parameters are specific to the chosen subcommand (e.g., create-db-instance, describe-db-instances). Below are examples of commonly used parameters for RDS operations.

--db-instance-identifier value
    A unique name for the DB instance (e.g., my-prod-db). Used in many operations like creation, modification, or deletion.

--db-instance-class value
    The compute and memory capacity of the DB instance (e.g., db.t3.micro, db.m5.large). Required for creating or modifying instances.

--engine value
    The name of the database engine (e.g., mysql, postgres, aurora). Required for creating new instances.

--master-username value
    The master user name for the DB instance. Required for creating new instances.

--master-user-password value
    The master user password for the DB instance. Required for creating new instances.

--allocated-storage value
    The size of the storage in GiB. Required for creating new instances.

--skip-final-snapshot | --no-skip-final-snapshot
    Used with delete-db-instance to specify whether to skip creating a final DB snapshot before deletion.

DESCRIPTION

The aws rds command, part of the AWS Command Line Interface (CLI), provides a powerful way to interact with and manage Amazon Relational Database Service (RDS) resources directly from your terminal. AWS RDS is a web service that simplifies the setup, operation, and scaling of relational databases in the cloud, supporting various database engines like MySQL, PostgreSQL, Oracle, SQL Server, and Amazon Aurora.

This command allows users to perform a wide range of operations including creating, modifying, and deleting DB instances; managing database snapshots, security groups, parameter groups, and more. It abstracts away many complex database administration tasks, enabling developers and administrators to focus on application development and data management.

Note: The term 'aws-rds' is commonly used to refer to the 'rds' subcommand within the official 'aws' CLI, rather than a standalone 'aws-rds' executable. This analysis assumes the functionality of 'aws rds'.

CAVEATS

Authentication and Permissions: Requires valid AWS credentials configured (e.g., via aws configure or environment variables) with appropriate IAM permissions for RDS actions. Without correct permissions, operations will fail with access denied errors.

Region Specificity: Operations are region-specific. Ensure the correct AWS region is used via the --region option or a configured profile, as resources in one region are not visible or manageable from another.

Asynchronous Operations: Many RDS operations (e.g., creating, modifying, deleting DB instances) are asynchronous and can take several minutes or longer to complete. The CLI command might return quickly, but the resource will remain in a 'pending' state until the operation is fully processed.

Cost Implications: Creating or running RDS instances incurs costs, which vary significantly by instance class, storage type and size, data transfer, and Multi-AZ configurations. Always review pricing and monitor usage to avoid unexpected charges.

Resource Limits: AWS accounts have default resource limits for RDS (e.g., maximum number of DB instances). If you exceed these limits, you'll need to request a limit increase through AWS Support.

COMMON WORKFLOWS AND EXAMPLES

Here are examples of common operations using the aws rds command:

Creating a DB Instance:
aws rds create-db-instance --db-instance-identifier my-test-db --db-instance-class db.t3.micro --engine mysql --master-username admin --master-user-password 'MySecurePassword123' --allocated-storage 20 --vpc-security-group-ids sg-xxxxxxxxxxxxxxxxx --db-subnet-group-name my-db-subnet-group

Describing DB Instances:
aws rds describe-db-instances --db-instance-identifier my-test-db
(To list all instances):
aws rds describe-db-instances

Deleting a DB Instance:
aws rds delete-db-instance --db-instance-identifier my-test-db --skip-final-snapshot

Creating a DB Snapshot:
aws rds create-db-snapshot --db-snapshot-identifier my-test-db-snapshot-2023-10-27 --db-instance-identifier my-test-db

CONFIGURATION AND CREDENTIALS

The AWS CLI relies on credentials and configuration files, typically located at ~/.aws/credentials and ~/.aws/config. These files define AWS access keys, secret keys, default regions, and named profiles. Using aws configure is the recommended way to set up these files, allowing secure management of AWS resources without embedding sensitive information directly in commands.

HISTORY

The AWS CLI was first released in 2013, providing a unified command-line interface for interacting with AWS services. Amazon RDS itself launched in 2009 to simplify the operational burden of running relational databases. The aws rds sub-command has evolved significantly since then, adding support for new database engines (like Aurora), features (like Multi-AZ deployments, read replicas), and fine-grained control over instance configuration as the RDS service itself expanded. Its development is tightly coupled with the ongoing evolution of the AWS RDS service.

SEE ALSO

aws(1), aws configure(1), aws ec2(1), aws s3(1), mysql(1), psql(1)

Copied to clipboard