Closed sklirg closed 1 year ago
I patched our teleport installation with:
diff --git a/lib/srv/db/cloud/watchers/rds.go b/lib/srv/db/cloud/watchers/rds.go
index 4a1e6f16c..30a113a46 100644
--- a/lib/srv/db/cloud/watchers/rds.go
+++ b/lib/srv/db/cloud/watchers/rds.go
@@ -272,7 +272,6 @@ func auroraFilters() []*rds.Filter {
return []*rds.Filter{{
Name: aws.String("engine"),
Values: aws.StringSlice([]string{
- services.RDSEngineAurora,
services.RDSEngineAuroraMySQL,
services.RDSEngineAuroraPostgres}),
}}
to resolve this error. I don't think this is a perfect fix as "aurora" seems to be a valid engine in other AWS regions than the one we use.
One possible workaround could be to do a check of valid engines through describe-db-engine-versions
, and only include the ones matching what's listed in services.RDSEngineAurora*
when querying for the databases. This incurs another API request per database request/poll, though. Maybe it could be kept in memory to avoid the extra request for every poll.
aws rds describe-db-clusters --filters Name=engine,Values=aurora
An error occurred (InvalidParameterValue) when calling the DescribeDBClusters operation: Unrecognized engine name: aurora
I can't reproduce this with any region, including --region=eu-north-1
.
I have a branch that queries DescribeDBEngineVersions
so we only include available engines. The unfortunate thing is that this requires multiple calls (or I can switch to the paginated version), because it returns ~270 engine versions in us-west-1, 100 results max in each response - I haven't checked other regions. I don't think I can filter for just the engines we care about because that could lead to the same problem you had in the first place. I think we'll need to cache this result.
Note that "aurora" corresponds to MySQL 5.6, which reaches end of life in February 2023: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.MySQL56.EOL.html
I see the same behaviour now. Previously, as described, this would result in an API response returning an error. However, now, it instead returns an empty list:
❯ aws rds describe-db-clusters --filters Name=engine,Values=aurora
{
"DBClusters": []
}
A non-existing engine still returns an error:
❯ aws rds describe-db-clusters --filters Name=engine,Values=not-a-valid-engine
An error occurred (InvalidParameterValue) when calling the DescribeDBClusters operation: Unrecognized engine name: not-a-valid-engine
I think it would make sense to implement the change you're talking about, but consider if it could be conditionally enabled.
The cases where it would make sense to enable it would be e.g.: 1) in configuration 2) based on if the API request fails initially or not (i.e. if the API request fails (with an invalid engine), then switch to listing all and then filtering for the wanted ones). This would do "the best of both worlds", but it would increase (code) complexity.
The fact that this effectively stopped RDS discovery from working at all made Teleport unusable for us for multiple hours until we were able to figure out why, patch it, and build & deploy a patched version.
I think falling back to listing engines when the API request fails is probably the best approach here and doesn't introduce lots of extra API calls into the happy path of the code. Will get a fix for this in soon
Getting the same error on v12
, is it merged in the latest version?
@rahulinux Yes, This has been released in 11.1.0 and any v12 version should contains this fix.
Getting the same error on v12
Could you post your stack trace ? Also are you sure that you have updated teleport db agent ?
@smallinsky @GavinFrazar Hi, the same error here at version 12.1.5
2023-04-04T18:08:32Z WARN [WATCH:AUR] Teleport supports an engine which is unrecognized in this AWS region. Querying engines individually. error:[
ERROR REPORT:
Original Error: *awserr.requestError InvalidParameterValue: Unrecognized engine name: aurora
status code: 400, request id: **
Stack Trace:
github.com/gravitational/teleport/lib/srv/discovery/fetchers/db/aws_rds.go:282 github.com/gravitational/teleport/lib/srv/discovery/fetchers/db.getAllDBClusters.func1
github.com/gravitational/teleport/lib/srv/discovery/fetchers/db/aws_rds.go:330 github.com/gravitational/teleport/lib/srv/discovery/fetchers/db.retryWithIndividualEngineFilters
github.com/gravitational/teleport/lib/srv/discovery/fetchers/db/aws_rds.go:268 github.com/gravitational/teleport/lib/srv/discovery/fetchers/db.getAllDBClusters
github.com/gravitational/teleport/lib/srv/discovery/fetchers/db/aws_rds.go:191 github.com/gravitational/teleport/lib/srv/discovery/fetchers/db.(*rdsAuroraClustersFetcher).getAuroraDatabases
github.com/gravitational/teleport/lib/srv/discovery/fetchers/db/aws_rds.go:181 github.com/gravitational/teleport/lib/srv/discovery/fetchers/db.(*rdsAuroraClustersFetcher).Get
github.com/gravitational/teleport/lib/srv/discovery/common/watcher.go:116 github.com/gravitational/teleport/lib/srv/discovery/common.(*Watcher).fetchAndSend.func1
golang.org/x/sync@v0.1.0/errgroup/errgroup.go:75 golang.org/x/sync/errgroup.(*Group).Go.func1
runtime/asm_amd64.s:1598 runtime.goexit
User Message: InvalidParameterValue: Unrecognized engine name: aurora
status code: 400, request id: **] labels:map[*:[*]] region:eu-central-1 db/aws_rds.go:337
Helm chart: https://github.com/gravitational/teleport/tree/master/examples/chart/teleport-kube-agent
awsDatabases:
- types: ["rds"]
regions: ["eu-central-1"]
tags:
"*": "*"
@DanyloMikula
Hi, that is a warning logged when the database service falls back to querying each engine type individually, but it should continue to look for engines: aurora
, aurora-mysql
, aurora-postgresql
, and then ignores and skips the error when it fails for the unrecognized engine aurora
.
Are you not seeing any discovered databases?
@DanyloMikula Hi, that is a warning logged when the database service falls back to querying each engine type individually, but it should continue to look for engines:
aurora
,aurora-mysql
,aurora-postgresql
, and then ignores and skips the error when it fails for the unrecognized engineaurora
.Are you not seeing any discovered databases?
Thanks for the answer, no, there are no problems with database discovery, but these error logs every few minutes are quite annoying, is there any solution, to turn off other database discovery, except those that are configured in agent settings?
There's no setting, we group all 3 engines as one. @smallinsky should we just move this log message to debug level instead of warning, and only warn if the individual engine retries all fail?
@GavinFrazar @smallinsky this error generates support load, so we should fix the error message to debug. Reopening to take care of this.
Expected behavior:
Starting a Teleport Node which runs the
db_service
for AWS RDS Discovery should work and find databases.Current behavior:
Starting a Teleport Node with
db_service
prints a stack trace on boot saying:Bug details:
db_service
:debug logs
Note that there is an IAM "not allowed" in the debug logs because we don't allow Teleport to describe DB Instances, but it does have permission to describe DB Clusters.
I think this might be because the filter query tries using the value
aurora
for engine value, which fails in the AWS CLI as well:In the same way as a non-existing engine fails:
But for example
Values=aurora-postgresql
works fine.This "aurora" value comes from here: https://github.com/gravitational/teleport/blob/master/lib/services/database.go#L1009, and it might be something AWS has recently removed?
EDIT: Related to the previous statement, the following API query does not list "aurora" as a DB engine:
EDIT2: This seems to be specific to some regions... e.g.
eu-north-1
.