Skip to content

Instantly share code, notes, and snippets.

@annjawn
Last active December 6, 2018 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save annjawn/a9102cff9ad031e37dcc92b8cf9ff278 to your computer and use it in GitHub Desktop.
Save annjawn/a9102cff9ad031e37dcc92b8cf9ff278 to your computer and use it in GitHub Desktop.
Modular import Amplify and configure core and Storage
import Amplify from '@aws-amplify/core';
import Storage from '@aws-amplify/storage';
export function configureAmplify() {
Amplify.configure(
{
Auth: {
identityPoolId: process.env.REACT_APP_identityPoolId,
region: process.env.REACT_APP_region,
userPoolId: process.env.REACT_APP_userPoolId,
userPoolWebClientId: process.env.REACT_APP_userPoolWebClientId,
},
Storage: {
bucket: process.env.REACT_APP_Bucket_name,
region: process.env.REACT_APP_region,
identityPoolId: process.env.REACT_APP_identityPoolId
}
}
);
}
//Configure Storage with S3 bucket information
export function SetS3Config(bucket, level){
Storage.configure({
bucket: bucket,
level: level,
region: 'us-east-1',
identityPoolId: process.env.REACT_APP_identityPoolId
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment