Skip to content

Instantly share code, notes, and snippets.

View Akintola's full-sized avatar
🏠
Working from home

Franck ADJIBAO Akintola

🏠
Working from home
View GitHub Profile
@Akintola
Akintola / bash.sync-s3-buckets-to-azure-blob-container.sh
Created March 18, 2024 17:10
Sync files from S3 to Azure Blob Container
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export DISPLAY=:0.0
# AWS S3 Bucket Details
AWS_BUCKET=""
AWS_REGION=""
# Export AWS credentials or use AWS profile
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "ec2:*",
"Effect": "Allow",
"Resource": "*"
},
{
"Effect": "Allow",
@Akintola
Akintola / aws.eks.create-aws-iam-group-for-eks-cluster-access.sh
Last active September 25, 2022 21:59
Create IAM group which will have EKS admin access
aws iam create-group --group-name eks_admin
ADMIN_GROUP_POLICY=$(echo -n '{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAssumeOrganizationAccountRole",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::'; echo -n "$ACCOUNT_ID"; echo -n ':role/eks_admin"
@Akintola
Akintola / aws.eks.create-aws-iam-role-for-eks-cluster-access.sh
Last active September 27, 2022 12:10
Create IAM role which will have EKS admin access
POLICY=$(echo -n '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws:iam::'; echo -n "$ACCOUNT_ID"; echo -n ':root"},"Action":"sts:AssumeRole","Condition":{}}]}')
echo ACCOUNT_ID=$ACCOUNT_ID
echo POLICY=$POLICY
aws iam create-role \
--role-name eks_admin \
--description "Kubernetes administrator role (for AWS IAM Authenticator for Kubernetes)." \
--assume-role-policy-document "$POLICY" \
--output text \
input {
rabbitmq {
id => "rabbitmq_logs"
host => "localhost"
port => 5672
vhost => "/"
queue => "hello"
ack => false
}
}
input {
file {
path => "/home/user/apache/logs/acess_log"
start_position => "beginning"
}
}
filter {
grok {
match => {"message" => "%{COMBINEDAPACHELOG}"}
curl -XPOST -H "Content-Type: application/json" "127.0.0.1:9200/_bulk?pretty" -d '
{ "create" : { "_index" : "reviews", "_id" : "1" } }
{ "id": "1", "client" : "Johni", "message": "I was at an event at the Garden and found Staghorn right near there so went with some friends for dinner. What a nice restaurant. The steak of course was great and the drinks were made nice and strong. Service was just as good. I would definitely suggest have dinner one night if you are in the area!!!" , "date": "2021-01-02"}
{ "create" : { "_index" : "reviews", "_id" : "2" } }
{ "id": "2", "client" : "John", "message": "Awful start to finish. went on a nice thursday night. Zero atmosphere, overpriced menu, average food." , "date": "2021-01-02"}
{ "create" : { "_index" : "reviews", "_id" : "3" } }
{ "id": "3", "client" : "Torsten", "message": "It was just awesome. Fo those who want to relax and enjoy a delicious meal in a great atmosphere, I truly recommend that restaurant." , "date": "2021-01-02"}
{ "create" : { "_index" : "re
curl -XPUT -H "Content-Type: application/json" "127.0.0.1:9200/employees?pretty" -d
{
"mappings": {
"properties": {
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/calls_details_2021/_search?size=0&pretty" -d '
{
"aggs": {
"calls_per_caller_name": {
"terms": {
"field": "caller_name"
},
"aggs": {
"duration_sum": {
"sum": {
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/calls_details_2021/_search?size=0&pretty" -d '
{
"aggs": {
"calls_per_caller_name": {
"terms": {
"field": "caller_name"
},
"aggs": {
"duration_sum": {
"sum": {