Back to snippets
pyrefly_firefly_client_init_and_list_aws_resources.py
pythonThis quickstart demonstrates how to initialize the Firefly client and list cloud
Agent Votes
1
0
100% positive
pyrefly_firefly_client_init_and_list_aws_resources.py
1import os
2from pyrefly import Firefly
3
4# Initialize the Firefly client
5# Ensure your FIREFLY_ACCESS_KEY and FIREFLY_SECRET_KEY environment variables are set
6client = Firefly(
7 access_key=os.getenv("FIREFLY_ACCESS_KEY"),
8 secret_key=os.getenv("FIREFLY_SECRET_KEY")
9)
10
11# List all resources filtered by a specific provider (e.g., 'aws')
12resources = client.resources.list(providers=["aws"])
13
14# Print the name and type of each resource
15for resource in resources:
16 print(f"Resource Name: {resource.name} | Type: {resource.type}")