gpt4 book ai didi

amazon-web-services - 胶水连接无法通过 cloudformation 工作。它给出错误: Unable to resolve any valid connection

转载 作者:行者123 更新时间:2023-12-03 07:15:01 34 4
gpt4 key购买 nike

我通过cloudformation创建的粘合连接不起作用,而如果通过控制台创建具有相同配置的粘合连接,则它工作得很好。请找到相同的代码:

Resources:
Policy1:
Type: AWS::IAM::ManagedPolicy
Properties:
Description: Policy for glue
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action: '*'
Resource: '*'
Role1:
Type: AWS::IAM::Role
DependsOn: Policy1
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- glue.amazonaws.com
- rds.amazonaws.com
Action:
- 'sts:AssumeRole'
ManagedPolicyArns:
- !Ref Policy1
GlueConnection:
Type: AWS::Glue::Connection
Properties:
CatalogId: !Ref AWS::AccountId
ConnectionInput:
ConnectionProperties:
JDBC_CONNECTION_URL: "jdbc:mysql://database-2.cxs4adwnjt5i.ap-south-1.rds.amazonaws.com:3306/mydb"
USERNAME: "admin"
PASSWORD: "Admin123"
JDBC_ENFORCE_SSL: False
ConnectionType: JDBC
PhysicalConnectionRequirements:
SecurityGroupIdList:
- sg-065781f0ee39344fa
SubnetId: subnet-0cdac25848264fdb8
Name: rds-1
GlueDatabase:
Type: AWS::Glue::Database
Properties:
CatalogId: !Ref AWS::AccountId
DatabaseInput:
Name: my-rds-glue-1

最佳答案

要解决此问题,您需要将 AvailabilityZone 包含在 PhysicalConnectionRequirements 中。

PhysicalConnectionRequirements:
AvailabilityZone: !Select [ 0, !GetAZs '' ]
SecurityGroupIdList:
- !Ref GlueSG
SubnetId: !Ref SubnetId

在此处查看更多详细信息: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-physicalconnectionrequirements.html

在这个问题得到解决之前,解决方法是,就像您提到的那样,进入控制台并编辑并保存连接。

关于amazon-web-services - 胶水连接无法通过 cloudformation 工作。它给出错误: Unable to resolve any valid connection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73968927/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com