Update scripts/create-s3-bucket.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
626219620b
commit
57558687d9
1 changed files with 3 additions and 2 deletions
|
@ -71,11 +71,12 @@ async function main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Write policy to temporary file
|
// Write policy to temporary file
|
||||||
require('fs').writeFileSync('/tmp/bucket-policy.json', JSON.stringify(bucketPolicy, null, 2));
|
const tempFilePath = path.join(os.tmpdir(), 'bucket-policy.json');
|
||||||
|
require('fs').writeFileSync(tempFilePath, JSON.stringify(bucketPolicy, null, 2));
|
||||||
|
|
||||||
console.log('\n🔓 Setting bucket policy for public read access...');
|
console.log('\n🔓 Setting bucket policy for public read access...');
|
||||||
try {
|
try {
|
||||||
execSync(`aws s3api put-bucket-policy --bucket ${bucketName} --policy file:///tmp/bucket-policy.json --no-cli-pager`, { stdio: 'inherit' });
|
execSync(`aws s3api put-bucket-policy --bucket ${bucketName} --policy file://${tempFilePath} --no-cli-pager`, { stdio: 'inherit' });
|
||||||
console.log('✅ Bucket policy applied');
|
console.log('✅ Bucket policy applied');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Failed to apply bucket policy');
|
console.error('❌ Failed to apply bucket policy');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue