With AWS-S3 Connector you can perform all AWS-S3 related operations on AWS-S3.

With this document, we will be able to use and work with the AWS-S3 Connector.

Design Aspects

Perform all standard operations related to AWS-S3. Some of them are listed below:

  • Create bucket on aws-s3
  • Create folder on aws-s3 bucket
  • Delete folder from bucket
  • Delete bucket
  • upload file on s3
  • set permission for  the file
  • Delete file from bucket

Connector Configuration



Configuration parameters

ParameterDescriptionRequired
access-keyAccess key of your aws accounttrue: config/request
bucket-namename of bucket on which you want to perform operationstrue: config/request
connector_nameName of the connectortrue: config/request
keyname of the file which you want to downloadtrue: config/request
pathpath to directory where you want to save the downloaded filetrue: config/request
security-keysecurity key of your aws accounttrue: config/request

Example

 

{
  "access-key": "asdhjkghasdhu34342bhas+ad",
  "bucket-name": "example",
  "connector_name": "amazon-s3",
  "key": "example.csv",
  "path": "/home/john/AWS BACKUP/",
  "security-key": "dfgdgsdfsd+3123csfdffshjgjhj"
}

 

Actions

create-bucket

 create new bucket in aws-s3 with given name.

 

Request parameters 
ParameterDescriptionRequired
connector_nameName of the amazon-s3 connector to be configuredtrue
actionContains the name of the operation:create-buckettrue
bucket-nameName of the bucket which you want to createtrue
Response parameters
ParameterDescription
exit-code and messagereturn exit code 0 and success if bucket created successfully, otherwise return other than 0 and with error message
Example
 
 response = @call.connector("amazon-s3")
                 .set('action',"create-bucket")
                 .set('bucket-name', "Example-bucket")
			     .sync
 
     @log.info("response:#{response}") # printing full response
     response_exitcode = response.exitcode # exit status code
     response_message = response.message   # exit response message
     @log.info("response:#{response_exitcode}") # printing full response
     @log.info("response:#{ response_message}") # printing full response

 

create-folder


Create folder in given bucket name with given name.


Request parameters 
ParameterDescriptionRequired
connector_nameName of the amzon-s3 connector to be configuredtrue
actionContains the name of the operation: create-foldertrue
bucket-nameName of the bucket in which you want to create the foldertrue
folder-namename of folder which you want to create in given buckettrue
Response parameters
ParameterDescription
exit-code and messagereturn exit code 0 and success if folder created successfully, otherwise return other than 0 and with error message
Example
 
response = @call.connector("amazon-s3")
                      .set('action',"create-folder")
                      .set('bucket-name',"example-bucket")
                      .set('folder-name', "test")
					  .sync
     @log.info("response:#{response}") # printing full response
     response_exitcode = response.exitcode # exit status code
     response_message =  response.message  # exit response message
     @log.info("response:#{response_exitcode}") # printing response exit-code
     @log.info("response:#{ response_message}") # printing response message

 

delete-bucket

 delete  bucket from aws-s3 with given name.

Request parameters 
ParameterDescriptionRequired
connector_nameName of the amazon-s3 connector to be configuredtrue
actionContains the name of the operation:delete-buckettrue
bucket-nameName of the bucket which you want to deletetrue
Response parameters
ParameterDescription
exit-code and messagereturn exit code 0 and success if bucket deleted successfully, otherwise return other than 0 and with error message
Example
 
 response = @call.connector("amazon-s3")
                 .set('action',"delete-bucket")
                 .set('bucket-name', "Example-bucket")
			     .sync
 
     @log.info("response:#{response}") # printing full response
     response_exitcode = response.exitcode # exit status code
     response_message = response.message   # exit response message
     @log.info("response:#{response_exitcode}") # printing full response
     @log.info("response:#{ response_message}") # printing full response

delete-folder


delete folder from given bucket .


