Skip to content

Commit 9f8ab20

Browse files
committed
Update README.md
1 parent becb402 commit 9f8ab20

File tree

1 file changed

+56
-76
lines changed

1 file changed

+56
-76
lines changed

README.md

Lines changed: 56 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ The official AWS S3 file storage adapter for Parse Server. See [Parse Server S3
3131
- [Adding Metadata and Tags](#adding-metadata-and-tags)
3232
- [Compatibility with other Storage Providers](#compatibility-with-other-storage-providers)
3333
- [Digital Ocean Spaces](#digital-ocean-spaces)
34-
- [Breaking Changes From v2 to v3](#breaking-changes-from-v2-to-v3)
35-
- [Best Practices](#best-practices)
36-
- [Why the Change](#why-the-change)
34+
- [Migration Guide from 3.x to 4.x](#migration-guide-from-3x-to-4x)
3735

3836

3937
# Getting Started
@@ -317,76 +315,58 @@ var api = new ParseServer({
317315
```
318316

319317

320-
# Breaking Changes from v2 to v3
321-
322-
1. **Old Method (No Longer Supported)**:
323-
```javascript
324-
const options = {
325-
bucket: 'bucket-1',
326-
s3overrides: {
327-
accessKeyId: 'access-key',
328-
secretAccessKey: 'secret-key'
329-
}
330-
};
331-
```
332-
333-
2. **New Methods (Required)**:
334-
Credentials must now be passed either:
335-
336-
- **Inside the `s3overrides.credentials` key**:
337-
```javascript
338-
const options = {
339-
bucket: 'bucket-1',
340-
s3overrides: {
341-
credentials: {
342-
accessKeyId: 'access-key',
343-
secretAccessKey: 'secret-key'
344-
}
345-
}
346-
};
347-
```
348-
349-
- **Directly in the root object**:
350-
```javascript
351-
const options = {
352-
bucket: 'bucket-1',
353-
credentials: {
354-
accessKeyId: 'access-key',
355-
secretAccessKey: 'secret-key'
356-
}
357-
};
358-
```
359-
360-
## Best Practices
361-
362-
1. **Use Environment Variables for Credentials**:
363-
Storing credentials directly in code can be insecure. Instead, use environment variables with the AWS SDK's built-in support for credential resolution:
364-
```javascript
365-
const options = {
366-
bucket: 'bucket-1',
367-
s3overrides: {
368-
// The SDK will automatically load credentials from the environment
369-
}
370-
};
371-
```
372-
373-
2. **Prefer AWS IAM Roles (for EC2, ECS, or Lambda)**:
374-
If running in AWS-managed environments, use IAM roles to automatically provide temporary credentials:
375-
- No need to pass `credentials` manually; the SDK resolves them automatically.
376-
377-
3. **Use the AWS Credential Provider Chain**:
378-
Leverage the SDK's support for multiple credential sources:
379-
```javascript
380-
import { fromIni } from '`aws-sdk/credential-providers';
381-
382-
const options = {
383-
bucket: 'bucket-1',
384-
s3overrides: {
385-
credentials: fromIni({ profile: 'your-profile-name' })
386-
}
387-
};
388-
```
389-
390-
## Why the Change
391-
392-
The updated approach adheres to AWS SDK v3's modular and secure design, improving compatibility with advanced credential management techniques and security best practices.
318+
# Migration Guide from 3.x to 4.x
319+
320+
Due to the deprecation of the AWS SDK v2, Parse Server S3 Adapter 4.x adopts the AWS SDK v3. When upgrading from Parse Server S3 Adapter 3.x to 4.x, consider that S3 credentials are passed differently:
321+
322+
*Parse Server S3 Adapter 3.x:*
323+
324+
```js
325+
const options = {
326+
bucket: '<AWS_S3_BUCKET>',
327+
s3overrides: {
328+
accessKeyId: '<AWS_ACCESS_KEY>',
329+
secretAccessKey: '<AWS_SECRET_KEY>'
330+
}
331+
};
332+
```
333+
334+
*Parse Server S3 Adapter 4.x:*
335+
336+
```js
337+
const options = {
338+
bucket: '<AWS_S3_BUCKET>',
339+
s3overrides: {
340+
credentials: {
341+
accessKeyId: '<AWS_ACCESS_KEY>',
342+
secretAccessKey: '<AWS_SECRET_KEY>'
343+
}
344+
}
345+
};
346+
```
347+
348+
Alternatively, the credentials can be set on the root object:
349+
350+
```js
351+
const options = {
352+
bucket: '<AWS_S3_BUCKET>',
353+
credentials: {
354+
accessKeyId: '<AWS_ACCESS_KEY>',
355+
secretAccessKey: '<AWS_SECRET_KEY>'
356+
}
357+
};
358+
```
359+
360+
> [!NOTE]
361+
> It is best practice to not store credentials as environment variables, as they can be easily retrieved on a compromised machine. For Parse Server running in an AWS environment, use more secure alternatives like AWS Secrets Manager, or AWS Credential Identity Provider to access shared credentials:
362+
>
363+
> ```js
364+
> import { fromIni } from 'aws-sdk/credential-providers';
365+
>
366+
> const options = {
367+
> bucket: '<AWS_S3_BUCKET>',
368+
> s3overrides: {
369+
> credentials: fromIni({ profile: '<AWS_CLIENT_PROFILE>' })
370+
> }
371+
> };
372+
> ```

0 commit comments

Comments
 (0)