Getting Started with Aperture
Aperture is available as a managed service, Aperture Cloud, or can be self-hosted within your infrastructure.
1. Sign up to Aperture Cloud
For signing up, head over to Aperture Cloud. For detailed instructions, refer to our step-by-step guide.
2. Pick your Integration
These are two main modes on how to get started with Aperture.
- Aperture Serverless
- Aperture for Infrastructure
The Serverless mode is the quickest way to start using Aperture.
3. Get your API key
In Aperture Cloud, authentication for SDK integrations is handled using API keys. These keys can be found in the Aperture Cloud UI. For detailed instructions on locating API Keys, refer to the API Keys section.
4. Install SDK and Define Control Points
Aperture provides SDKs for various languages. You can find the SDKs and installation instructions here.
- TypeScript
- Python
- Go
npm install @fluxninja/aperture-js
pip install aperture-py
go get github.com/fluxninja/aperture-go/v2
Connect to Aperture Cloud by creating an Aperture Client with your organization's address and API Key.
- TypeScript
- Python
- Go
Define a Control Point
Once the SDK is connected to Aperture Cloud, you can create a feature control point anywhere within your code. For example, before executing the business logic of a specific API, you can create a feature control point that can control the execution flow of the API and can reject the request based on the policy defined in Aperture.
Let's create a feature control point in the following code snippet.
- TypeScript
- Python
- Go
The code snippet below shows how to wrap your
Control Point within the StartFlow
call while
also passing labels and cacheKey
to Aperture
Agents.
- The function
Flow.ShouldRun()
checks if the flow allows the request. - The
Flow.End()
function is responsible for sending telemetry. - The
flow.CachedValue().GetLookupStatus()
function returns the status of the cache lookup. The status can beHit
orMiss
. - If the status is
Hit
, theflow.CachedValue().GetValue()
function returns the cached response. - The
flow.SetCachedValue()
function is responsible for setting the response in Aperture cache with the specified TTL (time to live).
The code snippet below shows how to wrap your
Control Point within the start_flow
call while
passing labels and cache keys to Aperture.
Caching mechanism allows you to store the response of a request in the Aperture. This feature is useful when you want to cache the response from external or internal services and use it for subsequent requests. There are two types of cache key that can be passed to Aperture:
result_cache_key
- This key is useful to store the response of the request in Aperture. For example, the result of heavy tasks such as database query, a third-party API call which later can be used for subsequent requests if requested within the TTL. This removes the need to perform the same task again.global_cache_keys
- Using these keys, a global cache value can be set up, which can be accessed throughput anywhere in the application.
Each of these keys is associated with a TTL, a cache expiration time.
This is how you can create a feature control point in your code. The complete example is available here.
5. Create Your Policy
Within the Aperture UI, navigate to the policy in tab in the sidebar menu, and
click the Create Policy
button in the upper-right corner. There you can pick
the blueprint that best aligns with your needs. After a few clicks, you'll be
directed to a screen where you can input the necessary parameters to generate
the policy.
For more details on how to create a policy, follow our step-by-step guide.
There are two ways to integrate Aperture into your infrastructure. The first option includes a cloud-hosted controller and self-managed agents to ensure minimal performance impact. The second option involves hosting Aperture entirely within your infrastructure, making it perfect for air-gapped environments.
3. Set Up the Environment
The Aperture Agent can be installed in various modes. For installation steps, see Agent docs under Aperture For Infrastructure.
For more details on fully self-hosted installation, refer to the Self-hosted section.
4. Integrate with Aperture
Here are various Integrations methods with Aperture
5. Map to Aperture SaaS Controller
Aperture Cloud authenticates requests from integrations using API keys, which are created for your project and can be found within the Aperture Cloud UI. Copy the API key and save it in a secure location. This key will be used during the configuration of Self-hosted Agents. For detailed instructions on locating API Keys, refer to the API Keys section.
Using the API key, you can map your integration to the Aperture Cloud. See FluxNinja Cloud Extension for more details.
6. Create Your Policy
For more details on how to create a policy, follow our step-by-step guide.