iandees / aws-billing-to-slack Goto Github PK
View Code? Open in Web Editor NEWSend a daily AWS cost report to a Slack channel of your choice.
License: MIT License
Send a daily AWS cost report to a Slack channel of your choice.
License: MIT License
The example doesn't work or provide much information.
There is a bit of setup with serverless to create a directory. And the service does not run with invoke function. Also the function does not show in the list.
serverless deploy list functions Serverless: Listing functions and their last 5 versions: Serverless: ------------- Serverless: hello: $LATEST, 1, 2
I get this error below on deployment
× Stack aws-billing-to-slack-prod failed to deploy (31s)
Environment: win32, node 12.13.0, framework 3.8.0, plugin 6.1.6, SDK 4.3.2
Credentials: Local, "default" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
The security token included in the request is invalid.
Is this expected?
Any fix @iandees & @dudeitssm
The sparklines often seem to be basically random. Here are two days in a row:
"S3" and "Other" correctly progress from left to right, but every other graph on day 1 bears no relationship to the graphs on day 2. (I opened each in an image viewer and rapidly flipped between the two, which turned out to be a great way to make comparisons easily.)
I can't discern any kind of a pattern here, nothing that hints at an underlying cause here. I'm sorry to submit an issue instead of a pull request — and, worse still, an issue that doesn't even hint at a solution.
Firstly just want to say that this is a pretty seamless app and works great, so thank you for creating it!
Is it possible to have some config that can be changed or a param added (like the slack webhook param) to choose the time interval of the cost data? We're a smaller company so a weekly summary on slack can be pretty useful instead of a daily one which can get a bit spammy in a hurry. Would appreciate your input on this, thanks!
Hi Team Can you Give Me the Detailed information about How to uses this Repo and And How to deploy
Im Facing Lot of issues to Deploy this Code in My Ubuntu 20.4 Server
@iandees Plz ........
I suspect that I'm not using one of the categories on which it's trying to report, so my usage cost is 0.
PS C:\Users\foo\bar\aws-billing-to-slack-master> serverless invoke --function report_cost --slack_url="https://hooks.slack.com/services/xxxx" --region eu-west-3
Serverless Warning --------------------------------------
A valid option to satisfy the declaration 'opt:credits_expire_date' could not be found.
Serverless Warning --------------------------------------
A valid option to satisfy the declaration 'opt:credits_remaining_date' could not be found.
Serverless Warning --------------------------------------
A valid option to satisfy the declaration 'opt:credits_remaining' could not be found.
{
"errorMessage": "float division by zero",
"errorType": "ZeroDivisionError",
"stackTrace": [
" File \"/var/task/handler.py\", line 77, in report_cost\n buffer += \"%-40s %s $%5.2f\\n\" % (service_name, sparkline(costs), costs[-1])\n",
" File \"/var/task/handler.py\", line 22, in sparkline\n scaled = (dp - lower) / width\n"
]
}
Error --------------------------------------------------
Error: Invoked function failed
at AwsInvoke.log (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\invoke\index.js:105:31)
at AwsInvoke.tryCatcher (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:729:18)
at _drainQueueStep (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues (C:\Users\foo\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:15:14)
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5)
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: win32
Node Version: 8.11.1
Framework Version: 1.57.0
Plugin Version: 3.2.2
SDK Version: 2.2.1
Components Core Version: 1.1.2
Components CLI Version: 1.4.0
PS C:\Users\foo\bar\aws-billing-to-slack-master>
The issue is that the [Not Found] is caused if the account does not have an alias.
I'd recommend have it pull the Account number as well as the account alias and if the alias is missing use the account number.
I have successfully deployed the application, but I get an error when I run it
{
"errorMessage": "Unable to import module 'handler': libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory",
"errorType": "Runtime.ImportModuleError",
"requestId": "07d1e5b6-4afe-41da-84e7-e9c44d91be4f",
"stackTrace": []
}
Anyone know how to fix it please help me.
Error:
Detected unrecognized CLI options: "--slack_url".
I tried deploying but got this error above. Any fix?
I got this error after having run npm install
:
PS C:\Users\foo\bar\aws-billing-to-slack-master> serverless deploy --slack_url="https://hooks.slack.com/services/xxxxx"
Serverless Warning --------------------------------------
A valid option to satisfy the declaration 'opt:credits_expire_date' could not be found.
Serverless Warning --------------------------------------
A valid option to satisfy the declaration 'opt:credits_remaining_date' could not be found.
Serverless Warning --------------------------------------
A valid option to satisfy the declaration 'opt:credits_remaining' could not be found.
Serverless: Generating requirements.txt from Pipfile...
Error --------------------------------------------------
Error: pipenv not found! Install it with 'pip install pipenv'.
at ServerlessPythonRequirements.pipfileToRequirements (C:\Users\foo\bar\aws-billing-to-slack-master\node_modules\serverless-python-requirements\lib\pipenv.js:28:13)
at ServerlessPythonRequirements.tryCatcher (C:\Users\foo\bar\aws-billing-to-slack-master\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\foo\bar\aws-billing-to-slack-master\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\foo\bar\aws-billing-to-slack-master\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromiseCtx (C:\Users\foo\bar\aws-billing-to-slack-master\node_modules\bluebird\js\release\promise.js:641:10)
at _drainQueueStep (C:\Users\foo\bar\aws-billing-to-slack-master\node_modules\bluebird\js\release\async.js:97:12)
at _drainQueue (C:\Users\foo\bar\aws-billing-to-slack-master\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\foo\bar\aws-billing-to-slack-master\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues (C:\Users\foo\bar\aws-billing-to-slack-master\node_modules\bluebird\js\release\async.js:15:14)
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5)
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: win32
Node Version: 8.11.1
Framework Version: 1.57.0
Plugin Version: 3.2.2
SDK Version: 2.2.1
Components Core Version: 1.1.2
Components CLI Version: 1.4.0
It was fixed by installing pipenv via pip:
PS C:\Users\foo\bar\aws-billing-to-slack-master> pip install pipenv
Collecting pipenv
Downloading https://files.pythonhosted.org/packages/13/b4/3ffa55f77161cff9a5220f162670f7c5eb00df52e00939e203f601b0f579/pipenv-2018.11.26-py3-none-any.whl (5.2MB)
|████████████████████████████████| 5.2MB 1.6MB/s
Collecting virtualenv (from pipenv)
Downloading https://files.pythonhosted.org/packages/c5/97/00dd42a0fc41e9016b23f07ec7f657f636cb672fad9cf72b80f8f65c6a46/virtualenv-16.7.7-py2.py3-none-any.whl (3.4MB)
|████████████████████████████████| 3.4MB 6.4MB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading https://files.pythonhosted.org/packages/ba/f8/50c2b7dbc99e05fce5e5b9d9a31f37c988c99acd4e8dedd720b7b8d4011d/virtualenv_clone-0.5.3-py2.py3-none-any.whl
Collecting certifi (from pipenv)
Downloading https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl (154kB)
|████████████████████████████████| 163kB 6.4MB/s
Requirement already satisfied: pip>=9.0.1 in c:\users\foo\appdata\roaming\python\python37\site-packages (from pipenv) (19.2.1)
Requirement already satisfied: setuptools>=36.2.1 in c:\users\foo\appdata\local\programs\python\python37\lib\site-packages (from pipenv) (40.8.0)
Installing collected packages: virtualenv, virtualenv-clone, certifi, pipenv
Successfully installed certifi-2019.9.11 pipenv-2018.11.26 virtualenv-16.7.7 virtualenv-clone-0.5.3
WARNING: You are using pip version 19.2.1, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Thank you for the plugin, it's very helpful.
I've been running it for about 3 weeks and I've noticed a slight difference in the slack reported costs compared to was AWS Cost explorer reports.
Please see the following example. The slack report on the 6th of April for the 5th of April reports EC2 and ELB costs slightly lower than what cost explorer reports for the 5th April.
You can also see that there's a similar issue for the day before.
I thought perhaps there was a permission issue, but there are no errors in the lambda log.
Do you have any suggestions about what might be going wrong?
$ serverless deploy --stage="prod" --param="slack_url=https://hooks.slack.com/services/-----/-------/9k50zckCscknrYecKNksBJXu"
Running "serverless" from node_modules
Deploying app-aws-cost to stage prod (us-east-1)
**× Stack app-aws-cost-prod failed to deploy (0s)**
Environment: linux, node 12.22.9, framework 3.3.0 (local) 3.29.0v (global), plugin 6.2.2, SDK 4.3.2
Credentials: Local, "default" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Error: spawn pipenv ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
at onErrorNT (internal/child_process.js:470:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
1 deprecation found: run 'serverless doctor' for more details
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.