1

I've setup own gitlab server on AWS EC2 Instance based on this image - https://aws.amazon.com/marketplace/pp/prodview-w6ykryurkesjq?ref_=aws-mp-console-subscription-detail and assign Elastic IP for this instance.

I've prepared some pipeline for repository and getting error (after push and check pipeline status):

Running with gitlab-runner 14.3.2 (e0218c92)
  on [PRIVATE IP ADDRESS] JA-qzGJG
Preparing the "docker" executor
Using Docker executor with image node:latest ...
Pulling docker image node:latest ...
Using docker image sha256:c4fbd63932640bbb14c76f80c5b53daf8f01cc1f011d260d07f35bb6874c0c30 for node:latest with digest node@sha256:fec9ab31c9d46ad952abed8119b71e01e995975bd7b580f07b249e803d306dbe ...
Preparing environment
00:02
Running on [RUNNER_NAME] via [PRIVATE IP ADDRESS]...
Getting source from Git repository
02:11
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/logifiles/queue/.git/
fatal: unable to access 'http://ec2-[OLD_EC2_INSTANCE_IP_ADDRESS].compute-1.amazonaws.com/logifiles/queue.git/': Failed to connect to ec2-[OLD_EC2_INSTANCE_IP_ADDRESS].compute-1.amazonaws.com port 80 after 129988 ms: Operation timed out
ERROR: Job failed: exit code 1

I remove IP addreses, due security reasons. My pipelines for repository:

image: node:latest
cache:
  paths:
    - node_modules/
stages:
  - dist
before_script:
  - npm i
dist:
  stage: dist
  script:
    - echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}">.npmrc
    - npm publish
  rules:
    - if: $CI_COMMIT_BRANCH == "master"

So how should i properly handle it ? How to change IP address in pipeline or set different url for gitlab, or maybe prepare some redirect from old ec2 instance domain to new one (from Elastic IP). Is there any other way how can i handle it ?

Edit 1

This is security group for inbound rules for ec2 instance: enter image description here

1 Answer 1

0

A few things here...

  1. Removing an IP address has nothing to do with security. Every hacker tool on the planet will happily enumerate IPs whether or not you give them out. So, you can leave the IP there and do the right thing security wise.
  2. So, per the above, host everything with https:// and proper user-name/password/api token/etc auth.
  3. Allowing "all of internet" inbound is a bad idea in most cases.
  4. If the main thing talking to your instance is another EC2, you can have a security group for each EC2 and you an reference one security group in the other one (rather than a specific IP). This is safer and lets you forget about the IP addresses themselves as the security group linking will still work fine even if the IPs change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.