Data Services

Connecting to Synoptic cloud resources: supported authentication methods

Synoptic exchanges data with providers and partners through Amazon Web Services (AWS): uploading to or reading from Amazon S3, receiving messages from Amazon SQS queues, and a few other services. This page lists the ways you can authenticate with us, how to set each one up, and examples of reading files from a bucket or messages from a queue.

Whichever method you choose, the access is the same: we grant your identity exactly the data it needs, such as writing under one key prefix or reading from one queue, and nothing else. The methods differ only in how you prove who you are.

To get started, or for help with any of this, email providers@synopticdata.com. Related guides:

Choosing a method

We recommend the first method that fits where your systems run. All but the last give you temporary credentials that expire after an hour, so there's no long-lived secret to store, rotate, or leak.

Method

Best for

You send us

We send you

AWS role

Systems running in your own AWS account

Your AWS account ID

A role ARN, and an external ID if you want one

Microsoft Azure identity

Systems on Azure, using a managed identity or app registration

Your Entra ID tenant ID, the identity's object ID, and the token audience

A role ARN

Google Cloud service account

Systems on Google Cloud

The service account's unique ID, and the token audience

A role ARN

Certificates from your own CA

Anywhere you run a certificate authority, including on-premises

Your CA's certificate (public) and the certificate subject CN you'll use

A role ARN, a trust anchor ARN and a profile ARN

Access key

When none of the above is possible

Nothing

An access key and secret, by an expiring download link

Once your access is set up, we email you a connection guide with your exact ARNs filled in, along with Python examples for each kind of access you have.

What we can grant

  • Upload to S3: write objects under your own key prefix, through one of our S3 Multi-Region Access Points or in a bucket. See Pushing data via Amazon S3.

  • Read from S3: list and download objects under a key prefix in a bucket. See Amazon S3-based data delivery.

  • Notifications of new files: an SQS queue of your own that receives an event each time a new file arrives under your prefix. Combined with read access, you can fetch each file as soon as it lands. See New-file notifications through a dedicated SQS queue.

  • Send to or receive from SQS queues, publish to SNS topics, and write to or read from Kinesis data streams, where your data exchange calls for them.

Setting up each method

Each method ends with a boto3.Session in Python, named session, which the examples below use. Equivalent AWS SDKs exist for most languages.

AWS role

Send us the 12-digit ID of the AWS account your systems run in. We create a role in our account that trusts yours, and send you its ARN. Your account then decides which of its own users and roles may assume it: give them sts:AssumeRole on our role ARN in your IAM policies. No credentials change hands.

The simplest way to use it is an AWS profile that assumes the role for you, and renews the credentials as they expire. In ~/.aws/config:

[profile synoptic]
role_arn = <the role ARN we send you>
source_profile = <your own AWS profile>
# Only if we agreed an external ID:
external_id = <the external ID>

On EC2, ECS or Lambda, use credential_source = Ec2InstanceMetadata, EcsContainer or Environment instead of source_profile. Then:

Python
import boto3

session = boto3.Session(profile_name="synoptic")

Microsoft Azure identity

Your Azure workload, usually with a managed identity, gets a Microsoft Entra ID token and exchanges it with AWS for temporary credentials. There are no keys. Send us:

  • Tenant ID: your Entra ID directory (tenant) ID.

  • Object ID: the object ID of the managed identity, or of your app registration's service principal. This is the sub claim in its tokens.

  • Audience: the application ID URI or client ID your identity requests its token for, such as api://synoptic-ingest, usually an app registration in your tenant.

Tell us if that app issues v2.0 tokens.

Only tokens from that tenant, for that audience and that identity, can assume the role. With pip install azure-identity boto3:

Python
import boto3
from azure.identity import ManagedIdentityCredential

