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 httpd -y | |
/sbin/chkconfig --levels 235 httpd on | |
service httpd start | |
instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
region=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}') | |
echo "<h1>$instanceId</h1>" > /var/www/html/index.html | |
aws ec2 create-tags --resources "$instanceId" --tags Key=Name,Value="PROD-$instanceId" --region "$region" |
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 autoscaling put-lifecycle-hook \ | |
--lifecycle-hook-name scale-out-hook \ | |
--auto-scaling-group-name MyASG \ | |
--lifecycle-transition autoscaling:EC2_INSTANCE_LAUNCHING | |
aws autoscaling complete-lifecycle-action \ | |
--lifecycle-action-result CONTINUE \ | |
--instance-id i-0680775fb68bc97a5 \ | |
--lifecycle-hook-name scale-out-hook \ | |
--auto-scaling-group-name MyASG |
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 | |
sudo yum update -y | |
sudo yum install ruby | |
cd /home/ec2-user | |
aws s3 cp 's3://aws-codedeploy-us-east-1/latest/codedeploy-agent.noarch.rpm' . --region us-east-1 | |
sudo 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
#!/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
package net.mahtabalam; | |
import java.io.BufferedInputStream; | |
import java.io.BufferedOutputStream; | |
import java.io.FileOutputStream; | |
import java.io.InputStream; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
import java.util.List; | |
import java.util.Map; |
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
docker network create -d bridge --subnet 10.0.0.1/24 mahtab-bridge | |
docker network inspect mahtab-bridge | |
docker build -t node-app1:1.0 . | |
docker run -d --rm -p 3000:5000 --name node-app1 --network mahtab-bridge node-app1:1.0 | |
docker build -t node-app2:1.0 . |
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
docker run -it --rm -p 8888:8080 tomcat:8.0 | |
docker exec -it container_name-OR-container_id /bin/sh |
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 | |
# The calls to AWS STS AssumeRole must be signed with the access key ID | |
# and secret access key of an existing IAM user or by using existing temporary | |
# credentials such as those from antoher role. (You cannot call AssumeRole | |
# with the access key for the root account.) The credentials can be in | |
# environment variables or in a configuration file and will be discovered | |
# automatically by the boto3.client() function. For more information, see the | |
# Python SDK documentation: | |
# http://boto3.readthedocs.io/en/latest/reference/services/sts.html#client |
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 httpd -y | |
chkconfig httpd on | |
service httpd start | |
echo "<html><h1>Hello there</h1></html>" > /var/www/html/index.html |
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" : "AWS CloudFormation Sample Template VPC_with_PublicIPs_And_DNS: Sample template that creates a VPC with DNS and public IPs enabled. Note that you are billed for the AWS resources that you use when you create a stack from this template.", | |
"Parameters": { | |
"KeyPair": { | |
"Description": "Name of the keypair to use for SSH access", | |
"Type": "String" | |
}, | |
"BucketName" : { | |
"Description" : "Name of bucket containing application war", |