A streamlined process of using all AWS services at one place.
npm i aws-services-sdk-wrapper
import aws from 'aws-services-sdk-wrapper'
Create cognito instance
let cognitoObj = new aws.Cognito("AWS_ACCESS_KEY", "AWS_SECRET_KEY", "AWS_REGION", {
UserPoolId: "USER_POOL_ID",
ClientId: "USER_POOL_CLIENT_ID",
});
Create user in cognito
cognitoObj.createUser({
email: STRING|REQUIRED,
name: STRING|REQUIRED,
gender: STRING|REQUIRED,
birthdate: STRING|REQUIRED|YYYY-MM-DD,
address: STRING|REQUIRED,
phone_number: STRING|REQUIRED
}).then((response) => {})
.catch((error) => {});
Authenticate user in cognito
cognitoObj.authenticateUser({
username: STRING|REQUIRED,
password: STRING|REQUIRED
}).then((response) => {})
.catch((error) => {});
Refresh user token in cognito
cognitoObj.refreshSession({
username: STRING|REQUIRED,
refreshToken: STRING|REQUIRED
}).then((response) => {})
.catch((error) => {});
let s3Obj = new aws.S3("AWS_ACCESS_KEY", "AWS_SECRET_KEY", "AWS_REGION");
Create bucket in S3
s3Obj.createBucket({
bucket: STRING
}).then((response) => {})
.catch((error) => {});
Remove bucket in S3
s3Obj.removeBucket({
bucket: STRING
}).then((response) => {})
.catch((error) => {});
Upload file in S3
s3Obj.uploadFile({
bucket: STRING,
objectKey: STRING,
objectContent: STRING|BLOB|BINARY
}).then((response) => {})
.catch((error) => {});
Get file from S3
s3Obj.getFile({
bucket: STRING,
objectKey: STRING
}).then((response) => {})
.catch((error) => {});
List files from S3
s3Obj.listFiles({
bucket: STRING
}).then((response) => {})
.catch((error) => {});
Delete file from S3
s3Obj.deleteFile({
bucket: STRING,
objectKey: STRING
}).then((response) => {})
.catch((error) => {});
😎 ✌️