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
AWSTemplateFormatVersion: 2010-09-09 | |
Description: "Personal Website" | |
Parameters: | |
DomainName: | |
Type: String | |
Description: "The domain name of website" | |
BucketName: | |
Type: String | |
Description: "The bucket name" |
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 ruby | |
require 'shellwords' | |
files = `find . -iname '*.heic'`.split("\n") | |
files.each do |original_file| | |
output_file = original_file.gsub(/\.heic\z/i, ' Converted.jpg') | |
if File.exist?(output_file) | |
STDERR.puts "Skipping output #{output_file} exists." | |
else |
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
#!/bin/bash | |
curl https://www.cloudflare.com/ips-v4 > .ips-v4 | |
curl https://www.cloudflare.com/ips-v6 > .ips-v6 | |
firewall-cmd --new-zone=cloudflare --permanent | |
firewall-cmd --reload | |
for i in `<.ips-v4`; do firewall-cmd --zone=cloudflare --add-source=$i; done | |
for i in `<.ips-v6`; do firewall-cmd --zone=cloudflare --add-source=$i; done |
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
AWSTemplateFormatVersion: '2010-09-09' | |
Description: > | |
This CloudFormation template validates ACM certificate using AWS Route53 DNS | |
service. | |
Parameters: | |
HostedZoneName: | |
Type: String | |
Description: The DNS name of an Amazon Route 53 hosted zone e.g. enterprise.filipeandre.com | |
AllowedPattern: (?!-)[a-zA-Z0-9-.]{1,63}(?<!-) |
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
AWSTemplateFormatVersion: '2010-09-09' | |
Description: > | |
SSM Automation Document run a custom SSM Command Document | |
against a fleet of target instances. | |
Parameters: | |
AutomationDocumentName: | |
Type: String | |
Description: Name of created SSM Automation Document | |
Default: MyAutomation |
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
# List all AWS Org accounts' Id, Name, and Email in a csv format | |
aws organizations list-accounts --query 'Accounts[].[Id,Name,Email,Status]' | jq -r '["id","name","email","status"], (.[]) | @csv' | |
# Find all EKS clusters in AWS Org | |
aws configservice list-aggregate-discovered-resources --resource-type "AWS::EKS::Cluster" --configuration-aggregator-name "aws-config-aggregator-name" --no-paginate --output text | |
# Find all EKS cluster AWS Org with name like name_pattern | |
# and only display the source account id, the cluster name, and the cluster region | |
aws configservice list-aggregate-discovered-resources --resource-type "AWS::EKS::Cluster" --configuration-aggregator-name "aws-config-aggregator-name" --no-paginate --query 'ResourceIdentifiers[?contains(ResourceName,`name_pattern`)].[SourceAccountId,ResourceName,SourceRegion]' --output text |
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 ts-node | |
// This script uploads your assets to the CDK staging bucket in S3 (just as cdk deploy would) | |
// and writes out two files: | |
// - parameters.ini to use in CLI deployments (see instructions below) | |
// - parameters.json to use in AWS CodePipeline for CloudFormation deployments | |
// | |
// Installation instructions: | |
// - Save this script cdk-package.ts to the root of your CDK repo (i.e. next to cdk.json) and make it executable | |
// - Install script dependencies: npm install jsonpath aws-sdk adm-zip @types/jsonpath @types/adm-zip |
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 | |
s3_client = boto3.client('s3') | |
def list_dirs(bucket, prefix): | |
""" Yield direct child folders of the given prefix. | |
""" |
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 botocore.exceptions import ClientError | |
from time import sleep | |
# Fix this wherever your custom resource handler code is | |
from common import cfn_custom_resources as csr | |
import sys | |
MAX_RETRIES = 3 | |
client = boto3.client('ec2') |
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
description: |- | |
### EC2 stopper by tag | |
Stop EC2 instances by tag | |
schemaVersion: '0.3' | |
mainSteps: | |
- name: getInstancesByTag | |
action: 'aws:executeAwsApi' | |
outputs: | |
- Name: InstanceIds |
NewerOlder