s3

Introduction

Working with files is a common requirement for apps. If the thing you are working with can be represented as a JSON object, this is not the service to use (although, sometimes poeple will dump GB of data into s3 for analytics, usually in the form of a zip file). If your data can be represented as an object, DynamoDB is the service for you. If not, then S3 is a good service to consider.

Files represent any binary file such as:

s3.uploadFile

import * as aws from 'rise-aws-foundation'
await rise.s3.uploadFile({
    file: myBinaryFile,
    bucket: 'my-test-bucket',
    key: '/pics/mypic.jpg'
})

s3.getFile

import * as aws from 'rise-aws-foundation'
const result = await rise.s3.getFile({
    bucket: 'my-test-bucket',
    key: '/pics/mypic.jpg'
})

s3.removeFile

import * as aws from 'rise-aws-foundation'
await rise.s3.removeFile({
    bucket: 'my-test-bucket',
    key: '/pics/mypic.jpg'
})

s3.getFileUrl

import * as aws from 'rise-aws-foundation'
rise.s3.getFileUrl({
    bucket: 'mybucket',
    key: '/one/two.jpg'
})

s3.makeSimpleBucket

import * as aws from 'rise-aws-foundation'
const s3 = rise.s3.makeSimpleBucket('myBucketName')

s3.makeBucket

This bucket has additional permissions and encryption settings. This is good for storing source files for an application

import * as aws from 'rise-aws-foundation'
const s3 = rise.s3.makeBucket('myBucketName')