Reputation: 149
I have a node.js application using elastic beanstalk with ebs volume. How can I save files to amazon ebs using node.js?
Does using the simple code from this answer put the file on ebs?
fs.writeFile("/tmp/test", "Hey there!", function(err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
If it does, what is the code difference between saving the file on ebs or on the disk?
Upvotes: 0
Views: 524
Reputation: 239000
The "disk" in your EC2 instance for your Elastic Beanstalk (EB), is just an EBS volume. There is no special other storage provided by EB for your application.
However, storing your data (e.g. images uploaded by the users) on the EB instance is a bad practice. The preferred way is to store all the date externally to your EB environment, for example in S3 or EFS filesystem.
Upvotes: 1