Privately access code commit repo

0

Hi all,

I have a scenario where I want to let the user to only access Code Commit repo privately. So i configured a VPC, VPN, Code Commit VPC Endpoint that are within the private subnet of the VPC, and Code Commit repo.

My plan is to have the user connected to the VPN connection into my VPC only then they can do their work with the Code Commit (git push etc.).

When i tested this setup I am still able to access the repo when i am not connected to the VPN at all.

What is the main problem in my setup? Is it possible to do this?

demandé il y a un mois246 vues
2 réponses
1
Réponse acceptée

Hello.

Try adding the following policy to the IAM user's policy.
If you add this, you will not be able to access CodeCommit unless you go through the VPC endpoint.

{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Effect": "Allow",
          "Action": [
              "codecommit:*"
          ],
          "Resource": [
              "*"
          ],
          "Condition": {
              "StringEquals": {
                  "aws:sourceVpce": [
                      "VPC EndPoint ID"
                  ]
              }
          }
      }
  ]
}
profile picture
EXPERT
répondu il y a un mois
profile picture
EXPERT
vérifié il y a un mois
profile picture
EXPERT
vérifié il y a un mois
profile picture
EXPERT
vérifié il y a un mois
0

Apart finding a proper resource policy, you could use security groups on the vpc interface endpoint and whitelist only IPs you need.

profile picture
EXPERT
répondu il y a un mois
profile picture
EXPERT
vérifié il y a un mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions