AWS – Lambda: kubectl

An example of how you can create entities in Kubernetes using AWS Lambda. The function will be in Python3, so we will use Kubernetes Python Client More usage examples can be found here. Since AWS Lambda does not support this package, we will pack the “kubernetes” and “boto3” modules in our function. “boto3” is needed … Continue reading "AWS – Lambda: kubectl"

FIX ERROR – AWS Lambda Python: “main() takes 0 positional arguments but 2 were given”

When trying to execute the Lambda Python function, the following error occurs: { "errorMessage": "main() takes 0 positional arguments but 2 were given", "errorType": "TypeError", "stackTrace": [ " File \"/var/runtime/bootstrap.py\", line 131, in handle_event_request\n response = request_handler(event, lambda_context)\n" ] }   Solution: From the message, we see that we use the “main” function as a … Continue reading "FIX ERROR – AWS Lambda Python: “main() takes 0 positional arguments but 2 were given”"

AWS – Script to get metrics from CloudWatch

Python3 sample script to get metrics from AWS CloudWatch. In the example, we get the maximum value in the last minute and display only the value, this is necessary if you want to collect metrics for example in Zabbix.   Script:

FIX ERROR – CentOS+Nginx+Jenkins: 502 Bad Gateway

When running Nginx as a reverse proxy to Jenkins on CentOS, a 502 error may occur. Nginx error log will be as follows: 2020/05/07 13:32:33 [crit] 9665#9665: *1 connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream, client: 1.2.3.4, server: jenkins.artem.services, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:8080/”, host: “jenkins.artem.services”   Solution: Reason SELinux. … Continue reading "FIX ERROR – CentOS+Nginx+Jenkins: 502 Bad Gateway"