Code Monkey home page Code Monkey logo

Comments (5)

neilkuan avatar neilkuan commented on July 18, 2024

Hi @benliger1987 , you can use this way ~

const runner = new GitlabContainerRunner(this, 'GitlabContainerRunner', {
      selfvpc: vpc,
      gitlabtoken: '',
    });

    defaultSecurityGroup.addIngressRule(
      ec2.Peer.securityGroupId(runner.defaultRunnerSG.securityGroupId),
      ec2.Port.tcp(5432),
      'Opening RDS to Lambda',
    );

from cdk-gitlab-runner.

benliger1987 avatar benliger1987 commented on July 18, 2024

That didn't seem to do it unfortunately, I can see the above code has created an inbound rule:

Screenshot 2022-10-07 170139

However I am still not able to connect to the instance...

from cdk-gitlab-runner.

neilkuan avatar neilkuan commented on July 18, 2024

I don't know what is going on at your env.
But I can use this example code to create gitlab runner and connect to rds.

const vpc = new ec2.Vpc(this, 'VPC', {
      cidr: '10.0.0.0/20',
      natGateways: 1,
      maxAzs: 2,
      enableDnsHostnames: true,
      enableDnsSupport: true,
      subnetConfiguration: [
        {
          cidrMask: 22,
          name: 'public',
          subnetType: ec2.SubnetType.PUBLIC,
        },
        {
          cidrMask: 22,
          name: 'private',
          subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
        },
      ],
    });

    // my sg
    const defaultSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(
      this,
      'SG',
      vpc.vpcDefaultSecurityGroup,
    );

    defaultSecurityGroup.addIngressRule(
      ec2.Peer.securityGroupId(defaultSecurityGroup.securityGroupId),
      ec2.Port.tcp(5432),
      'Opening RDS to Lambda',
    );

    const runner = new GitlabContainerRunner(this, 'GitlabContainerRunner', {
      selfvpc: vpc,
      gitlabtoken: '',
      vpcSubnet: {
        subnetType: aws_ec2.SubnetType.PRIVATE_WITH_EGRESS,
      },
    });

    defaultSecurityGroup.addIngressRule(
      ec2.Peer.securityGroupId(runner.defaultRunnerSG.securityGroupId),
      ec2.Port.tcp(5432),
      'Opening RDS to Lambda',
    );
    new rds.DatabaseCluster(
      this,
      'Cluster',
      {
        engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
        parameterGroup: rds.ParameterGroup.fromParameterGroupName(
          this,
          'ParameterGroup',
          'default.aurora-postgresql13',
        ),
        instanceProps: {
          vpc,
          vpcSubnets: vpc.selectSubnets({
            subnetType: ec2.SubnetType.PUBLIC,
          }),
          instanceType: ec2.InstanceType.of(
            ec2.InstanceClass.T3,
            ec2.InstanceSize.MEDIUM,
          ),
          securityGroups: [defaultSecurityGroup],
        },
        instances: 1,
        storageEncrypted: true,
        credentials: {
          username: 'pgadmin',
          password: SecretValue.unsafePlainText('123456wsxedc'),
        },
      },
    );

from cdk-gitlab-runner.

benliger1987 avatar benliger1987 commented on July 18, 2024

Its strange, I have replicated your implementation in my code and can not get it to work

from cdk-gitlab-runner.

neilkuan avatar neilkuan commented on July 18, 2024

I think this is just a single case, so please allow me to close this issue.

from cdk-gitlab-runner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.