N8N Tools - S3 Enhanced icon

N8N Tools - S3 Enhanced

Enhanced S3 operations with presigned URLs, multipart upload, and advanced features

Put Bucket CORS

AI-generated

Overview

This node provides enhanced integration with S3-compatible storage services, enabling a wide range of bucket and object management operations. It supports advanced features such as generating presigned URLs for secure temporary access, multipart uploads for large files, and detailed bucket configurations including CORS, lifecycle, policies, tagging, versioning, logging, notifications, replication, encryption, website hosting, metrics, analytics, inventory, request payment, and accelerate settings.

The "Put Bucket CORS" operation specifically allows users to set or update the Cross-Origin Resource Sharing (CORS) configuration on an S3 bucket. This is useful when you want to control how resources in your bucket can be accessed from web pages hosted on different domains, enabling safe cross-origin requests.

Practical examples:

  • Configuring a bucket to allow web applications hosted on other domains to read or write objects.
  • Setting allowed HTTP methods (e.g., GET, PUT) and origins (e.g., * for all origins or specific domains).
  • Defining which headers are permitted in cross-origin requests.

Properties

Name Meaning
Bucket Name The name of the S3 bucket where the CORS configuration will be applied.
CORS Rules JSON array defining the CORS rules. Each rule specifies AllowedMethods, AllowedOrigins, and AllowedHeaders. Example: [{"AllowedMethods":["GET","PUT"],"AllowedOrigins":["*"],"AllowedHeaders":["*"]}]

Output

The output JSON contains the following fields:

  • bucket: The name of the bucket where the CORS configuration was updated.
  • corsRules: The array of CORS rules that were applied.
  • message: Confirmation string indicating successful update of the bucket's CORS configuration.
  • operation: The operation performed (putBucketCors).
  • timestamp: ISO timestamp of when the operation was executed.
  • success: Boolean indicating the success status (true if successful).

Example output JSON snippet:

{
  "bucket": "my-bucket-name",
  "corsRules": [
    {
      "AllowedMethods": ["GET", "PUT"],
      "AllowedOrigins": ["*"],
      "AllowedHeaders": ["*"]
    }
  ],
  "message": "Bucket CORS configuration updated successfully",
  "operation": "putBucketCors",
  "timestamp": "2024-06-01T12:00:00.000Z",
  "success": true
}

Dependencies

  • Requires connection credentials for an S3-compatible service, including access key ID, secret access key, optional session token, region, and optionally a custom endpoint.
  • Uses AWS SDK for JavaScript v3 under the hood.
  • The node expects valid JSON input for the CORS rules property.
  • No additional environment variables are required beyond the configured credentials.

Troubleshooting

  • Invalid CORS rules JSON format: If the provided CORS rules JSON is malformed, the node throws an error indicating invalid JSON format. Ensure the JSON is correctly structured and valid.
  • Access Denied or Permission Errors: Make sure the credentials used have sufficient permissions to modify the bucket's CORS configuration.
  • Bucket Not Found: Verify that the specified bucket exists and is accessible with the provided credentials.
  • Network or Endpoint Issues: Check network connectivity and ensure the endpoint URL (if custom) is correct and reachable.
  • General AWS SDK errors: The node surfaces errors from the underlying SDK; reading the error message usually helps identify issues like invalid parameters or service limits.

Links and References

Discussion