Providing Data

Pushing data via Amazon S3

Synoptic data aggregation leverages Amazon’s S3 object storage service as a platform for receiving data from providers in a secure and highly available manner.

About S3

S3 stands for “Simple Storage Service” and it is an object storage service operated by Amazon’s AWS, which is used to upload and download data. Objects in this context can be thought of as files with names. Using standardized technical interfaces, any provider can securely connect to the Amazon S3 service, and publish their data files.

S3 requires object storage service interfaces, you generally cannot use older technologies like SFTP or SCP to interface with any object storage services.

Synoptic leverages AWS functionalities on top of S3, such as services to trigger automatic processing of newly uploaded files to quickly ingest the submitted data.

Amazon S3 is one of many object storage services which generally utilize the same mechanics for interaction. These include Pandas, and other cloud vendors also operate equivalent services.

Core concepts

The two main concepts in s3 are the bucket: isolated inventories of objects, and keys: (not to be confused with access keys) which is the location of the object - essentially the file path. Synoptic gives providers exclusive access to a single bucket for publishing data.

You can store an unlimited number of objects in a bucket, and the use of slashes in keys (e.g. a/b/c) is optional (the key is the whole string), but is used by some file browsers to organize objects.

We encourage using different objects to upload additional data. Using timestamp-related factors to define keys can be useful for optimizing reading, but the main efficiency considerations come from avoiding pushing data you already pushed, and avoiding overwriting existing data.

Synoptic’s ingest buckets

To facilitate data ingest, Synoptic uses multi-region access points (MRAP) as the front door for S3-based data object pushes. For providers, these function identically to any bucket.

For providers, our MRAPs mean your data pushes travel the minimum distance before reaching AWS infrastructure. Pushes from Europe will route to buckets in Europe, for instance. This reduces dependency on variably implemented global telecommunications infrastructure, and instead puts the load on the Amazon internet backbone.

For Synoptic, our MRAPs ensure that data pushed to our platform is reliably received even if the normal region for your data ingest is disrupted.

When our ingest team is configuring your push, we will share the MRAP bucket endpoint ARN and the path/key prefix which has been designated for your dataset. When using an MRAP endpoint, Synoptic only permits put_object events. This means you cannot list, read, move, or delete the objects currently in the bucket. For this reason it is important to follow the recommended naming conventions and ensure files published will not overwrite each other.

Accessing S3

You will need to access S3 either programmatically, or via a file browser tool like Transmit, much like SFTP. To authenticate there are 3 options we support, summarized below. For every method in full, including keyless access from Microsoft Azure, Google Cloud or certificates, with setup steps and code, see Connecting to Synoptic: supported authentication methods.

Authenticating with AWS Roles

The most robust way for us to provide you secure access to a bucket is to use AWS’s IAM system. If a provider already operates in AWS, we can simply permit a role from your account to write data to a bucket we own. That way we never have to exchange credentials.

In practice, we create an IAM role in our account that trusts your AWS account, and send you its ARN. Your systems assume that role: they ask AWS STS to exchange their own credentials for temporary credentials for our role, which last an hour and renew automatically. Your account decides which of its own users and roles may do that, by allowing them sts:AssumeRole on our role ARN in your IAM policies. If we agree an external ID, your systems pass it when assuming the role. See Set up credentials below, and AWS's guides to using IAM roles and access to roles in other accounts.

A provider who does not operate in AWS can also use a role without exchanging credentials: from Microsoft Azure or Google Cloud with your workload's own identity (web identity federation), or from anywhere with certificates issued by your own certificate authority (IAM Roles Anywhere). See Connecting to Synoptic: supported authentication methods for how each works and what to send us.

Authenticating with keys and secrets

A simpler but less preferred method to access an S3 bucket is provisioned keys and secrets. A provider can be securely provided these credentials, and then the code that publishes the data would use those values to access the bucket.

This is much less secure as compromised keys can be used by others. To reduce this risk, we require providers using keys to update them annually if not more frequently depending on your compliance requirements. Our ingest team will ensure you securely use these credentials, and are able to update them on our cycle.

AWS credentials are very different from Synoptic product credentials.

If this is the right option for you, we will provide credentials to you.

Accessing a bucket you own

A third option, which is really a variant of the first, is a reverse process, we can access an object storage that you own. If you are using AWS S3, we can work with you to configure role based access for our data provider account, and then we can read and track your data. If you use an alternative object store service, we would treat that as a fetch access, which is not addressed in this guide.

It is very secure for us to access a bucket in your control, but it does require you to have your own AWS account.

Programmatic access

Because S3 uses an open protocol, there are a variety of software tools and packages that can be used to connect. Because we are specifically addressing the Amazon AWS service, the easiest ways to implement the full authentication process would be to utilize one of the AWS Developer toolkits, such as boto3 for Python.


It would be best to refer to the documentation relevant to the toolkit you use, but the following functions will likely be used

  • Functions for targeting a bucket (we will give you the bucket reference)

  • Functions for uploading data (such as put object)

Functions for listing and reading data, such as list objects v2 and get object, aren't allowed through our MRAPs (see above), so a push can't read back what it wrote.

If you receive an error, read it carefully, it likely specifies a function you are calling which we likely did not grant permission to perform. As always, contact our provider help desk for any assistance.


Helpful scripts

The following scripts are examples, using python and boto3 of how you can interface with an S3 bucket

Set up credentials

boto3 finds credentials through its credential chain: a named profile, environment variables, or the instance or container role your code runs with. Keep credentials in configuration, never in your code.

With a role (recommended). Add a profile that assumes our role, in ~/.aws/config. boto3 then assumes it for you and renews the temporary credentials as they expire (see AWS's using an IAM role in a profile):

[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, instead of source_profile:
# credential_source = Ec2InstanceMetadata   (or EcsContainer, or Environment)

For Azure, Google Cloud or certificates, set up the session as described in Connecting to Synoptic: supported authentication methods; the upload code below is the same.

With an access key. Add the key we send you as a profile in ~/.aws/credentials, or set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables from your secrets manager:

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

Either way, your code then uses the profile:

Python
import boto3

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

It is recommended to use your own AWS account and request access to a bucket to send to. This is more secure and prevents the need for access key rotation in the future.

Upload a file to S3

Through an MRAP, the "bucket" is the MRAP ARN we send you, and requests are signed with SigV4A, which needs pip install "boto3[crt]". Write under the key prefix we give you.

Python
import boto3
from botocore.exceptions import ClientError

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


def upload_file_to_s3(file_path, bucket, s3_key):
    """
    Uploads a file to S3.
    Args:
        file_path (str): Local path to the file to be uploaded.
        bucket (str): The MRAP ARN (or bucket name) we gave you.
        s3_key (str): The key to write, under your prefix.
    Returns:
        bool: True if S3 stored the file.
    """
    try:
        s3.upload_file(file_path, bucket, s3_key)
    except ClientError as e:
        print(f"Upload of '{file_path}' failed: {e}")
        return False
    print(f"Uploaded '{file_path}' to '{s3_key}'.")
    return True


upload_file_to_s3("data.csv", "<MRAP ARN>", "<your prefix>/20261110/data.20261110120000.csv")

Confirming an upload. You can't list or read back objects through our MRAPs, and you don't need to: an upload that returns without an error has been stored by S3. If it raises, retry it, using the same key so a retry can't create a duplicate. If uploads keep failing, contact our provider help desk.