Documentation
¶
Overview ¶
Package rdsmysql is a MySQL SQL driver that allows IAM Database Authentication for Amazon RDS and IAM Database Authentication for Amazon Aurora. It also supports connecting with the RDS proxy using IAM authentication.
Index ¶
Examples ¶
Constants ¶
View Source
const Certificates = rdsCertificates
Certificates is the certificates for connecting RDS MySQL with SSL/TLS. It contains the intermediate and root certificates for Amazon RDS MySQL and Amazon Aurora MySQL.
Variables ¶
View Source
var TLSConfig *tls.Config
TLSConfig is the tls.TLSConfig for connecting RDS MySQL with SSL/TLS.
Functions ¶
Types ¶
type Connector ¶
type Connector struct {
// AWSConfig is AWS Config.
AWSConfig aws.Config
// MySQLConfig is a configure for connecting to MySQL servers.
MySQLConfig *mysql.Config
// MaxConnsPerSecond is a limit for creating new connections.
// Zero means no limit.
MaxConnsPerSecond int
// contains filtered or unexported fields
}
Connector is a MySQL connector using IAM DB Auth. It implements database/sql/driver.Connector.
Example ¶
// 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 ...
type Driver ¶
Driver is a MySQL driver using IAM DB Auth.
Example ¶
// configure AWS SDK
awsConfig, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("ap-northeast-1"))
if err != nil {
panic(err)
}
driver := &rdsmysql.Driver{
AWSConfig: awsConfig,
}
sql.Register("rdsmysql", driver)
db, err := sql.Open("rdsmysql", "user:@tcp(db-foobar.ap-northeast-1.rds.amazonaws.com:3306)/")
if err != nil {
panic(err)
}
defer db.Close()
// ... do something using db ...
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
rdsmysql
command
|
|
|
rdsmysqldump
command
|
|
|
internal
|
|
|
cmd/update_certificate
command
|
|
Click to show internal directories.
Click to hide internal directories.