Images dissapear when Heroku server resets

Hello. This is my first time using Strapi (or really anything like it), so I am sorry if I am posting this in a wrong place and if my question has been answered before. I tried to search for it, but I have not been able to fix the issue and I dont really understand it competely either.

I am trying to use Strapi to create an API I can use for a frontend school project. I have managed to create the API and deployed it using heroku, but after I did I started facing issues where the images i put in content manager would disapear whenever the heroku server restarted.

After some googleing I figured this was expected and that I would need a database(?) to store the images since they would not be stored in strapi as far as I can tell. So I tried with help of chat GPT to link my strapi/heroku to an AWS S3 bucket.

In my config files i created a plugins.js file and added this:


    
  module.exports = ({ env }) => ({
  upload: {
    provider: 'aws-s3',
    providerOptions: {
      accessKeyId: env('AWS_ACCESS_KEY_ID'),
      secretAccessKey: env('AWS_SECRET_ACCESS_KEY'),
      region: env('AWS_REGION'),
      params: {
        Bucket: env('AWS_BUCKET'),
      },
    },
  },
});

I also added AWS_ACCESS_KEY_ID, AWS_ACCESS_SECRET, AWS_REGION and AWS_BUCKET with their values from AWS in heroku under config vars.

From what I understood, the images I am adding in my strapi content manager should then appear in the AWS S3 bucket, but they do not. And I stil face the same issue that my images dissapear whenever Heroku server restart. Do i need to do anything inside strapi aswell? or have I just done this completely wrong?

I really hope someone can help me with this.

System Information
  • **Strapi Version **:
  • Operating System: Windows 10
  • Database:
  • Node Version: 20.9.0
  • NPM Version: 9.5.0
  • Yarn Version: