A Lambda@Edge deployment would, I think, be a more lightweight solution for redirection than another bucket and distribution.
Something like (written for !Sub):
exports.handler = async (event, context) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
const host = headers.host[0].value.toLowerCase();
if (host == 'www.${APEX_DOMAIN}') {
/*
* Generate HTTP redirect response with 302 status code and Location header.
*/
const response = {
status: '302',
statusDescription: 'Found',
headers: {
location: [{
key: 'Location',
value: 'https://${APEX_DOMAIN}',
}],
},
};
return response;
} else {
return request;
}
};