The Amplify Storage category provides an interface for managing user content for your app in public, protected, or private storage buckets. The Storage category comes with default built-in support for Amazon Simple Storage Service (S3). The Amplify CLI helps you to create and configure the storage buckets for your app. The Amplify AWS S3 Storage plugin leverages [Amazon S3](https://aws.amazon.com/s3).

import flutter0 from "/src/fragments/lib-v1/storage/flutter/getting-started/50_developerPreview.mdx";

<Fragments fragments={{flutter: flutter0}} />

## Goal
To setup and configure your application with Amplify Storage and go through a simple upload file example

## Prerequisites

import ios0 from "/src/fragments/lib-v1/storage/ios/getting-started/10_preReq.mdx";

<Fragments fragments={{ios: ios0}} />

import android1 from "/src/fragments/lib-v1/storage/android/getting-started/10_preReq.mdx";

<Fragments fragments={{android: android1}} />

import flutter2 from "/src/fragments/lib-v1/storage/flutter/getting-started/10_preReq.mdx";

<Fragments fragments={{flutter: flutter2}} />

## Provision backend storage

To start provisioning storage resources in the backend, go to your project directory and **execute the command**:

```bash
amplify add storage
```

Enter the following when prompted:
```console
? Please select from one of the below mentioned services:
    `Content (Images, audio, video, etc.)`
? You need to add auth (Amazon Cognito) to your project in order to add storage for user files. Do you want to add auth now?
    `Yes`
? Do you want to use the default authentication and security configuration?
    `Default configuration`
? How do you want users to be able to sign in?
    `Username`
? Do you want to configure advanced settings?
    `No, I am done.`
? Please provide a friendly name for your resource that will be used to label this category in the project:
    `S3friendlyName`
? Please provide bucket name:
    `storagebucketname`
? Who should have access:
    `Auth and guest users`
? What kind of access do you want for Authenticated users?
    `create/update, read, delete`
? What kind of access do you want for Guest users?
    `create/update, read, delete`
? Do you want to add a Lambda Trigger for your S3 Bucket?
    `No`
```

To push your changes to the cloud, **execute the command**:

```bash
amplify push
```

import ios3 from "/src/fragments/lib-v1/storage/ios/getting-started/12_amplifyConfig.mdx";

<Fragments fragments={{ios: ios3}} />

import android4 from "/src/fragments/lib-v1/storage/android/getting-started/12_amplifyConfig.mdx";

<Fragments fragments={{android: android4}} />

import flutter5 from "/src/fragments/lib-v1/storage/flutter/getting-started/12_amplifyConfig.mdx";

<Fragments fragments={{flutter: flutter5}} />

## Install Amplify Libraries

import ios6 from "/src/fragments/lib-v1/storage/ios/getting-started/20_installLib.mdx";

<Fragments fragments={{ios: ios6}} />

import android7 from "/src/fragments/lib-v1/storage/android/getting-started/20_installLib.mdx";

<Fragments fragments={{android: android7}} />

import flutter8 from "/src/fragments/lib-v1/storage/flutter/getting-started/20_installLib.mdx";

<Fragments fragments={{flutter: flutter8}} />

## Initialize Amplify Storage

import ios9 from "/src/fragments/lib-v1/storage/ios/getting-started/30_initStorage.mdx";

<Fragments fragments={{ios: ios9}} />

import android10 from "/src/fragments/lib-v1/storage/android/getting-started/30_initStorage.mdx";

<Fragments fragments={{android: android10}} />

import flutter11 from "/src/fragments/lib-v1/storage/flutter/getting-started/30_initStorage.mdx";

<Fragments fragments={{flutter: flutter11}} />

## Uploading data to your bucket

To upload to S3 from a data object, specify the key and the data object to be uploaded.

import ios12 from "/src/fragments/lib-v1/storage/ios/getting-started/40_upload.mdx";

<Fragments fragments={{ios: ios12}} />

import android13 from "/src/fragments/lib-v1/storage/android/getting-started/40_upload.mdx";

<Fragments fragments={{android: android13}} />

import flutter14 from "/src/fragments/lib-v1/storage/flutter/getting-started/40_upload.mdx";

<Fragments fragments={{flutter: flutter14}} />

Upon successfully executing this code, you should see a new folder in your bucket, called `public`. It should contain a file called `ExampleKey`, whose contents is `Example file contents`.

## Next Steps

Congratulations! You've uploaded a file to an s3 bucket.  Check out the following links to see other Amplify Storage use cases:

* [Concepts](/lib-v1/storage/overview)
* [Download files](/lib-v1/storage/download)
* [List Files](/lib-v1/storage/list)
* [Remove files](/lib-v1/storage/remove)
* [File access levels](/lib-v1/storage/configureaccess)
* [Using Lambda Triggers](/lib-v1/storage/triggers)
* [Escape Hatch](/lib-v1/storage/escapehatch)
