This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: "service-hive" | |
| namespace: "rsyslog" | |
| spec: | |
| ports: | |
| - port: 514 | |
| targetPort: 514 | |
| protocol: TCP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: "rsyslog" | |
| namespace: "rsyslog" | |
| annotations: | |
| service.beta.kubernetes.io/aws-load-balancer-type: "nlb" | |
| alb.ingress.kubernetes.io/scheme: internal | |
| service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: "environment=stage,app=rsyslog" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| read -p "Enter Cluster name : " CLUSTER_NAME | |
| read -p "Enter the Namespace you want to use: " SERVICE_ACCOUNT_NAMESPACE | |
| AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text) | |
| OIDC_PROVIDER=$(aws eks describe-cluster --name ${CLUSTER_NAME} --query "cluster.identity.oidc.issuer" --output text | sed -e "s/^https:\/\///") | |
| read -r -d '' TRUST_RELATIONSHIP <<EOF | |
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Namespace | |
| metadata: | |
| name: demo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: ServiceAccount | |
| metadata: | |
| name: demo | |
| namespace: demo | |
| annotations: | |
| eks.amazonaws.com/role-arn: arn:aws:iam::11111111:role/rolename |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: eks-iam-test | |
| namespace: demo | |
| spec: | |
| replicas: 1 | |
| selector: | |
| matchLabels: | |
| app: eks-iam-test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| from datetime import datetime, timedelta | |
| import time | |
| client = boto3.client('ec2', region_name='us-east-1') | |
| ec2Usedamis = client.describe_instances() | |
| ec2UsedamiList=[] | |
| oldamilist = [] | |
| for ec2ami in range(len(ec2['Reservations'])): | |
| ec2UsedamiList.append(ec2['Reservations'][ec2ami]['Instances'][0]['ImageId']) | |
| createdAMI = client.describe_images(Owners=['self']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| import datetime | |
| import time | |
| ec2 = boto3.client('ec2', region_name='us-east-1') | |
| instances=ec2.describe_instances() | |
| cloudwatch = boto3.client('cloudwatch') | |
| for instance in range(len(instances['Reservations'])): | |
| instanceID=instances['Reservations'][instance]['Instances'][0]['InstanceId'] | |
| instanceType = instances['Reservations'][instance]['Instances'][0]['InstanceType'] | |
| for tag in instances['Reservations'][instance]['Instances'][0]['Tags']: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| client = boto3.client('elbv2',region_name='us-east-1') | |
| elb = client.describe_load_balancers() | |
| for lb in range(len(elb['LoadBalancers'])): | |
| ALBName = elb['LoadBalancers'][lb]['LoadBalancerName'] | |
| ALBArn = elb['LoadBalancers'][lb]['LoadBalancerArn'] | |
| if elb['LoadBalancers'][lb]['Type'] == "application": | |
| elblistener = client.describe_listeners(LoadBalancerArn=elb['LoadBalancers'][lb]['LoadBalancerArn']) | |
| try: | |
| SSLPolicy = elblistener['Listeners'][0]['SslPolicy'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| # Change this - Add the Tag Key to look for in ASG | |
| asgStopTagKey = "status" | |
| # Change this - Add the Tag Value to look for in ASG | |
| asgStopTagValue = "off" | |
| asgDesiredCount = 0 | |
| asgMinValue = 0 | |
| # Change this - Add the Tag Key to look for in EC2 | |
| ec2StopTagKey = "status" | |
| # Change this - Add the Tag Value to look for in EC2 |