Set Up a CI/CD Pipeline on AWS

--Resource --

Steps


    1) Create a project in eclipse

    2) Create a repository in CODE COMMIT (copy https address)

    3) Goto eclipse and Clone a repository

    4) Create IAM user for HTTPS Git Credentials for AWS CodeCommit

    5) Copy paste the user and passwrod in the eclipse clone repository window

    6) Right click on the project Team -> Share project -> Select repository

    7) Goto ECR and create repository & copy the ARN link 

    8) Goto buildspec file of project

        set region, root directory name, give ARN link from step 7

        container and app names

    9) Goto docker file and give app jar filename
    
    10) Right click on the project Team -> Commit
    
        Add these to staging area
        src/main/java
        src/main/resources
        pom.xml
        buildspec.yml
        Dockfile
    
        give appropriate commit message and commit&push changes
    
    11) Goto EC2 -> Target Groups -> Ceate a target group
    
        Then Associate with new / existing load balancer

        If need create one new load balancer
    
    12) Goto ECS -> Create a cluster

    13) Goto Task definition of cluster -> Create new task definition

        *In the add container section give the container name and image field value
        that mentioned in that buildspec file.

        provide app port number. 

    14) Goto Servie section of cluster -> Create new service

        *Number of tasks must greatherthan 1

        *Load balancing type - Application Load Balancer

        *Add to load baalncer BUTTON -> evaluation order -> 2
    
    15) Goto Codepipeline -> Create new pipeline

        *Source provider - AWS CodeCommit

        *Change detection option - AWS CodePipeline

        *Build provider AWS Code build

        *Buildspec  -> Project-folder-name / buildspec.yml

        *copy project role name

        *image definition file ->  Project-folder-name / taskdefinitions.json
    
    16) Goto IAM roles

        search with the project role name

        click on attach policies

        Attach AmazoneEC2ContainerRegistryFullAccess
    
    17) Goto step 15 and try build again

    18) Goto EC2 -> Load balancer -> open your laod balancer
    
        Copy the DNS url and past in browser