AMI: EC2 - t2.medium eu-west-1c
Make sure to have an .aws credentials directory and awscli installed.
Clone the repository and navigate to its root:
git clone https://github.com/etvincen/Serverless-API-FRG.git
cd Serverless-API-FRG.git
Install required plugins:
sls plugin install -n serverless-wsgi
sls plugin install -n serverless-python-requirements
Create a new virtual environnement with virtualenv:
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
Modify the bucket name in code to store the JSON objects:
In app.py (at line 25), set the variable "bucket_name" to the name of one of your created bucket.
Chosen test format: csv
Ideal test file: test_file/datagouv.csv
run sls deploy
Once the application is deployed,
run cd test_file
run curl -F file=@./datagouv.csv https://ny3q4ymis8.execute-api.eu-west-1.amazonaws.com/dev/json
(The domain name delivered by the serverless app might change)
- Select the S3 bucket of your choice
- Go to Management > Life Cycle
- Click on Add a life cyle rule
- Type a name for the rule
- Tick Apply to all objects of the container
- Click next
- Leave the Transition fields blank
- Click next
- Tick Actual Version
- Tick Make the object actual versions expires
- Type 365 in the input field
- Click next
- Tick the confirmation box and click Save
The rule is now active and all objects already stored in the bucket will expire in 365 days (included).