小编tro*_*r31的帖子

CDK 为 VPCPeering 启用 DNS 解析

我通过 VPC 对等连接将一个 aws 账户中的 lambda 连接到另一个 aws 账户中的 RDS 实例。这工作正常,但需要 VPC 对等互连启用 DNS 解析选项。

默认情况下,DNS 解析设置为:从接受方 VPC 到私有 IP 的 DNS 解析:禁用。

这可以通过 AWS 控制台和 CLI 来完成。我无法使用 AWS CDK 实现相同的目标。
https://docs.aws.amazon.com/vpc/latest/peering/modify-peering-connections.html

CfnVPCPeeringConnection 似乎没有这个选项。 https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.CfnVPCPeeringConnection.html

有没有其他方法可以通过 CDK 实现这一目标?

  const cfnVPCPeeringConnection :CfnVPCPeeringConnection  =
    new CfnVPCPeeringConnection(
        stack,
        "vpcPeeringId",
        {
            peerVpcId : "<vpcId of acceptor account>",
            vpcId :  "<reference of the Id>",
            peerOwnerId : "<aws acc number>",
            peerRegion : "<region>",
            peerRoleArn :"<arn created in the acceptor account>"",
        }
    );
    
    //update route tables
    rdsConnectorVpc.isolatedSubnets.forEach(({ …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-vpc aws-cdk

9
推荐指数
1
解决办法
1628
查看次数

wildfly注册mysql作为数据源

我一直在尝试将mysql配置为wildfly中的数据源.我不确定我错过了什么,我在启动时收到错误.

我有mysql-connector-java-5.0.8-bin.jar和文件夹中的module.xml:"/ wildfly-8.1.0.Final/modules/system/layers/base/com/mysql/main"

以下是文件

module.xml

    <module xmlns="urn:jboss:module:1.1" 
        name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-5.0.8.jar"/>
        <!-- Insert resources here -->
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="javax.servlet.api" optional="true"/>
    </dependencies>
</module>
Run Code Online (Sandbox Code Playgroud)

standalone.xml

  <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
    <driver>h2</driver>
    <security>
      <user-name>sa</user-name>
      <password>sa</password>
    </security>
  </datasource>
  <datasource jta="true" jndi-name="java:jboss/datasources/proj" pool-name="proj" enabled="true" use-java-context="true" use-ccm="true">
    <connection-url>jdbc:mysql://localhost:3306</connection-url>
    <driver>mysql</driver>
    <security>
      <user-name>root</user-name>
      <password>admin123</password>
    </security>
    <statement>
      <prepared-statement-cache-size>32</prepared-statement-cache-size>
      <share-prepared-statements>true</share-prepared-statements>
    </statement>
  </datasource>
  <drivers>
    <driver name="mysql" module="com.mysql">
      <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
    </driver>
    <driver name="h2" module="com.h2database.h2">
      <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
    </driver>
  </drivers>
</datasources>
Run Code Online (Sandbox Code Playgroud)

我已经在eclipse中使用独立程序测试了jdbc连接,但它确实有效

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException; …
Run Code Online (Sandbox Code Playgroud)

mysql wildfly-8

3
推荐指数
1
解决办法
4万
查看次数