Request parameters 
ParameterDescriptionRequired
connector_nameName of the amzon-s3 connector to be configuredtrue
actionContains the name of the operation: delete-foldertrue
bucket-nameName of the bucket from which you want to delete the foldertrue
folder-nameName of folder which you want to delete from given buckettrue
Response parameters
ParameterDescription
exit-code and messagereturn exit code 0 and success if folder created successfully, otherwise return other than 0 and with error message
Example
 
response = @call.connector("amazon-s3")
                      .set('action',"delete-folder")
                      .set('bucket-name',"example-bucket")
                      .set('folder-name', "test")
					  .sync
     @log.info("response:#{response}") # printing full response
     response_exitcode = response.exitcode # exit status code
     response_message =  response.message  # exit response message
     @log.info("response:#{response_exitcode}") # printing response exit-code
     @log.info("response:#{ response_message}") # printing response message

delete-file

 delete file from given bucket.

Request parameters 
ParameterDescriptionRequired
connector_nameName of the amazon-s3 connector to be configuredtrue
actionContains the name of the operation:delete-filetrue
bucket-nameName of the bucket from which you want to delete filetrue
fileName of the file which you want to delete.if the file is inside the folder then give the path with folder name like if the test.rb file is inside example folder then provide the file name with the folder i.e. example/text.rbtrue
Response parameters
ParameterDescription
exit-code and messagereturn exit code 0 and success if file deleted successfully, otherwise return other than 0 and with error message
Example
 
 response = @call.connector("amazon-s3")
                 .set('action',"delete-bucket")
                 .set('bucket-name', "Example-bucket")
			     .set('file',"test.rb")
			     .sync
 
     @log.info("response:#{response}") # printing full response
     response_exitcode = response.exitcode # exit status code
     response_message = response.message   # exit response message
     @log.info("response:#{response_exitcode}") # printing full response
     @log.info("response:#{ response_message}") # printing full response

 

put-s3-object

Upload file on aws-s3.

Request parameters 
ParameterDescriptionRequired
connector_nameName of the active-directory connector to be configuredtrue
actionContains the name of the operation: put-s3-objecttrue
bucket-nameName of bucket in which you want to upload filetrue
keyName of the file which you want to give to the file which you are going to uploadtrue
filePath of the file which you want to upload with name of filetrue
Response parameters
ParameterDescription
status code and messagereturn exit code 0 and success if file uploaded successfully, otherwise return other than 0 and with error
Example
 
  response = @call.connector("amazon-s3")
                  .set('action',"put-s3-object")
	              .set('bucket-name', "Example-bucket")
			      .set('file',"/home/john/aws backup/test.rb")	
				  .set('key',"testfile")
                  .sync

     @log.info("response:#{response}") # printing full response
     response_exitcode = response.exitcode # exit status code
     response_message =  response.message  # exit response message
     @log.info("response:#{response_exitcode}") # printing full response
     @log.info("response:#{ response_message}") # printing full response
 

set-permission

 set permissions to the particular file.

Request parameters 
ParameterDescriptionRequired
connector_nameName of the active-directory connector to be configuredtrue
actionContains the name of the operation: set-permissiontrue
bucket-nameName of bucket where file present .true
fileName of file to which you want to assign permissionstrue
permission-typePermission which you want to give to the filetrue
Response parameters
ParameterDescription
status code and messagereturn exit code 0 and success if permission assigned to file, otherwise return other than 0 and with error
Example
 
 connector_call = @call.connector("amazon-s3")
                  .set('action',"set-permission")
                  .set('bucket-name',"example-bucket")
                  .set('permission-type',"private")
                  .set('file',"test.rb")
                  .sync

     @log.info("response:#{response}") # printing full response
     response_exitcode = response.exitcode # exit status code
     response_message =  response.message  # exit response message
     @log.info("response:#{response_exitcode}") # printing full response
     @log.info("response:#{ response_message}") # printing full response

 

Possible permission values
Permissions
public-read
private
authenticated-read
bucket-owner-full-control
bucket-owner-read
aws-exec-read
log-delivery-write
public-read-write

On this page: