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
<powershell> | |
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | |
choco install python -y | |
(new-object net.webclient).DownloadFile('https://s3.amazonaws.com/aws-cli/AWSCLI64.msi','c:\AWSCLI64.msi') | |
msiexec.exe /i 'C:\AWSCLI64.msi' /qn | |
</powershell> |
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 | |
yum install perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https -y | |
curl http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip -O | |
unzip CloudWatchMonitoringScripts-1.2.1.zip | |
rm CloudWatchMonitoringScripts-1.2.1.zip |
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 | |
## Reference web Page : http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html | |
yum install perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https -y | |
curl http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip -O | |
unzip CloudWatchMonitoringScripts-1.2.1.zip | |
rm CloudWatchMonitoringScripts-1.2.1.zip |
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
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); | |
}); | |
}; |
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 | |
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 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 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 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 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'] |
OlderNewer