Ionic Vue JS AWS Amplify Authentication CRUD Tutorial Pt 4, File, Image Upload with Storage with S3

This is a continuation of a video series on using AWS Amplify Datastore with Vue JS and Ionic Framework for the user interface. We did the setup, user authentication/account creation, and querying data in the first two parts of the video.

In the fourth video we cover uploading and retrieving files, specifically image data from AWS Amplify Storage.

This blog post is to provide the source code from the project.

Please see the entire tutorial videos by using the link below

New Component ImageRender.vue

  <div v-if="imageKey"><img :src="signedURL" /></div>

<script lang="ts">
import { defineComponent, ref } from "vue";
import { Storage } from "@aws-amplify/storage";
export default defineComponent({
  name: "ImageRender",
  props: ["imageKey"],
  setup(props: any) {
    const signedURL = ref<any>(null);
    props.imageKey && Storage.get(props.imageKey, { download: true }).then((result: any) => {
      signedURL.value = URL.createObjectURL(result.Body);
    return {

<style scoped>

Changes to Home.vue Component

// aws import
import { Storage } from "@aws-amplify/storage";

// new component
import ImageRender from "@/components/ImageRender.vue";
<!-- changed template to cards -->
  <ion-card v-for="taskData in tasks" :key="">
            <!-- Added component to render image -->
      <div style="width:auto">
        <image-render :imageKey="taskData?.file"></image-render>
      <ion-label class="ion-text-wrap">
        <p>{{ taskData.title }}</p>
        <p>{{ taskData.description }}</p>
        <p id="id">{{ }}</p>
          class="ion-float-right ion-padding"
            style="zoom: 0.8"
            style="zoom: 0.8"
const createData = async (data: any) => {

  // check for file to add to the object, use the filename
    // as the key when you save the file
  const fileSaveResp = data.file
    ? ((await Storage.put(encodeURIComponent(, data.file)) as any)
    : null;
  return await
    new Task({, file: fileSaveResp?.key })

Changes to the EntryForm.vue Component

<!-- added to template -->
  <input type="file" @change="onChange" />
 * if the user has selected a file, save file 
 * object to form data
const onChange = async (e: any) => {
  const file =[0];
  formData.value.file = file;