This file contains 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
response = client.list_suppressed_destinations(Reasons=['BOUNCE'], PageSize=50) | |
addresses = response['SuppressedDestinationSummaries'] | |
while "NextToken" in response: | |
response = client.list_suppressed_destinations(NextToken=response["NextToken"], Reasons=['BOUNCE'],PageSize=50) | |
addresses.extend(response['SuppressedDestinationSummaries']) | |
print(len(addresses)) |
This file contains 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
TOKEN=$(curl --silent -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 600") | |
INSTANCEID=$(curl --silent -H "X-aws-ec2-metadata-token: ${TOKEN}" http://169.254.169.254/latest/dynamic/instance-identity/document | python3 -c 'import json,sys;print(json.load(sys.stdin)["instanceId"])') |
This file contains 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
--- | |
Parameters: | |
pBucketName: | |
Type: String | |
Default: '' | |
Description: Input S3 Bucket | |
Resources: | |
StateMachine: | |
Type: AWS::StepFunctions::StateMachine | |
Properties: |
This file contains 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
UserData: | |
Fn::Base64: | |
!Sub | | |
#!/bin/bash | |
cd /tmp | |
wget https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_amd64/amazon-ssm-agent.deb | |
sudo dpkg -i amazon-ssm-agent.deb | |
sudo systemctl enable amazon-ssm-agent | |
sudo systemctl start amazon-ssm-agent |
This file contains 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
LogsRule: | |
Type: AWS::Events::Rule | |
Properties: | |
EventBusName: 'default' | |
EventPattern: | |
source: | |
- aws.ssm | |
detail-type: | |
- "EC2 State Manager Association State Change" | |
State: ENABLED |
This file contains 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
# usage json_to_firehose.py input_file.json my_firehose_stream | |
import json | |
import sys | |
import boto3 | |
client = boto3.client('firehose') | |
filename = sys.argv[1] | |
streamname = sys.argv[2] |
This file contains 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 | |
TO="USER@XXXX.XXX" | |
FROM="SENDER@XXXX.XXX" | |
SUBJECT="Test mail" | |
MESSAGE="liam tseT" | |
date="$(date +"%a, %d %b %Y %H:%M:%S %Z")" | |
priv_key="AWS_SECRET_KEY" | |
access_key="AWS_ACCESS_KEY" |
This file contains 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/sh | |
echo "Assuming role based on CI job name $CI_JOB_NAME" | |
case "$CI_JOB_NAME" in | |
*"prod") | |
AWS_DEPLOYMENT_ROLE=$AWS_DEPLOYMENT_ROLE_PROD | |
AWS_EXTERNALID=$AWS_EXTERNALID_PROD | |
;; | |
*"test") |
This file contains 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 autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?contains(Tags[?Key==`tag_key`].Value, `tag_value`)].[AutoScalingGroupName]' | |
# If the tag value is true it must be escaped with " | |
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?contains(Tags[?Key==`tag_key`].Value, `"true"`)].[AutoScalingGroupName]' |
This file contains 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 | |
# | |
set -e | |
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_SECURITY_TOKEN | |
ROLEARN="${1}" | |
SESSIONNAME="sumething" | |
KST=$(aws2 sts assume-role --role-arn $ROLEARN \ | |
--role-session-name $SESSIONNAME) |
NewerOlder