createConnection
Creates a connection to a data source, such as an AWS Glue Data Catalog, an Amazon Bedrock knowledge base, or a third-party data catalog through an AWS Glue connection. GetConnection returns the connection's status.
Samples
// The following example creates a connection to the sales_db database in the AWS Glue Data Catalog of
// account 111122223333, with a role that AWS Context assumes to read the catalog and a role that the data
// producer assumes to push data. An AWS Glue Data Catalog connection is ACTIVE as soon as CreateConnection
// returns.
val resp = contextClient.createConnection {
name = "sales-analytics"
dataSource = DataSourceReference {
type = ConnectionType.fromValue("GLUE_DATA_CATALOG")
location = DataSourceLocation {
arn = "arn:aws:glue:us-east-1:111122223333:catalog"
}
}
scope = DataSourceScope {
selectors = listOf<ResourceSelector>(
ResourceSelector {
path = listOf<PathSegment>(
PathSegment {
level = "glueCatalog"
id = "arn:aws:glue:us-east-1:111122223333:catalog"
},
PathSegment {
level = "glueDatabase"
id = "sales_db"
}
)
}
)
}
accessConfig = AccessConfig.IamRole(IamRoleAccess {
roleArn = "arn:aws:iam::111122223333:role/ContextGlueReadRole"
}
)
ingestionConfig = IngestionConfig {
roleArn = "arn:aws:iam::111122223333:role/ContextIngestionRole"
}
tags = mapOf<String, String>(
"team" to "sales-analytics"
)
}Content copied to clipboard