# A user-assigned managed identity: ManagedIdentityCredential(client_id="<its client ID>").
# Elsewhere, DefaultAzureCredential() also works.
token = ManagedIdentityCredential().get_token("<audience>/.default").token
credentials = boto3.client("sts", region_name="us-west-2").assume_role_with_web_identity(
    RoleArn="<the role ARN we send you>",
    RoleSessionName="synoptic",
    WebIdentityToken=token,
)["Credentials"]
session = boto3.Session(
    aws_access_key_id=credentials["AccessKeyId"],
    aws_secret_access_key=credentials["SecretAccessKey"],
    aws_session_token=credentials["SessionToken"],
)

The credentials last an hour: repeat this before then in long-running processes. Alternatively, write the token to a file you keep current and set AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE; boto3.Session() then renews the credentials itself.

Google Cloud service account

Your service account gets a Google ID token and exchanges it with AWS for temporary credentials. There are no keys. Send us:

  • Unique ID: the service account's numeric unique ID (shown as "Unique ID" or OAuth 2 client ID in the Google Cloud console), not its email address.

  • Audience: the audience your service account requests its ID token for. We can suggest one, such as https://sts.amazonaws.com/synoptic.

On Compute Engine, Cloud Run, Cloud Functions or GKE with Workload Identity, the token comes from the metadata server. With pip install google-auth requests boto3:

Python
import boto3
import google.auth.transport.requests
import google.oauth2.id_token

token = google.oauth2.id_token.fetch_id_token(google.auth.transport.requests.Request(), "<audience>")
credentials = boto3.client("sts", region_name="us-west-2").assume_role_with_web_identity(
    RoleArn="<the role ARN we send you>",
    RoleSessionName="synoptic",
    WebIdentityToken=token,
)["Credentials"]
session = boto3.Session(
    aws_access_key_id=credentials["AccessKeyId"],
    aws_secret_access_key=credentials["SecretAccessKey"],
    aws_session_token=credentials["SessionToken"],
)

The credentials and the token each last about an hour: fetch a new token and repeat this before then in long-running processes.

Certificates from your own certificate authority

If you run a certificate authority (CA), your systems can use certificates it issues, through IAM Roles Anywhere. This works from anywhere: on-premises, or any cloud. Send us:

  • Your CA certificate, as PEM. It's public, so email is fine. Never send a private key.

  • The subject CN of the certificates you'll use, such as yourorg-ingest. Any certificate your CA issues with that CN can assume the role.

We send you a role ARN, a trust anchor ARN and a profile ARN. Issue an end-entity certificate with that CN from your CA, keep its private key on the machine that uses it, and install AWS's credential helper, aws_signing_helper. Then, in ~/.aws/config:

[profile synoptic]
credential_process = aws_signing_helper credential-process --certificate /path/to/certificate.pem --private-key /path/to/private-key.pem --trust-anchor-arn <trust anchor ARN> --profile-arn <profile ARN> --role-arn <role ARN>
region = us-west-2

boto3 runs the helper and renews the credentials as they expire:

Python
import boto3

session = boto3.Session(profile_name="synoptic")

You issue and renew your own certificates; when you replace your CA certificate itself, send us the new one.

Access key

If none of the above is possible, we can issue an access key and secret. We email you a link to download them, which works for 24 hours. Store them in a secrets manager, never in code, and expect to replace them at least once a year. Add them to ~/.aws/credentials:

[synoptic]
aws_access_key_id = <access_key_id from the downloaded file>
aws_secret_access_key = <secret_access_key from the downloaded file>
Python
import boto3

session = boto3.Session(profile_name="synoptic")

If a key may have been exposed, tell us right away and we'll replace it.

Examples

Each uses the session from your method above. Replace the values in angle brackets with the ones in your connection guide.

Read files from a bucket

With read access, you can list and download objects under your prefix. Listing outside it is refused.

Python
s3 = session.client("s3")
bucket, prefix = "<bucket name>", "<your prefix>/"

