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
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 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
import boto3 | |
account_number = boto3.client('sts').get_caller_identity()['Account'] |
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
## You may choose to remove --recursive if is required only for the bucket or folder and not for objects within. | |
s3cmd setacl --acl-private --recursive s3://mybucket-name | |
s3cmd setacl --acl-private --recursive s3://mybucket-name/folder-name | |
s3cmd setacl --acl-private --recursive s3://mybucket-name/folder-name/object-name | |
s3cmd setacl --acl-public --recursive s3://mybucket-name | |
s3cmd setacl --acl-public --recursive s3://mybucket-name/folder-name | |
s3cmd setacl --acl-public --recursive s3://mybucket-name/folder-name/object-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
aws sts decode-authorization-message --encoded-message "$1" | | |
jq '.["DecodedMessage"]' | | |
sed 's/\\"/"/g' | | |
sed 's/^"//' | | |
sed 's/"$//' | | |
jq | |
} |
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 create-network-interface --description some-internal --groups sg-xxxxxxxx --subnet-id subnet-xxxxxxxx --profile=work | |
aws ec2 create-tags --resources eni-xxxxxxxx --tags Key=Name,Value=some-internal Key=appType,Value=logging --profile=work | |
aws ec2 run-instances --image-id ami-xxxxxxxx --instance-type t2.medium --security-group-ids sg-xxxxxxxx --subnet-id subnet-xxxxxxxx --iam-instance-profile Arn=arn:aws:iam::123456789876:instance-profile/my-instance-profile --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=elk},{Key=appType,Value=elk}]' 'ResourceType=volume,Tags=[{Key=Name,Value=some-app-host},{Key=appType,Value=some-app}]' --profile=work | |
aws ec2 attach-network-interface --device-index 1 --instance-id i-xxxxxxxxxxxxxxxxx --network-interface-id eni-xxxxxxxx | |
#aws ec2 describe-network-interfaces --filters Name=tag:Name,Values=some-app* | |
#aws ec2 describe-instances --profile=work --filters Name=tag:Name,Values=some-app* --query 'Reservations[*].Instances[*].[InstanceId]' |
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 | |
yum install -y aws-cli | |
cd /home/ec2-user/ | |
aws s3 cp 's3://aws-codedeploy-us-east-1/latest/codedeploy-agent.noarch.rpm' . --region us-east-1 | |
yum -y install codedeploy-agent.noarch.rpm |
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
var AWS = require('aws-sdk'); | |
exports.handler = function(event, context) { | |
var ec2 = new AWS.EC2({region: 'us-east-1'}); | |
ec2.startInstances({InstanceIds : ['i-0114833f8ffc9151c'] },function (err, data) { | |
if (err) console.log(err, err.stack); | |
else console.log(data); | |
context.done(err,data); | |
}); | |
}; |