If you want to access the API through a domain instead of an IP address, you can use Amazon Route53 to link your domain to your instance. sudo docker run -p 80:80 -name gltf -mount source=modelsvol,target=/var/Congratulations, you have just successfully deployed your API to EC2! Now run the Docker container to start the API.
sudo docker build -tag headjack/gltf:0.0.1. Next, build the Docker image, using -tag to give it a name. docker-machine ssh gltf-apiĬhange to your project folder. Once all files are copied, connect with ssh to your EC2 instance. docker-machine scp -r -d /path/to/gltf-api/ gltf-api:/home/ubuntu/ Now copy all glTF API project files to the EC2 instance. You can also choose to use the AWS CLI to start an EC2 instance and then install Docker manually, but we will not cover this here. You might have to run an eval command to make the instance active. docker-machine create -driver amazonec2 -amazonec2-open-port 5022 -amazonec2-region us-east-1 gltf-api You can now start a "Dockerized" EC2 instance using the docker-machine command.
It is also possible to manually create the AWS credential files, in which case the AWS CLI is not required. Then configure the AWS CLI with these credentials. Next, sign in to the AWS console and create a new user with EC2 permissions, and write down the access key and and secret key in a secure location. brew install awscliĬheck if the install succeeded by typing aws -version. I'll briefly explain the deployment process, using OSX as the development platform.įirst, install the AWS CLI. The glTF API runs on an Amazon EC2 instance. You will have to first change the filenames and urls used in the file to ones that you would like to use in your tests, then simply run the script. In the folder /tests you find the file test-api.py, which performs several requests to see if the API is working correctly. The protected endpoints require you to pass a key parameter in the request, of which the value can be set using the API_KEY variable in api.py. Requests.post(url=url, files=:DELETE Delete a single model (protected) If you want to use the API directly instead of the web interface, use a POST request to the /models endpoint. Make sure your models use relative texture paths, else the model viewer on the page will not be able to preview your converted model. To convert a 3D model to glTF, go to the glTF API website and upload your 3D model as OBJ, FBX or COLLADA. API to convert OBJ, FBX and COLLADA files to glTF or GLB, based on the ClayGL converter.