Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b54dfa4
Merging develop branch to Main branch. (#127)
muhammad-irfan-xgrid Dec 7, 2023
a364a97
Bump certifi from 2023.5.7 to 2023.7.22 in /tests/unit_test (#131)
dependabot[bot] Jan 16, 2024
a87ced4
Bump cryptography from 41.0.2 to 41.0.6 in /tests/unit_test (#130)
dependabot[bot] Jan 16, 2024
8506ffc
Bump werkzeug from 2.3.6 to 2.3.8 in /tests/unit_test (#129)
dependabot[bot] Jan 16, 2024
bc6ad67
Bump jinja2 from 3.1.2 to 3.1.3 in /tests/unit_test (#139)
dependabot[bot] Jan 17, 2024
5e6e1b8
Bump urllib3 from 1.26.16 to 1.26.18 in /tests/unit_test (#128)
dependabot[bot] Jan 17, 2024
f6b7e27
init
NilanshuBasnet Feb 19, 2024
53ce0c8
Slack Notification Added
NilanshuBasnet Mar 26, 2024
8d6dd20
List Untagged Resources
NilanshuBasnet Apr 2, 2024
5aef9ab
Added list of resources without propers tags to the notification mess…
NilanshuBasnet Apr 8, 2024
c50036e
Combined lambda to send notification to slack and email into one lambda.
NilanshuBasnet Apr 8, 2024
16abb5b
Added Subject to Email
NilanshuBasnet Apr 8, 2024
b863f2b
Integrating all files from "testingnb" Folder to xc3 project.
NilanshuBasnet Apr 11, 2024
12fd0e9
Added Cron job to list_fed_user lambda and made it to invoke "untagge…
NilanshuBasnet Apr 14, 2024
aa54e7f
Updated Untagged lambda to list only the untagged resources created b…
NilanshuBasnet Apr 14, 2024
1366291
final merged
jabbard Apr 16, 2024
36deab7
final merged
jabbard Apr 16, 2024
8c392d9
final merged
jabbard Apr 16, 2024
77db447
Invoked Untagged Resource Lambda
NilanshuBasnet Apr 16, 2024
b05c100
issue fixed with status code
jabbard Apr 16, 2024
7dbed67
for the demo
jabbard Apr 22, 2024
e70c961
resources based on fed usernames
jabbard Apr 25, 2024
2fd5ddd
Merge pull request #1 from jabbard/ActionItems
jabbard Apr 25, 2024
3e53dc4
arn bug fixed
jabbard Apr 25, 2024
fe61e86
fed-user.tf updated to invoke resource notification lambda
jabbard Apr 25, 2024
2fd909b
untagged.tf removed
jabbard Apr 25, 2024
007c582
Deleted Untagged Lambda and Updated Notification Lambda
NilanshuBasnet Apr 25, 2024
2f7b65d
minor changes
jabbard Apr 25, 2024
e0198a6
final push
jabbard Apr 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ Access to the "prod" environment is facilitated through a DNS URL, thanks to Rou

`ssh ubuntu@[instance-id] -i keypair.pem -o ProxyCommand='aws ec2-instance-connect open-tunnel --instance-id %h'`

6. Now XC3 will run at 05:00AM UTC every day to generate data and populate Grafana. Few lambdas (Total Account Cost and Project spend) will run twice in a month.
6. Go to AWS Systems Manager, select Parameter Store, and create a new parameter named "/{namespace}/region_names". Set the value as a dictionary with region IDs as keys and region names as values.

7. SSH into the private instance using EIC Endpoint to check if everything is working fine. Here replace [instance-id] needs to be replaced with ID

`ssh ubuntu@[instance-id] -i keypair.pem -o ProxyCommand='aws ec2-instance-connect open-tunnel --instance-id %h'`

8. Now XC3 will run at 05:00AM UTC every day to generate data and populate Grafana. Few lambdas (Total Account Cost and Project spend) will run twice in a month.

Note :
1. If data is not available in Grafana UI then follow the troubleshooting guide at the last section of this page.
Expand All @@ -172,6 +178,8 @@ case 1: If data is not showing into Grafana UI, there could be several reasons a

3. XC3 Budget Detail/IAM Role/User Workflow lambda may have failed to execute , please check Cloudwatch logs to address the issue.

4. Check if XC3's most expensive services data is missing, and if so, verify the existence of the corresponding SSM parameter in AWS Systems Manager. To address this issue, ensure you follow step 5 of the deployment instructions.

case 2: user not able to change/update/modify default dashboards in Grafana UI

1. You can't change/update default dashboards.
Expand Down
Binary file added User Manual Federated User.pdf
Binary file not shown.
50 changes: 50 additions & 0 deletions custom_dashboard/dummy_local/data_push1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import json
from prometheus_client import CollectorRegistry, Gauge, push_to_gateway

# Load the JSON data
with open('dummy_data1.json', 'r') as file:
data1 = json.load(file)

def push_to_prometheus(data1):
registry = CollectorRegistry()

# Create a single gauge with multiple labels
gauge = Gauge(
"FED_USER_Resource_Cost_List",
"FED USER Resource List And Cost",
labelnames=[
"resource_id",
"resource",
"account_id",
"region",
"resource_name",
"month"
],
registry=registry
)

# Iterate through the data and populate the gauge
for resource in data1['ec2']:
resource_id = resource['resource_id']
service = resource['resource']
cost = resource['cost']
account_id = resource['account_id']
region = resource['region']
month = resource['month']
resource_name = resource_id.split(':')[-1]

# Set the gauge value
gauge.labels(
resource_id=resource_id,
resource=service,
account_id=account_id,
region=region,
resource_name=resource_name,
month=month
).set(cost)

# Push the metrics to Prometheus Pushgateway
push_to_gateway('localhost:9091', job='pushgateway', registry=registry)

# Call the function to push data to Prometheus
push_to_prometheus(data1)
1 change: 1 addition & 0 deletions custom_dashboard/dummy_local/dummy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is reference file for the dummy data that Team 12 used to showcase the Local Host Dashboard in the presentation
150 changes: 150 additions & 0 deletions custom_dashboard/dummy_local/dummy_data1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"ec2": [
{
"resource_id": "arn:aws:lambda:ap-southeast-2:590183937261:function:xc3team12pradhumna-list_linked_accounts",
"cost": 120.50,
"region": "us-east-1",
"resource": "lambda",
"account_id": "Pradhumna-Dhungana",
"month": "January",
"resource_name": "xc3team12bhavabc-metadata-storage"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:123456789012:function:xc3team12pradhumna-iamrolesservicemapping",
"cost": 85.75,
"region": "ap-southeast-2",
"resource": "lambda",
"account_id": "Pradhumna-Dhungana",
"month": "February",
"resource_name": "xc3team12bhavabc-iamrolestografana"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:234567890123:function:xc3team12pradhumna-list_iam_users",
"cost": 67.30,
"region": "ap-southeast-2",
"resource": "lambda",
"account_id": "Pradhumna-Dhungana",
"month": "March",
"resource_name": "xc3team12bhavabc-iamrolesservicemapping"
},
{
"resource_id": "arn:aws:ec2:ap-southeast-2:345678901234:instance/i-0a3ea6b780458b3f5",
"cost": 215.00,
"region": "us-east-1",
"resource": "ec2",
"account_id": "Pradhumna-Dhungana",
"month": "April",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:456789012345:function:xc3team12pradhumna-project-cost-breakdown",
"cost": 50.25,
"region": "ap-southeast-2",
"resource": "lambda",
"account_id": "Nilanshu-Basnet",
"month": "January",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:567890123456:function:xc3team12pradhumna-iamrolestografana",
"cost": 33.10,
"region": "ap-southeast-2",
"resource": "lambda",
"account_id": "Nilanshu-Basnet",
"month": "February",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:s3:::xc3team12pradhumna-metadata-storage",
"cost": 45.00,
"region": "us-west-1",
"resource": "s3",
"account_id": "Nilanshu-Basnet",
"month": "March",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"

},
{
"resource_id": "arn:aws:s3:::xc3team12sb-metadata-storage",
"cost": 27.15,
"region": "us-west-1",
"resource": "s3",
"account_id": "Nilanshu-Basnet",
"month": "April",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:890123456789:function:xc3team12pradhumna-resource_parsing_lambda",
"cost": 95.00,
"region": "ap-southeast-2",
"resource": "lambda",
"account_id": "Nilanshu-Basnet",
"month": "January",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:901234567890:function:xc3team12pradhumna-list_iam_user_resources_cost",
"cost": 120.00,
"region": "ap-southeast-2",
"resource": "lambda",
"account_id": "Nilanshu-Basnet",
"month": "February",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:012345678901:function:xc3team12pradhumna-resource_list_lambda",
"cost": 60.40,
"region": "ap-southeast-2",
"resource": "lambda",
"account_id": "Nilanshu-Basnet",
"month": "March",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:590183937261:function:xc3team12pradhumna-total_account_cost",
"cost": 130.50,
"region": "ap-southeast-2",
"resource": "lambda",
"account_id": "Pradhumna-Dhungana",
"month": "April",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:s3:ap-southeast-2:590183937261:function:xc3team12pradhumna-most_expensive_service_lambda",
"cost": 175.75,
"region": "ap-southeast-2",
"resource": "s3",
"account_id": "Pradhumna-Dhungana",
"month": "January",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:590183937261:function:xc3team12pradhumna-cost_metrics_of_expensive_services",
"cost": 49.95,
"region": "eu-west-1",
"resource": "lambda",
"account_id": "Pradhumna-Dhungana",
"month": "February",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:ec2:ap-southeast-2:590183937261:function:xc3team12pradhumna-instancestatechange",
"cost": 23.20,
"region": "ap-southeast-2",
"resource": "ec2",
"account_id": "Nilanshu-Basnet",
"month": "March",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
},
{
"resource_id": "arn:aws:lambda:ap-southeast-2:590183937261:function:xc3team12pradhumna-project-spend-cost",
"cost": 88.40,
"region": "eu-west-1",
"resource": "lambda",
"account_id": "Nilanshu-Basnet",
"month": "April",
"resource_name": "xc3team12bhavabc-cost_metrics_of_expensive_services"
}
]
}

Empty file modified custom_dashboard/grafana_dashboards/associated-services.json
100644 → 100755
Empty file.
Loading