CET-013

Task Summary

  • Create a Web API that List/save/get countries in/from DynamoDB using NodeJS and serverless framework Which is CloudFormation stack under the hood

🔷 Implementaion Guidea

  1. Create an EC2 Instance and install jenkins on it

  2. Create a Github Repo that contains your projectش

    Runway Repo

  3. Install needed plugins on Jenkins

  4. Add SSH credentials for Github

  5. Create a new Job on jenkins

  6. Specifiy the Github repo for this job aش Example: sourcecodeش س

  7. Check the build trigger for Github hookيs

    Example: build-trigger

  8. Add Github Credentials to Jenkins GLOBALLY

    Hint: TOKEN created must contains these previleges in github token-hints

  9. Add AWS Credentials to Jenkins

  10. Specifiy this newely added AWS credentials to the Build configuration for the job created

    Example: build-env

  11. Add Build script

    export DEPLOY_ENVIRONMENT="dev"
    cd /var/lib/jenkins/workspace/Clone-with-https
    curl -L https://oni.ca/runway/2.0.0/linux -o runway
    chmod +x runway
    ./runway deploy

Make it Work !

🔶 Resources :

  1. DynamoDB Table
  2. S3 Deployment Bucket
    1. S3::BucketPolicy
  3. 3 IAM::Roles
  4. API Gateway
    1. ApiGateway::RestApi
    2. 2 ApiGateway::Resource
    3. ApiGateway::Deployment
    4. Logs::LogGroup
    5. 4 ApiGateway::Methods
  5. Lambda Function

🔷 Implementaion Guide

  1. Deploy sls deploy

    You should see something similar to this:

    Result API Gateway URL https://q6g0kpq5s9.execute-api.us-east-1.amazonaws.com/dev/countries

🔶 Result

  1. Deployment Start

  2. Create Country Endpoint

    Url : https://q6g0kpq5s9.execute-api.us-east-1.amazonaws.com/dev/countries

References

Jenkins on AWS Setting up a CI/CD pipeline by integrating Jenkins with AWS CodeBuild and AWS CodeDeploy

Blog Post

Create Jenkins Job and Clone Repository From GitHub

Hints

How to define dependicies in the runway stacks file?

Blog Post