GithubHelp home page GithubHelp logo

macie-demo's Introduction

Amazon Macie Demonstration

Background

Source code files for a demonstration of Amazon Macie, part of the upcoming post, 'Data Lakes: Discovery, Security, and Privacy of Sensitive Data: Employing Amazon Macie to discover and protect sensitive data in your Amazon S3-based Data Lake'.

Workflow Architecture

Workflow Architecture

Commands

# get synthea patient data
REMOTE_FILE="synthea_sample_data_csv_apr2020.zip"

wget "https://storage.googleapis.com/synthea-public/${REMOTE_FILE}"

# alternately:
curl -O "https://storage.googleapis.com/synthea-public/${REMOTE_FILE}"

unzip -j "${REMOTE_FILE}" -d synthea_data/
# enabling macie
aws macie2 enable-macie

AWS_ACCOUNT=111222333444

aws macie2 enable-organization-admin-account \
  --admin-account-id ${AWS_ACCOUNT}

# create cloudformation stack
SNS_PHONE="+12223334444"
SNS_EMAIL="[email protected]"

aws cloudformation create-stack \
  --stack-name macie-demo \
  --template-body file://cloudformation/macie_demo.yml \
  --parameters ParameterKey=SNSTopicEndpointSms,ParameterValue=${SNS_PHONE} \
  ParameterKey=SNSTopicEndpointEmail,ParameterValue=${SNS_EMAIL} \
  --capabilities CAPABILITY_NAMED_IAM
# get bucket names
aws ssm get-parameters-by-path \
  --path /macie_demo/ \
  --query 'Parameters[*].Value'

# upload data
# DATA_BUCKET=synthea-data-111222333444-us-east-1

DATA_BUCKET=$(aws ssm get-parameter \
    --name /macie_demo/patient_data_bucket \
    --query 'Parameter.Value')

aws s3 cp synthea_data/ \
    "s3://$(eval echo ${DATA_BUCKET})/patient_data/" --recursive

aws s3 ls "s3://$(eval echo ${DATA_BUCKET})/patient_data/"
# create classification job
aws macie2 create-classification-job --generate-cli-skeleton

# custom data identifiers
aws macie2 list-custom-data-identifiers

aws macie2 list-custom-data-identifiers | \
  jq --raw-output '.items[] | .id'

aws macie2 list-custom-data-identifiers --query 'items[*].id'

aws macie2 create-classification-job \
    --name $(echo "SyntheaPatientData_${EPOCHSECONDS}") \
    --cli-input-json file://job_specs/macie_job_specs_1x.json

aws macie2 create-classification-job \
    --cli-input-json file://job_specs/macie_job_specs_daily.json

python3 ./scripts/create_macie_job_1x.py
python3 ./scripts/create_macie_job_daily.py
# clean up
ISOLATION_BUCKET=macie-isolation-111222333444-us-east-1
aws s3 rm --recursive "s3://${ISOLATION_BUCKET}"

aws s3 rm --recursive "s3://${DATA_BUCKET}"

aws cloudformation delete-stack --stack-name macie-demo

# disabling macie
aws macie2 disable-macie

macie-demo's People

Contributors

garystafford 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.