gpt4 book ai didi

amazon-web-services - 创建 CloudFormation 模板以创建多个 Glue 连接

转载 作者:行者123 更新时间:2023-12-03 07:29:20 26 4
gpt4 key购买 nike

我正在尝试使用 Cloud Formation 模板创建四个 Glue 连接。

理想情况下,模板应创建所有四个连接,如果我愿意,我可以添加更多连接。我尝试过使用多种资源,但不起作用。

但是下面的代码仅为最后一个连接创建连接。这是我的代码:

AWSTemplateFormatVersion: 2010-09-09
Description: Glue Connection
Parameters:
VpcId:
Description: VPC-ID
Type: 'AWS::EC2::VPC::Id'
Default: vpc-xxxxxxxxx
SecurityGroup:
Description: SG-ID
Type: 'AWS::EC2::SecurityGroup::Id'
Default: sg-xxxxxxxxx
SubnetRESA1:
Type: String
Description: Public Subnet
Default: subnet-xxxxxxxxx
Resources:
GC31IPP:
Type: 'AWS::Glue::Connection'
Properties:
CatalogId: 'a/c_number'
ConnectionInput:
ConnectionProperties:
Name: GENERIC_CONNECTION
Type: Network
ConnectionType: NETWORK
Description: >-
Adding a Generic connection with VPC, Subnet and Security Group to
access SAP and other DBs
Name: GENERIC_CONNECTION
PhysicalConnectionRequirements:
AvailabilityZone: us-east-1a
SecurityGroupIdList:
- sg-xxxxxxxxx
SubnetId: subnet-xxxxxxxxx
ConnectionInput:
ConnectionProperties:
Name: MySQL_CONNECTION
Type: JDBC
JDBC_CONNECTION_URL: "jdbc:mysql://host-url:3306/db"
USERNAME: "user"
PASSWORD: "pass"
ConnectionType: JDBC
Description: >-
MySQL connection to POS DB
Name: MySQL_CONNECTION
PhysicalConnectionRequirements:
AvailabilityZone: us-east-1a
SecurityGroupIdList:
- sg-xxxxxxxxx
SubnetId: subnet-xxxxxxxxx
ConnectionInput:
ConnectionProperties:
Name: SAP_ECC_CONNECTION_Pre-ProdEnv
Type: JDBC
JDBC_CONNECTION_URL: "jdbc:sap://host-url:31015/?instanceNumber=10&databaseName=db_name"
USERNAME: "user"
PASSWORD: "pass"
ConnectionType: JDBC
Description: >-
SAP ECC Pre Prod connection
Name: SAP_ECC_CONNECTION_Pre-ProdEnv
PhysicalConnectionRequirements:
AvailabilityZone: us-east-1a
SecurityGroupIdList:
- sg-xxxxxxxxx
SubnetId: subnet-xxxxxxxxx
ConnectionInput:
ConnectionProperties:
Name: SAP_QAL_CONNECTION_QAEnv
Type: JDBC
JDBC_CONNECTION_URL: "jdbc:sap://host-url:32015/?instanceNumber=20&databaseName=db_name"
USERNAME: "seru"
PASSWORD: "pass"
ConnectionType: JDBC
Description: >-
SAP ECC Pre Prod connection
Name: SAP_QAL_CONNECTION_QAEnv
PhysicalConnectionRequirements:
AvailabilityZone: us-east-1a
SecurityGroupIdList:
- sg-xxxxxxxxx
SubnetId: subnet-xxxxxxxxx

上述模板仅创建一个连接,即最后一个连接。命名为:SAP_QAL_CONNECTION_QAEnv

如何将它们全部添加到一个脚本中?

最佳答案

这是因为单个 AWS::Glue::Connection 创建一个连接。要创建四个,您需要四个 AWS::Glue::Connection 资源。

您需要根据您的设置进行调整的说明性示例:

  GC31IPP-Connection1:
Type: 'AWS::Glue::Connection'
Properties:
CatalogId: 'a/c_number'
ConnectionInput:
ConnectionProperties:
Name: GENERIC_CONNECTION
Type: Network


GC31IPP-Connection2:
Type: 'AWS::Glue::Connection'
Properties:
CatalogId: 'a/c_number'
ConnectionInput:
ConnectionProperties:
Name: GENERIC_CONNECTION
Type: Network

GC31IPP-Connection3:
Type: 'AWS::Glue::Connection'
Properties:
CatalogId: 'a/c_number'
ConnectionInput:
ConnectionProperties:
Name: GENERIC_CONNECTION
Type: Network

GC31IPP-Connection4:
Type: 'AWS::Glue::Connection'
Properties:
CatalogId: 'a/c_number'
ConnectionInput:
ConnectionProperties:
Name: GENERIC_CONNECTION
Type: Network

关于amazon-web-services - 创建 CloudFormation 模板以创建多个 Glue 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65726201/

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