RDS 代理目标组不可用
RDS Proxy Target groups Unavailable
我刚刚通过 Cloud Formation 创建了 RDS Proxy
在 Proxies 仪表板中,它显示 RDS 代理可用,但目标组不可用,我无法调试它并卡在 Cloud Formation 更新状态
这是我的云阵配置,
我对rds代理和rds实例都使用了all in-out绑定流量安全组,但是好像不行...
请问我配置有误吗?我已经坚持了一整天了
RDSInstance:
DependsOn: DBSecurityGroup
Type: AWS::RDS::DBInstance
Properties:
AllocatedStorage: '20'
AllowMajorVersionUpgrade: false
AutoMinorVersionUpgrade: true
AvailabilityZone: ${self:provider.region}a
DBInstanceClass: db.t2.micro
DBName: mydb
VPCSecurityGroups:
- "Fn::GetAtt": [ DBSecurityGroup, GroupId ]
Engine: postgres
EngineVersion: '11.9'
MasterUsername: postgres
MasterUserPassword: Fighting001
PubliclyAccessible: true
DBSubnetGroupName:
Ref: DBSubnetGroup
# VPCSecurityGroups:
# Ref: VPC
DBSecretsManager:
Type: AWS::SecretsManager::Secret
Properties:
Description: 'Secret Store for database connection'
Name: postgres
SecretString:
'password'
RDSProxy:
DependsOn: DBSecurityGroup
Type: AWS::RDS::DBProxy
Properties:
Auth:
- AuthScheme: SECRETS
SecretArn:
Ref: DBSecretsManager
IAMAuth: DISABLED
DBProxyName: ${self:provider.stackName}-db-proxy
DebugLogging: true
EngineFamily: 'POSTGRESQL'
RoleArn: 'my role arn'
VpcSecurityGroupIds:
- "Fn::GetAtt": [ DBSecurityGroup, GroupId ]
VpcSubnetIds:
- Ref: PublicSubnetA
- Ref: PublicSubnetB
RDSProxyTargetGroup:
Type: AWS::RDS::DBProxyTargetGroup
Properties:
DBProxyName:
Ref: RDSProxy
DBInstanceIdentifiers: [Ref: RDSInstance]
TargetGroupName: "default"
ConnectionPoolConfigurationInfo:
MaxConnectionsPercent: 45
MaxIdleConnectionsPercent: 40
ConnectionBorrowTimeout: 120
您的模板失败的一个可能原因是您的 AWS::SecretsManager::Secret
未被使用且值不正确。
您的数据库使用:
MasterUsername: postgres
MasterUserPassword: Fighting001
但是你的DBSecretsManager
是:
SecretString:
'password'
这是不正确的。我建议首先在 AWS 控制台中手动设置所有内容。然后你可以检查 use-case 的 SecretString
的 正确形式 是什么。
虽然这不是上述原始问题的原因,但它可能会帮助将来达到此 post 的人。
确保您的 RDS 实例和与其关联的安全组使用相同的端口。
我遇到了同样的结果,因为我的 RDS 安全组是使用与 RDS 实例不同的端口配置的。
默认情况下,Aurora Postgres 将使用端口 3306
,但我的安全组使用的是 5432
(因为它是从旧的 Postgres 非 Aurora RDS 实例复制的)。我通过指定解决此问题的 Port
属性 更新了我的 RDS 实例以使用端口 5432
。
我刚刚通过 Cloud Formation 创建了 RDS Proxy
在 Proxies 仪表板中,它显示 RDS 代理可用,但目标组不可用,我无法调试它并卡在 Cloud Formation 更新状态
这是我的云阵配置,
我对rds代理和rds实例都使用了all in-out绑定流量安全组,但是好像不行...
请问我配置有误吗?我已经坚持了一整天了
RDSInstance:
DependsOn: DBSecurityGroup
Type: AWS::RDS::DBInstance
Properties:
AllocatedStorage: '20'
AllowMajorVersionUpgrade: false
AutoMinorVersionUpgrade: true
AvailabilityZone: ${self:provider.region}a
DBInstanceClass: db.t2.micro
DBName: mydb
VPCSecurityGroups:
- "Fn::GetAtt": [ DBSecurityGroup, GroupId ]
Engine: postgres
EngineVersion: '11.9'
MasterUsername: postgres
MasterUserPassword: Fighting001
PubliclyAccessible: true
DBSubnetGroupName:
Ref: DBSubnetGroup
# VPCSecurityGroups:
# Ref: VPC
DBSecretsManager:
Type: AWS::SecretsManager::Secret
Properties:
Description: 'Secret Store for database connection'
Name: postgres
SecretString:
'password'
RDSProxy:
DependsOn: DBSecurityGroup
Type: AWS::RDS::DBProxy
Properties:
Auth:
- AuthScheme: SECRETS
SecretArn:
Ref: DBSecretsManager
IAMAuth: DISABLED
DBProxyName: ${self:provider.stackName}-db-proxy
DebugLogging: true
EngineFamily: 'POSTGRESQL'
RoleArn: 'my role arn'
VpcSecurityGroupIds:
- "Fn::GetAtt": [ DBSecurityGroup, GroupId ]
VpcSubnetIds:
- Ref: PublicSubnetA
- Ref: PublicSubnetB
RDSProxyTargetGroup:
Type: AWS::RDS::DBProxyTargetGroup
Properties:
DBProxyName:
Ref: RDSProxy
DBInstanceIdentifiers: [Ref: RDSInstance]
TargetGroupName: "default"
ConnectionPoolConfigurationInfo:
MaxConnectionsPercent: 45
MaxIdleConnectionsPercent: 40
ConnectionBorrowTimeout: 120
您的模板失败的一个可能原因是您的 AWS::SecretsManager::Secret
未被使用且值不正确。
您的数据库使用:
MasterUsername: postgres
MasterUserPassword: Fighting001
但是你的DBSecretsManager
是:
SecretString:
'password'
这是不正确的。我建议首先在 AWS 控制台中手动设置所有内容。然后你可以检查 use-case 的 SecretString
的 正确形式 是什么。
虽然这不是上述原始问题的原因,但它可能会帮助将来达到此 post 的人。
确保您的 RDS 实例和与其关联的安全组使用相同的端口。
我遇到了同样的结果,因为我的 RDS 安全组是使用与 RDS 实例不同的端口配置的。
默认情况下,Aurora Postgres 将使用端口 3306
,但我的安全组使用的是 5432
(因为它是从旧的 Postgres 非 Aurora RDS 实例复制的)。我通过指定解决此问题的 Port
属性 更新了我的 RDS 实例以使用端口 5432
。