AWS - Reference
This section documents the current AWS FOCUS workflow modules used by eraXplor.
Main Application Module
Entry Point
AWS service package for the eraXplor FOCUS workflow.
This package exposes the AWS CLI entry point implemented in
core.services.aws.__main__ and the supporting utility modules under
core.services.aws.utils.
main()
Orchestrates and manages dependencies of AWS FOCUS export workflow.
Source code in src/core/services/aws/__main__.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
This is the primary CLI entry point for configuring and downloading AWS FOCUS exports.
Utility Modules
Banner Utilities
Shared utility helpers for eraXplor service packages.
banner()
Generates a banner and copyright notice for the eraXplor application.
Creates an ASCII art banner using the 'slant' font with the application name, along with a formatted copyright notice containing version information and contact details.
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
callable
|
A tuple containing two strings: - banner_format (str): ASCII art banner with the text "eraXplor" - copyright_notice (str): Formatted copyright and version information |
Example
banner_format, copyright_notice = banner() print(banner_format) print(copyright_notice)
Note
The copyright year is currently set to 2025 and should be updated annually. The version number reflects the current release version of the eraXplor package.
Source code in src/core/services/utils/banner_utils.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
Responsible for rendering styled ASCII banners and displaying copyright information used in the CLI interface.
Parser Utilities
Moudle for parsing command line arguments for cost export utility.
parser()
Parser for the cost export utility.
Source code in src/core/services/aws/utils/focus_parser_utils.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
parser_command_handler(arg_parser)
parser_command_handler
Handles command mode input from the user or sets a default value to "configure".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg_parser
|
list[ArgumentParser]
|
The parser objects. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Return a |
Source code in src/core/services/aws/utils/focus_parser_utils.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
parser_granularity_handler(arg_parser)
parser_granularity_handler
Handles the granularity input from the user or sets a default value to "monthly".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg_parser
|
list[ArgumentParser]
|
The parser objects. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Return a |
Source code in src/core/services/aws/utils/focus_parser_utils.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
parser_profile_handler(arg_parser)
parser_profile
Handles the profile input from the user or set a default value to "default".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg_parser
|
list[ArgumentParser]
|
The parser objects. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Returns a |
Source code in src/core/services/aws/utils/focus_parser_utils.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
parser_region_handler(arg_parser)
parser_region_handler
Handles the region input from the user or sets a default value to "us-east-1".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg_parser
|
list[ArgumentParser]
|
The parser objects. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Returns a |
Source code in src/core/services/aws/utils/focus_parser_utils.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
parser_stack_name_handler(arg_parser)
parser_stack_name_handler
Handles the stack name input from the user or sets a default value to "CID-DataExports-Source".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg_parser
|
list[ArgumentParser]
|
The parser objects. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Returns a |
Source code in src/core/services/aws/utils/focus_parser_utils.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
Contains the command parsing helpers used to validate CLI input and normalize workflow options.
Export Stack Utilities
Utility functions for automating AWS Data Exports using CID CloudFormation.
build_focus_stack_parameters(destination_account_id, source_account_ids=None, resource_prefix='cid', focus_time_granularity='DAILY')
Build CloudFormation parameters for CID Data Exports stack (FOCUS only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
destination_account_id
|
str
|
AWS account ID where exports are delivered. |
required |
source_account_ids
|
list[str] | None
|
AWS account IDs to collect exports from. |
None
|
resource_prefix
|
str
|
Prefix for all CID-created AWS resources. |
'cid'
|
focus_time_granularity
|
str
|
Export time granularity. One of HOURLY, DAILY, MONTHLY. Changing this after initial deployment requires a full stack redeployment and data purge. Defaults to MONTHLY. |
'DAILY'
|
Source code in src/core/services/aws/utils/aws_focus_export_stack_utils.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
deploy_focus_stack(stack_name='CID-DataExports-Source', profile_name='default', region='us-east-1', destination_account_id=None, source_account_ids=None, resource_prefix='cid', focus_time_granularity='MONTHLY', wait=True)
Deploy or update the CID Data Exports CloudFormation stack for FOCUS exports.
This uses the AWS-managed CloudFormation template from the Cloud Intelligence Dashboards guidance and enables only FOCUS export management.
Full list of CloudFormation template parameters and their defaults:
| Parameter | Template default | This utility |
|---|---|---|
| DestinationAccountId | (required) | current account or arg |
| ResourcePrefix | "cid" | "cid" |
| ManageCUR2 | (required) yes/no | "no" (FOCUS only) |
| ManageFOCUS | (required) yes/no | "yes" |
| ManageCOH | (required) yes/no | "no" |
| ManageCarbon | (required) yes/no | "no" |
| SourceAccountIds | (optional, comma list) | current account or arg |
| FOCUSTimeGranularity | "HOURLY" | "MONTHLY" (configurable) |
| CUR2TimeGranularity | "HOURLY" | not passed (not used) |
| LegacyLocalBucket | "yes" | "no" (fresh deployments) |
| SecondaryDestinationBucket | "" | not passed (not used) |
| LakeFormationEnabled | "no" | not passed (template default) |
| EnableSCAD | yes/no | not passed (template default) |
| EnableIAMPrincipalData | yes/no | not passed (template default) |
| RolePath | "/" | not passed (template default) |
| AddScheduleForBlockingWrite | "no" | not passed (template default) |
| DisableWriteCronSchedule | "0 1 * * ? *" | not passed (template default) |
| EnableWriteCronSchedule | "0 3 * * ? *" | not passed (template default) |
Note: changing focus_time_granularity on an existing stack requires a full stack redeployment, data purge in the destination bucket, and a backfill request to AWS. Do not change it lightly after initial deployment.
Source code in src/core/services/aws/utils/aws_focus_export_stack_utils.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
Contains the CloudFormation orchestration helpers that create or update the AWS FOCUS export infrastructure.
Fetch Utilities
Module for fetching FOCUS Parquet files from AWS S3.
download_parquet_files(profile_name='default', region='us-east-1', stack_name='CID-DataExports-Source')
Downloads FOCUS Parquet files from AWS S3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_name
|
str
|
AWS profile name. |
'default'
|
region
|
str
|
AWS region where the stack is deployed. |
'us-east-1'
|
stack_name
|
str
|
CloudFormation stack name that owns FOCUS resources. |
'CID-DataExports-Source'
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of paths to the downloaded Parquet files. |
Source code in src/core/services/aws/utils/aws_focus_fetch.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
Provides functionality for downloading generated Parquet export files after the AWS export pipeline has produced them.