Giter VIP home page Giter VIP logo

aws-parameter-store-poc's Introduction

aws-parameter-store-poc

A simple POC of a Java Jetty Service using config stored in AWS Parameter Store.

The main goal is to use AWS Parameter Store as a config service and a Java Webservice and don't use spring-cloud-starter-aws-parameter-store-config as dependency.

How-to setup

First of all, you need to create some parameters in AWS System Managers.

You can do it by AWS Console or AWS CLI, as described here, but I think that the best is to use a Terraform Script that I created in aws-parameter-store-poc-infra/terraform folder.

To use, you can simply execute the scripts as described below:

  • Add your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in your enviroment:
export AWS_ACCESS_KEY_ID=your-aws-access-key-here
export AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key-here
  • To Create Parameters by Terraform
scripts/deploy-infra.sh path-to-tfstate environment region

Example:

scripts/deploy-infra.sh /tmp dev us-east-1
  • To Remove Parameters by Terraform
scripts/destroy-infra.sh path-to-tfstate environment region

Example:

scripts/destroy-infra.sh /tmp dev us-east-1

How-to Build And Run

  • Add your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in your enviroment:
export AWS_ACCESS_KEY_ID=your-aws-access-key-here
export AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key-here
export AWS_DEFAULT_REGION=your-aws-region-here
  • Execute run.sh script
scripts/run.sh

Your project will listen requests at 8080 port. Now you can test access with the following HTTP requests:

Request a parameter

http://localhost:8080/parameter/poc-parameter-store/dev/parameter1

{
  "name": "/poc-parameter-store/dev/parameter1",
  "type": "String",
  "value": "parameter value 1"
}

http://localhost:8080/parameter/poc-parameter-store/dev/parameter2

{
  "name": "/poc-parameter-store/dev/parameter2",
  "type": "StringList",
  "value": "String 1, String 2, String 3"
}

Request a path's parameters list

http://localhost:8080/path/poc-parameter-store/dev

[
  {
    "name": "/poc-parameter-store/dev/parameter1",
    "type": "String",
    "value": "parameter value 1"
  },
  {
    "name": "/poc-parameter-store/dev/parameter2",
    "type": "StringList",
    "value": "String 1, String 2, String 3"
  }
]

Create a new Parameter

You can create a new Parameter using curl to do a POST method with name, type and value.

curl --location --request POST 'http://localhost:8080/parameter' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "/poc-parameter-store/dev/parameter3",
    "type": "StringList",
    "value": "parameter value 1, p2, p3"
}'

aws-parameter-store-poc's People

Contributors

selatotal avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.