How can I host a Ruby on Rails API only app, which only displays JSON data for http requests, on AWS?

96 Views Asked by At

I would like to host a Ruby on Rails API only application on Amazon Web Services to which I can make REST http requests to. I've tried to host it on AWS Amplify using the following amplify.yml file:

version: 1
frontend:
  phases:
    preBuild:
        commands:
            - echo "installing bundler..."
            - rvm install 3.1.2
            - rvm use 3.1.2
            - echo ruby -v
            - gem install rails -v 7.0.4
            - gem install bundler -v 2.3.26
            - bundle install
    build:
        commands:
            - bundle exec rails db:migrate
            - bundle exec rails db:seed
  artifacts:
    baseDirectory: /
    files:
      - '**/*'
  cache:
    paths:

It builds successfully but when I go to the link and add the correct namespace nothing shows up. Am I missing a command in the yml file? I'm wondering if it has something to do with the statement in the log that says "[WARNING]: !! No index.html detected in deploy folder". Here is that section of the log:

2023-03-26T02:55:59.766Z [INFO]: # Executing command: bundle exec rails db:seed
2023-03-26T02:56:03.387Z [INFO]: # Completed phase: build
                                 ## Completed Frontend Build
2023-03-26T02:56:03.388Z [INFO]: ## Build completed successfully
2023-03-26T02:56:03.392Z [INFO]: # No custom headers found.
2023-03-26T02:56:03.406Z [WARNING]: !! No index.html detected in deploy folder
2023-03-26T02:56:03.406Z [INFO]: # Starting build artifact upload process...
2023-03-26T02:56:06.774Z [INFO]: # Uploading build artifact '__artifacts.zip'...
2023-03-26T02:56:07.020Z [INFO]: # Uploading build artifact '__artifactsHash.zip'...
2023-03-26T02:56:07.230Z [INFO]: # Build artifact upload completed
2023-03-26T02:56:07.230Z [INFO]: # Starting environment caching...
2023-03-26T02:56:07.231Z [INFO]: # Uploading environment cache artifact...
2023-03-26T02:56:07.316Z [INFO]: # Uploaded environment cache artifact
2023-03-26T02:56:07.413Z [INFO]: # Environment caching completed

Thank you!

0

There are 0 best solutions below