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
cat test.json | gzip | openssl base64 -A > test.out |
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
# pacakaging and deploying sam function | |
sam build --use-container -m ./requirements.txt | |
sam package --s3-bucket DEPLOYMENT-BUCKET --output-template-file packaged.yaml --region eu-west-1 | |
sam deploy --template-file ./packaged.yaml --stack-name CLOUDFORMATION-STACK-NAME --capabilities CAPABILITY_IAM --region eu-west-1 |
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 kms encrypt --key-id #### --plaintext "onetwothree 123" --query CiphertextBlob --output text | base64 --decode > out.blob | |
aws kms decrypt --key-id #### --ciphertext-blob fileb://out.blob --query Plaintext --output text | base64 --decode |
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
# cloudformation package and deploy | |
aws cloudformation package --s3-bucket BUCKET-NAME --output-template-file packaged.yaml --region eu-west-1 --template-file template.yaml | |
aws cloudformation deploy --template-file packaged.yaml --stack-name STACK-NAME --parameter-overrides ParameterName=ParameterValue --capabilities CAPABILITY_IAM |
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) |
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/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
#!/bin/bash | |
TO="[email protected]" | |
FROM="[email protected]" | |
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
# 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
LogsRule: | |
Type: AWS::Events::Rule | |
Properties: | |
EventBusName: 'default' | |
EventPattern: | |
source: | |
- aws.ssm | |
detail-type: | |
- "EC2 State Manager Association State Change" | |
State: ENABLED |
OlderNewer