

# Amazon RDS tutorials and sample code
<a name="CHAP_Tutorials"></a>

The Amazon documentation includes several tutorials that guide you through common Amazon RDS use cases. Many of these tutorials show you how to use Amazon RDS with other Amazon services. In addition, you can access sample code in . 

**Note**  
You can find more tutorials at the [Amazon Database Blog](https://www.amazonaws.cn/blogs/database/). For information about training, see [Amazon Training and Certification](https://www.aws.training/).

**Topics**
+ [Tutorials in this guide](#CHAP_Tutorials.ThisGuide)
+ [Tutorials in other Amazon guides](#CHAP_Tutorials.OtherGuides)
+ [Tutorials and sample code in GitHub](#CHAP_Tutorials.GitHub)
+ [Amazon Database Cookbook](#aws-db-cookbook-overview)
+ [Amazon workshop and lab content portal for Amazon RDS PostgreSQL](#CHAP_Tutorials_postgreslabs)
+ [Amazon workshop and lab content portal for Amazon RDS MySQL](#CHAP_Tutorials_sqllabs)
+ [Using this service with an Amazon SDK](#sdk-general-information-section)

## Tutorials in this guide
<a name="CHAP_Tutorials.ThisGuide"></a>

The following tutorials in this guide show you how to perform common tasks with Amazon RDS:
+ [Tutorial: Create a VPC for use with a DB instance (IPv4 only)](CHAP_Tutorials.WebServerDB.CreateVPC.md)

  Learn how to include a DB instance in a virtual private cloud (VPC) based on the Amazon VPC service. In this case, the VPC shares data with a web server that is running on an Amazon EC2 instance in the same VPC.
+ [Tutorial: Create a VPC for use with a DB instance (dual-stack mode)](CHAP_Tutorials.CreateVPCDualStack.md)

  Learn how to include a DB instance in a virtual private cloud (VPC) based on the Amazon VPC service. In this case, the VPC shares data with an Amazon EC2 instance in the same VPC. In this tutorial, you create the VPC for this scenario that works with a database running in dual-stack mode. 
+ [Tutorial: Create a web server and an Amazon RDS DB instance](TUT_WebAppWithRDS.md)

  Learn how to install an Apache web server with PHP and create a MySQL database. The web server runs on an Amazon EC2 instance using Amazon Linux, and the MySQL database is a MySQL DB instance. Both the Amazon EC2 instance and the DB instance run in an Amazon VPC.
+ [Tutorial: Restore an Amazon RDS DB instance from a DB snapshot](CHAP_Tutorials.RestoringFromSnapshot.md)

  Learn how to restore a DB instance from a DB snapshot.
+ [Tutorial: Using a Lambda function to access an Amazon RDS database](rds-lambda-tutorial.md)

  Learn how to create a Lambda function from the RDS console to access a database through a proxy, create a table, add a few records, and retrieve the records from the table. You also learn how to invoke the Lambda function and verify the query results.
+ [Tutorial: Specify which DB instances to stop by using tags](Tagging.RDS.Autostop.md)

  Learn how to use tags to specify which DB instances to stop.
+ [Tutorial: Log DB instance state changes using Amazon EventBridge](rds-cloud-watch-events.md#log-rds-instance-state)

  Learn how to log a DB instance state change using Amazon EventBridge and Amazon Lambda.
+ [Tutorial: Creating an Amazon CloudWatch alarm for Multi-AZ DB cluster replica lag for Amazon RDS](multi-az-db-cluster-cloudwatch-alarm.md)

  Learn how to create a CloudWatch alarm that sends an Amazon SNS message when replica lag for a Multi-AZ DB cluster has exceeded a threshold. An alarm watches the `ReplicaLag` metric over a time period that you specify. The action is a notification sent to an Amazon SNS topic or Amazon EC2 Auto Scaling policy.

## Tutorials in other Amazon guides
<a name="CHAP_Tutorials.OtherGuides"></a>

The following tutorials in other Amazon guides show you how to perform common tasks with Amazon RDS:
+ [ Tutorial: Rotating a Secret for an Amazon Database](https://docs.amazonaws.cn/secretsmanager/latest/userguide/tutorials_db-rotate.html) in the *Amazon Secrets Manager User Guide*

  Learn how to create a secret for an Amazon database and configure the secret to rotate on a schedule. You trigger one rotation manually, and then confirm that the new version of the secret continues to provide access.
+ [ Tutorials and samples](https://docs.amazonaws.cn/elasticbeanstalk/latest/dg/tutorials.html) in the *Amazon Elastic Beanstalk Developer Guide*

  Learn how to deploy applications that use Amazon RDS databases with Amazon Elastic Beanstalk.
+ [ Using Data from an Amazon RDS Database to Create an Amazon ML Datasource](https://docs.amazonaws.cn/machine-learning/latest/dg/using-amazon-rds-with-amazon-ml.html) in the *Amazon Machine Learning Developer Guide*

  Learn how to create an Amazon Machine Learning (Amazon ML) datasource object from data stored in a MySQL DB instance.
+ [ Manually Enabling Access to an Amazon RDS Instance in a VPC](https://docs.amazonaws.cn/quicksight/latest/user/rds-vpc-access.html) in the *Amazon Quick User Guide*

  Learn how to enable Quick access to an Amazon RDS DB instance in a VPC.

## Tutorials and sample code in GitHub
<a name="CHAP_Tutorials.GitHub"></a>

The following tutorials and sample code in GitHub show you how to perform common tasks with Amazon RDS:
+ [ Creating the Amazon Relational Database Service item tracker](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/usecases/Creating_rds_item_tracker)

  Learn how to create an application that tracks and reports on work items. This application uses Amazon RDS, Amazon Simple Email Service, Elastic Beanstalk, and SDK for Java 2.x.

## Amazon Database Cookbook
<a name="aws-db-cookbook-overview"></a>

The [Amazon DB Cookbook](https://github.com/aws-samples/sample-aws-database-cookbook/) is a comprehensive database guide that teaches you how to build, deploy, and manage high-performing, cost-effective database solutions on Amazon. Step-by-step tutorials guide you through creating production-ready applications and deploying the apps with CloudFormation templates. You'll learn essential Amazon services as you build infrastructure, implement networking, develop serverless architectures, manage databases, and integrate generative AI. Learn Amazon best practices that help you create secure, scalable solutions while optimizing costs. Whether you're new to Amazon or an experienced professional, the Amazon DB Cookbook helps you develop skills to solve common database challenges and implement enterprise-ready solutions. The cookbook includes the following sections:
+ **[Getting started with Amazon for DB applications](https://github.com/aws-samples/sample-aws-database-cookbook/tree/main/1_Getting_Started_with_AWS)** – Learn Amazon fundamentals like how to set up your account and Jupyter Notebook environment.
+ **[Database fundamentals](https://github.com/aws-samples/sample-aws-database-cookbook/tree/main/2_Your_First_Database_on_AWS)** – Explore essential database concepts and compare Amazon database services to choose the right solution for your workloads.
+ **[Serverless web app with Amazon Aurora](https://github.com/aws-samples/sample-aws-database-cookbook/tree/main/3_Building_Your_First_Serverless_Web_App_with_Aurora)** – Build an end-to-end retail application with Amazon Aurora PostgreSQL that handles inventory, orders, and customer data.
+ **[Monitoring and observability](https://github.com/aws-samples/sample-aws-database-cookbook/tree/main/4_Operational_Excellence_Best_Practices_for_Aurora)** – Set up performance tracking and configure alerts to identify potential database issues before they impact your applications.
+ **[Scaling with Amazon Aurora](https://github.com/aws-samples/sample-aws-database-cookbook/tree/main/5_Scaling_for_Success_Growing_with_Aurora)** – Learn to build resilient multi-Region deployments with Aurora DSQL, and how to scale your databases up for more processing power or out across multiple instances for greater capacity.
+ **[Optimization performance and cost](https://github.com/aws-samples/sample-aws-database-cookbook/tree/main/6_Optimizing_Performance_and_Cost)** – Optimize your database performance and reduce costs with proven tuning strategies.
+ **[Journey to Amazon purpose-built databases](https://github.com/aws-samples/sample-aws-database-cookbook/tree/main/7_Break_Free_from_Everything_in_One_Database_Trap_A_Journey_to_Purpose_Built_AWS_Databases)** – Build a secure, reliable infrastructure that scales your generative AI solutions and data-driven applications from prototype to enterprise deployment.
+ **[GenAI applications with RAG](https://github.com/aws-samples/sample-aws-database-cookbook/tree/main/8_Building_Your_First_GenAI_Application_with_AWS_Data_Foundations)** – Build an intelligent search system for insurance and healthcare documents that uses Retrieval Augmented Generation (RAG) to deliver accurate, context-aware results.

## Amazon workshop and lab content portal for Amazon RDS PostgreSQL
<a name="CHAP_Tutorials_postgreslabs"></a>

The following collection of workshops and other hands-on content helps you to gain an understanding of the Amazon RDS PostgreSQL features and capabilities: 
+ [ Creating a DB instance ](https://catalog.us-east-1.prod.workshops.aws/workshops/2a5fc82d-2b5f-4105-83c2-91a1b4d7abfe/en-US/2-foundation/lab1-create/task1)

  Learn how to create the DB instance.
+ [ Performance Monitoring with RDS Tools ](https://catalog.us-east-1.prod.workshops.aws/workshops/31babd91-aa9a-4415-8ebf-ce0a6556a216/en-US/)

  Learn how to use Amazon and SQL tools(Cloudwatch, Enhanced Monitoring, Slow Query Logs, Performance Insights, PostgreSQL Catalog Views) to understand performance issues and identify ways to improve performance of your database.

## Amazon workshop and lab content portal for Amazon RDS MySQL
<a name="CHAP_Tutorials_sqllabs"></a>

The following collection of workshops and other hands-on content helps you to gain an understanding of the Amazon RDS MySQL features and capabilities: 
+ [ Creating a DB instance ](https://catalog.us-east-1.prod.workshops.aws/workshops/0135d1da-9f07-470c-9845-44ead3c78212/en-US/lab3/task1)

  Learn how to create the DB instance.
+ [ Using Performance Insights ](https://catalog.us-east-1.prod.workshops.aws/workshops/0135d1da-9f07-470c-9845-44ead3c78212/en-US/lab8)

  Learn how to monitor and tune your DB instance using Performance insights.

## Using this service with an Amazon SDK
<a name="sdk-general-information-section"></a>

Amazon software development kits (SDKs) are available for many popular programming languages. Each SDK provides an API, code examples, and documentation that make it easier for developers to build applications in their preferred language.


| SDK documentation | 
| --- | 
| [Amazon CLI](https://docs.amazonaws.cn/cli) | 
| [Amazon SDK for Java](https://docs.amazonaws.cn/sdk-for-java) | 
| [Amazon SDK for JavaScript](https://docs.amazonaws.cn/sdk-for-javascript) | 
| [Amazon SDK for .NET](https://docs.amazonaws.cn/sdk-for-net) | 
| [Amazon SDK for PHP](https://docs.amazonaws.cn/sdk-for-php) | 
| [Amazon Tools for PowerShell](https://docs.amazonaws.cn/powershell) | 
| [Amazon SDK for Python (Boto3)](https://docs.amazonaws.cn/pythonsdk) | 
| [Amazon SDK for Ruby](https://docs.amazonaws.cn/sdk-for-ruby) | 
| [Amazon SDK for SAP ABAP](https://docs.amazonaws.cn/sdk-for-sapabap) | 

For examples specific to this service, see [Code examples for Amazon RDS using Amazon SDKs](service_code_examples.md).