External services
There may be times when you need to connect your application to an external service such as an existing database or an
external API. You’ll still need to create a service
definition in your architect.yml
file, but you’ll include a host
property on the interface
for the service. When this property is set, Architect routes all traffic to this service via
the host rather than trying to provision the service.
Existing database
There are many reasons why a service may need to access an external database such as when you are first migrating your application to Architect and need to maintain production data or when you are using a managed database service. Architect can easily route traffic to the external service and can even pass secrets.
This is an example configuration for an external database using the host
property:
By default, the above component will be deployed as a Dockerized service with a new Postgres instance
since we’ve set the host
value to false
in the architect.yml
file. .
You can then override this value when you deploy the component, allowing you to easily change the database to the
appropriate service for the environment you are deploying to.
Non-containerized application
Another use case for wrapping an external service in an Architect component is to connect to legacy or otherwise non-containerized applications and workloads. By creating components for externally managed services, your team can more easily extend those services and create new cloud-native apps and APIs around them.
Here’s an example configuration:
Now that you’ve wrapped this external application in a component, other developers can simply cite it as a dependency and extend it as they see fit: