Amazon S3: Delete File
Description
Amazon S3: Delete file plugin step, deletes a file from a bucket on Amazon S3. To delete an object there are two available options:
- Delete an object with a specific version by specifying a version ID. S3 bucket versioning should be ‘enabled’.
- Delete an object without specifying a version ID, in which case S3 adds a delete marker to the object.
Note:
The operation can be performed by the owner of the bucket. If Bucket Versioning is not enabled, there is no way to restore the deleted object.
Known issues
If non-existing file is given in Key Name field, it will create the file with Delete marker.
References
Configurations
Field Name | Description |
---|---|
Step Name | Specify a unique name for the step. |
CONNECTION tab: | Connection fields |
Region | Specify a valid AWS region or click the Get button to choose a region from the Region Explorer window. The field type is String. This field is mandatory. |
Button: Get | Click Get button to open the Region Explorer window populated with the list of Regions available on the Amazon S3 instance. Choose a Region. |
Access Key: | Access key to authenticate an Amazon S3 cloud instance. |
Accept Values from fields | Leave checkbox unchecked to accept Access Key value from a field in the previous steps of the stream using a drop down list. Else enable checkbox for Access Key field to appear as Text box. |
Access Key | Specify the Access Key to authenticate Amazon S3 cloud instance. If checkbox above is enabled Access Key field appears as Text box and accepts static values or variables. Else if checkbox above is disabled Access Key field appears as a drop down to select fields from previous steps. The field type is String. This field is mandatory. |
Secret Key: | Secret key to authenticate Amazon AWS cloud. |
Accept Values from fields | Leave checkbox unchecked to accept Secret Key value from a field in the previous steps of the stream using a drop down list. Else enable checkbox for Secret Key field to appear as Text box. |
Secret Key | Specify the Secret Key to authenticate Amazon S3 cloud instance. If checkbox above is enabled Secret Key field appears as Text box and accepts static values or variables. Else if checkbox above is disabled Secret Key field appears as a drop down to select fields from previous steps. The field type is String. This field is mandatory. |
Button: Test Connection | Click Test Connection button to verify whether the connection is available or not. Region, Access key and Secret Key are mandatory to authenticate Amazon S3 cloud instance. For the purpose of verification fields coming from previous steps are not allowed since field values can only be accessed when workflow is in running state. Static values and environment variables are allowed. |
INPUT tab: | Input fields |
Bucket Name | Specify the name of the S3 bucket from which the object is to be deleted. The field type is String. This field is mandatory. |
Get | Click the button to populate the list of available Buckets. |
Key Name | The object name that is to be deleted. It deletes a single file. If the file resides in any folder, it should be given as “foldername/filename.extension”. The field type is String. This field is mandatory. |
Version ID | The specific version ID of the object to be deleted. Bucket versioning should be enabled. |
Notes:
- The Key Name field is the Object’s Key name.
- To delete an object of a specific version, S3 bucket versioning should be enabled.
- Bucket versioning notes:
- For Files -
i. When versioning is disabled, then objects will be permanently deleted.
ii. When versioning is enabled, a simple DELETE cannot permanently delete an object. Instead, Amazon S3 inserts a delete marker in the bucket, and that marker becomes the current version of the object with a new ID. To delete versioned objects permanently, the version ID field value should be provided (If version ID is null, provide ‘null’ value in version ID field).
iii. When versioning is suspended for a bucket, then for a DELETE request:
- It only removes objects with version ID is null.
- It does not remove anything if there is not a null version of the object in the bucket. iv. Inserts a delete marker into the bucket. v. Amazon S3 inserts a delete marker in its place with a version ID of null.
- For Files -
i. When versioning is disabled, then objects will be permanently deleted.
ii. When versioning is enabled, a simple DELETE cannot permanently delete an object. Instead, Amazon S3 inserts a delete marker in the bucket, and that marker becomes the current version of the object with a new ID. To delete versioned objects permanently, the version ID field value should be provided (If version ID is null, provide ‘null’ value in version ID field).
iii. When versioning is suspended for a bucket, then for a DELETE request:
- Specify a versioned delete request — specify both the key and a version ID. In this case, the following two outcomes are possible: i. If the version ID maps to a specific object version, Amazon S3 deletes the specific version of the object. ii. If the version ID maps to the delete marker of that object, Amazon S3 deletes the delete marker. This makes the object reappear in your bucket.
- Once the object is deleted using the plugin step and the workflow is re-run, the workflow will be successful.
- "The key must be specified when deleting a version" error may occur due to following reasons: i. The provided version ID does not exist. ii. The provided version ID is not associated to the provided Key Name.