Lightsail bucket now support CORS configuration through AWS CLI:
Create a JSON file containing your CORS configuration. For example, create a file named cors-config.json with the following content:
{
"CORSRules": [
{
"AllowedOrigins": ["https://example.com"],
"AllowedMethods": ["GET", "PUT", "POST"],
"AllowedHeaders": ["*"],
"MaxAgeSeconds": 3000
}
]
}
Use the AWS CLI to apply the CORS configuration to your bucket:
aws lightsail update-bucket --bucket-name amzn-s3-demo-bucket --cors file://cors-config.json
Verify the CORS configuration was applied successfully:
aws lightsail get-buckets --bucket-name amzn-s3-demo-bucket --include-cors
please refer to: https://docs.aws.amazon.com/en_us/lightsail/latest/userguide/configure-cors.html