DEV Community

ashutosh049
ashutosh049

Posted on

3 3

Spring cloud-config-server Git-Backend on AWS ECS

So far I'm able to pull the config-repo files from gitlab using simple username/password in my local system and it works well. Now I'm moving stuffs to AWS-ECS(Fargate).

native profile works well, but I want to use git-uri and for that I must provide credentials to connect.

    spring:
      profiles: dev

Top comments (1)

Collapse
 
ashutosh049 profile image
ashutosh049

I am able to resolve this.

  1. Create a new Policy named GetParameters and attach it to current task role.

  2. IAM -> create policy -> select 'System Manager' as service -> 'GetParameters' as Action(read type only) -> all Resources and create policy.

  3. Go to Systems Manager -> Parameter Store for storing sensitive details as SecureString.

  4. Go to Task -> Container Definitions -> Environment Variables: provide

The value should be in the form for arn:aws:ssm:::parameter/name

GITLAB_USERNAME, ValueFrom , arn:aws:ssm:::parameter/dev/my-config-server/GITLAB_USERNAME
GITLAB_PASSWORD, ValueFrom , arn:aws:ssm:::parameter/dev/my-config-server/GITLAB_PASSWORD
As per convention Name should be in the form of ///

And that's it. You are done. Wait for task to be provisioned and config-server would be able to connect to your remote repo.

    spring:
      profiles: dev
      cloud:
        config:
          server:
              git:
                uri: https://gitlab.com/<group>/<project>.git
                clone-on-start: true
                default-label: gitlabci-test
                searchPaths: '{profile}'
                username: ${GITLAB_USERNAME}
                password: ${GITLAB_PASSWORD}
👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay