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
| aws ec2 run-instances \ | |
| --image-id ami-xxxxxxxx \ | |
| --instance-type m4.large \ | |
| --security-group-ids sg-xxxxxxxx sg-xxxxxxxx sg-xxxxxxxx \ | |
| --subnet-id subnet-xxxxxxxx \ | |
| --iam-instance-profile Arn=arn:aws:iam::xxxxxxxxxxxx:instance-profile/instance-profile \ | |
| --count 1 \ | |
| --block-device-mappings '[ { "DeviceName": "/dev/xvda", "Ebs": {"VolumeSize": 100, "VolumeType": "gp2"}}]' \ | |
| --key-name instance-key \ | |
| --associate-public-ip-address \ |
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
| aws rds create-db-instance \ | |
| --db-name newdb \ | |
| --db-instance-identifier my-instance \ | |
| --db-instance-class db.t2.micro \ | |
| --engine MySQL \ | |
| --engine-version 5.6.35 \ | |
| --master-username dbuser \ | |
| --master-user-password dbpwd \ | |
| --vpc-security-group-ids sg-xxxxxxxx \ | |
| --db-subnet-group-name db-subnet-group \ |
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
| aws cloudformation create-stack \ | |
| --stack-name my-stack \ | |
| --template-body file:///full-path-to-file/my-stack.template \ | |
| --parameters \ | |
| ParameterKey=DynaoDbReadCapacity,ParameterValue=2 \ | |
| ParameterKey=DynaoDbWriteCapacity,ParameterValue=2 \ | |
| ParameterKey=LambdaBucket,ParameterValue=Bucket-name \ | |
| --profile=work |
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
| # Find all instances and list their Private IP, instance-id and Name | |
| # You may specify more filters like the vpc | |
| # Name=vpc-id,Values=vpc-xxxxxxxx | |
| aws ec2 describe-instances --filters --query 'Reservations[].Instances[].[PrivateIpAddress,InstanceId,Tags[?Key==`Name`].Value[]]' --output text --profile=elmodev | sed '$!N;s/\n/ /' |
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
| #!/usr/bin/python | |
| import boto3 | |
| client = boto3.client('ec2') | |
| account_number = boto3.client('sts').get_caller_identity()['Account'] | |
| response = client.describe_images(Owners=[account_number]) | |
| for image in response['Images']: | |
| if "2017-08-21" in image['CreationDate']: | |
| image_id = image['ImageId'] | |
| snapshot_id = image['BlockDeviceMappings'][0]['Ebs']['SnapshotId'] |
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
| require 'jenkins_api_client' | |
| SERVER_IP = 'jenkins.dev.example.com' | |
| $build = JenkinsApi::Client.new(:server_ip => "#{SERVER_IP}",:username => 'admin', :password => 'admin') | |
| $opts = {'build_start_timeout' => 60, 'cancel_on_build_start_timeout' => true} | |
| $build.job.build("test-project",{:parameter1=>"value-1",\ | |
| :parameter2=>"value-2",\ | |
| :parameter3=>"value-3",\ | |
| :parameter4=>"value-4"} || {}, $opts) |
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
| #!/usr/bin/env python | |
| import boto3 | |
| s3 = boto3.resource('s3') | |
| bucket = s3.Bucket('<<Bucket-name-here>>') | |
| bucket.object_versions.all().delete() |
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
| apt-get install python3-pip -y | |
| sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1 | |
| sudo update-alternatives --config python | |
| sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 | |
| sudo update-alternatives --config pip | |
| pip install aws-cdk.cdk |
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
| #!/usr/bin/python | |
| ## The script deletes the snapshots that are : | |
| ## - not attached to an AMI | |
| ## - are atleast 90 days old | |
| ## Output : | |
| ## - soem csv files if a report is required | |
| ## - the return values ( return_code && request_id from the delete command ) | |
| ## Usage |
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
| GITLAB_GROUP="<group-name>" | |
| GITLAB_PRIVATE_TOKEN="<token>" | |
| GITLAB_ADDRESS="gitlab.<name>" | |
| for i in `curl -s "https://$GITLAB_ADDRESS/api/v4/groups/$GITLAB_GROUP/projects?private_token=$GITLAB_PRIVATE_TOKEN&per_page=999" | \ | |
| grep -o "\"ssh_url_to_repo\":[^ ,]\+" | \ | |
| awk -F ':' '{gsub(/"/, "", $2); gsub(/"/, "", $3); print $2":"$3}'`; do git clone $i; done | |
| |