paginator = s3.get_paginator("list_objects_v2")
for page in paginator.paginate(Bucket=bucket, Prefix=prefix):
    for obj in page.get("Contents", []):
        print(obj["Key"], obj["Size"], obj["LastModified"])
        s3.download_file(bucket, obj["Key"], obj["Key"].rsplit("/", 1)[-1])

Reading through a Multi-Region Access Point works the same way, with the access point's ARN as the Bucket. Those requests are signed with SigV4A, which needs pip install "boto3[crt]".

Receive messages from a queue

Long polling waits up to 20 seconds for messages, so a loop like this receives them within moments of arrival without busy-waiting. Delete each message once you've handled it; otherwise it's delivered again after its visibility timeout.

Python
queue_arn = "<queue ARN>"
_, _, _, region, account, queue_name = queue_arn.split(":")
sqs = session.client("sqs", region_name=region)
queue_url = sqs.get_queue_url(QueueName=queue_name, QueueOwnerAWSAccountId=account)["QueueUrl"]

while True:
    response = sqs.receive_message(QueueUrl=queue_url, MaxNumberOfMessages=10, WaitTimeSeconds=20)
    for message in response.get("Messages", []):
        print(message["Body"])
        sqs.delete_message(QueueUrl=queue_url, ReceiptHandle=message["ReceiptHandle"])

Fetch each new file as it arrives

With a notification queue and read access together, each message on your queue is the S3 event for one new file: download it, then delete the message. S3 URL-encodes object keys in its events, so decode them before use. If your events come through EventBridge instead, the key is in detail.object.key, unencoded; this handles both. For more on these queues and their messages, see New-file notifications through a dedicated SQS queue.

Python
import json
from urllib.parse import unquote_plus

s3 = session.client("s3")
queue_arn = "<your notification queue ARN>"
_, _, _, region, account, queue_name = queue_arn.split(":")
sqs = session.client("sqs", region_name=region)
queue_url = sqs.get_queue_url(QueueName=queue_name, QueueOwnerAWSAccountId=account)["QueueUrl"]


def new_objects(body):
    """(bucket, key) for each new object in one S3 event message."""
    event = json.loads(body)
    if "Records" in event:  # S3 event notification
        for record in event["Records"]:
            if record.get("eventName", "").startswith("ObjectCreated:"):
                yield record["s3"]["bucket"]["name"], unquote_plus(record["s3"]["object"]["key"])
    elif event.get("detail-type") == "Object Created":  # through EventBridge
        yield event["detail"]["bucket"]["name"], event["detail"]["object"]["key"]


while True:
    response = sqs.receive_message(QueueUrl=queue_url, MaxNumberOfMessages=10, WaitTimeSeconds=20)
    for message in response.get("Messages", []):
        for bucket, key in new_objects(message["Body"]):
            s3.download_file(bucket, key, key.rsplit("/", 1)[-1])
            print(f"downloaded s3://{bucket}/{key}")
        sqs.delete_message(QueueUrl=queue_url, ReceiptHandle=message["ReceiptHandle"])

Your queue keeps messages for up to 14 days, so if your consumer is down for a while, it catches up when it restarts. A message can occasionally be delivered more than once, so make processing safe to repeat: downloading the same file twice is harmless.

Troubleshooting

  • AccessDenied: the error names the action and resource that were refused. Usually it's a key outside your prefix, a different bucket or queue, or an action your access doesn't include, such as listing an upload-only access point. Check the values in your connection guide, then contact us if it still fails.

  • Can't assume the role: for Azure and Google Cloud, check the token is for the agreed audience and comes from the identity you gave us. For certificates, check the certificate's subject CN matches exactly and that it was issued by the CA you sent us. For an AWS role, check your own IAM policies allow sts:AssumeRole on our role ARN.

  • Expired credentials: temporary credentials last an hour. The profile-based setups renew them automatically; otherwise, assume the role again.

Questions or problems: providers@synopticdata.com.