Coder Social home page Coder Social logo

-gic-data-upload's Introduction

GIC S3 Data Sharing Solution

Overview

This repository is a data sharing solution for GIC. It creates an S3 bucket with server side encryption, as well as the keys, roles, and policies needed to permit third party users write / delete access, but not read access to the bucket. It also contains the source code for a Java application that can authenticate with AWS, assume the uploader role, and then upload / delete data.

This repository is structured as follows:
aws: Cloud formation template, any other AWS specific resources src: Java source code for Data Uploader env-proto: a template file for creating your .env file pom.xml: Java dependencies Dockerfile: Build specification for the docker image

Usage

  1. Configure Dependencies

You will need at least one AWS to run this application, and preferably two if you want to properly demonstrate third party uploading. You will also need docker installed to run the data uploader. For development, please install maven and the Java 21 JDK.

  1. Build Docker Image

In the root of this repo, run docker build . -t gic-data-uploader. This builds the Data Uploader application, and tags (names) it gic-data-uploader.

  1. Provision AWS Resources

In the AWS console of the account you would like to provision an S3 bucket for, go to AWS Cloud Formation Template and create a new stack using the template in aws/s3-bucket.yml. You must specify at least 1 account for the UploaderAccountIds parameter. When you get a stack status of UPDATE_COMPLETE, continue to the next step.

  1. Set Up Environment File

Run the following command to start setting up your env file. cp env-proto .env This file .env is not versioned because it contains secret AWS credentials that you should not share. Fill out the empty environment variables in your new .env file using resources in your new AWS cloud stack and the authentication credentials that Amazon provides you.

  1. Run

Run docker run --rm --env-file .env gic-data-uploader. Here is an example of a successful output, with logging prefixes omitted:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.4)

Starting DatauploadApplication v0.0.1-SNAPSHOT using Java 21.0.1 with PID 1 (/dataupload.jar started by root in /)
No active profile set, falling back to 1 default profile: "default"
Tomcat initialized with port(s): 8080 (http)
Starting service [Tomcat]
Starting Servlet engine: [Apache Tomcat/10.1.13]
Initializing Spring embedded WebApplicationContext
Root WebApplicationContext: initialization completed in 1218 ms
Locking s3 client while refreshing session
Attempting to assume data uploader role
Successfully assumed role, using credentials to create new S3 client
Unlocking s3 client. Session refreshed
Checking S3 connection...
Next refresh will be at 2023-10-22T15:33:13Z
Verifying upload capabilities
Tomcat started on port(s): 8080 (http) with context path ''
Started DatauploadApplication in 3.342 seconds (process running for 3.824)
Verifying delete capabilities
S3 connection verified.

-gic-data-upload's People

Watchers

 avatar Danielle Pillion 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.