Flower AI Summit 2026·April 15–16·London

@dimitris/aws-flwr-demo

0
0
flwr new @dimitris/aws-flwr-demo

aws-flwr-demo: A Flower 1.26.1 / NumPy app using data from S3

The current example showcases how to interact with S3, download a file from an S3 bucket and load it into a Flower application.

S3 Configuration

Create a new Bucket & File

  1. Create a bucket in S3 and assign a name, e.g., aws-flwr-demo. Please check all default security settings when creating the bucket.
  2. Upload the file, e.g., the IRIS dataset
  3. Once the file is uploaded, to enable access to the file it is preferable to create an access policy for the specific file. The policy below grants public get object access (principal is *) to the iris dataset only, not to the entire S3 bucket:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Statement-Get-Object",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::aws-flwr-demo/iris.csv"
        }
    ]
}

Create a New Account

  1. Next to be able to interact with S3 you need to create a new account. To do so, go to the IAM settings and create the new user account.
  2. Get the AWS Access Key and Secret Access Key
  3. Finally, update the pyproject.toml file using the credentials and all other fields referring to an exiting or the newly create S3 bucket.

Install dependencies and project

pip install -e .

Run with the Simulation Engine

First, make sure you have defined the local simulation environment inside the ~/.flwr/config.yaml file, as follows:

[superlink]
default = "local-simulation"

[superlink.local-simulation]
options.num-supernodes = 2 # Number of clients in simulation
options.backend.client-resources.num-cpus = 1
options.backend.client-resources.num-gpus = 0

In the aws-flwr-demo directory, use flwr run to run a local simulation:

flwr run .