https://github.com/shogo82148/rdsmysql
The rdsmysql package is a SQL driver for Amazon RDS.
https://github.com/shogo82148/rdsmysql
amazon-rds golang sql-driver
Last synced: 5 months ago
JSON representation
The rdsmysql package is a SQL driver for Amazon RDS.
- Host: GitHub
- URL: https://github.com/shogo82148/rdsmysql
- Owner: shogo82148
- License: mit
- Created: 2018-04-06T13:27:10.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2026-01-27T02:01:31.000Z (6 months ago)
- Last Synced: 2026-01-30T11:10:48.735Z (6 months ago)
- Topics: amazon-rds, golang, sql-driver
- Language: Go
- Homepage:
- Size: 763 KB
- Stars: 9
- Watchers: 1
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/shogo82148/rdsmysql)
[](https://pkg.go.dev/github.com/shogo82148/rdsmysql/v2)
# rdsmysql
The rdsmysql package is a SQL driver that allows IAM Database Authentication for Amazon RDS and Amazon Aurora.
It also supports connecting to the RDS proxy using IAM authentication.
- [IAM Database Authentication for MySQL and PostgreSQL - Amazon Relational Database Service](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html)
- [IAM Database Authentication - Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.IAMDBAuth.html)
- [Managing connections with Amazon RDS Proxy - Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/rds-proxy.html#rds-proxy-connecting-iam)
rdsmysql v2 works with [AWS SDK for Go v2](https://github.com/aws/aws-sdk-go-v2):
```go
import (
"context"
"database/sql"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/go-sql-driver/mysql"
"github.com/shogo82148/rdsmysql/v2"
)
func main() {
// configure AWS SDK
awsConfig, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("ap-northeast-1"))
if err != nil {
panic(err)
}
// configure the connector
mysqlConfig, err := mysql.ParseDSN("user:@tcp(db-foobar.ap-northeast-1.rds.amazonaws.com:3306)/")
if err != nil {
panic(err)
}
connector := &rdsmysql.Connector{
AWSConfig: awsConfig,
MySQLConfig: mysqlConfig,
}
// open the database
db := sql.OpenDB(connector)
defer db.Close()
// ... do something using db ...
}
```
If you use [AWS SDK for Go v1](https://github.com/aws/aws-sdk-go), use [rdsmysql v1](https://pkg.go.dev/github.com/shogo82148/rdsmysql).
## Related Posts
- [How do I connect to my Amazon RDS MySQL DB instance or Aurora MySQL DB cluster using Amazon RDS Proxy?](https://aws.amazon.com/premiumsupport/knowledge-center/rds-aurora-mysql-connect-proxy/)
- [How do I allow users to authenticate to an Amazon RDS MySQL DB instance using their IAM credentials?](https://aws.amazon.com/premiumsupport/knowledge-center/users-connect-rds-iam/)