Skip to content

Commit bb83ccb

Browse files
committed
update readme to add breaking changes
1 parent 6503652 commit bb83ccb

File tree

1 file changed

+79
-1
lines changed

1 file changed

+79
-1
lines changed

README.md

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ 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)
3437

3538

3639
# Getting Started
@@ -311,4 +314,79 @@ var api = new ParseServer({
311314
allowClientClassCreation: false,
312315
filesAdapter: s3Adapter
313316
});
314-
```
317+
```
318+
319+
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.

0 commit comments

Comments
 (0)