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 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="Test-$instanceId" --region "$region" |
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
https://artillery.io/ |
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
USE Your ARNS - ARN here are dummies | |
aws lambda add-permission --function-name CaptureLogLambda --statement-id rad-log-event --action lambda:InvokeFunction --principal events.amazonaws.com --source-arn arn:aws:events:us-west-1:6500000000:rule/rad-log-rule" | |
arn:aws:lambda:us-west-1:65000000000:function:CaptureLogLambda | |
aws events put-targets --rule rad-log-rule --targets Id=1,Arn=arn:aws:lambda:us-west-1:6586000000:function:CaptureLogLambda |
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
{ | |
"source": [ "aws.autoscaling" ], | |
"detail-type": [ "EC2 Instance-launch Lifecycle Action" ] | |
} |
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 - CLI Link https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-windows.html | |
Install Python using msi | |
# Check python version | |
python -version | |
# Check pip version | |
pip -version | |
# install aws cli |
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
# creating launch config from running instance | |
aws autoscaling create-launch-configuration --launch-configuration-name web-demo-launch-config --instance-id i-a8exxxxxx | |
# Creating ASG from running instance | |
aws autoscaling create-auto-scaling-group --auto-scaling-group-name web-demo-asg --instance-id i-7f12e649 --min-size 1 --max-size 2 --desired-capacity 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
//RunCommandlambda.java Source Code | |
package net.anandus.captureloglamda; | |
import com.amazonaws.services.lambda.runtime.Context; | |
import com.amazonaws.services.lambda.runtime.RequestHandler; | |
import java.util.List; | |
public class RunCommandLambda implements RequestHandler<Request, Response> { | |
/** |
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
from __future__ import print_function | |
import json | |
import boto3 | |
import urllib.request | |
print('Loading function') | |
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
Attach IGW to a VPC | |
aws ec2 attach-internet-gateway --vpc-id "vpc-f3cbfe8a" --internet-gateway-id "igw-6a631b0c" --region us-west-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
#top of the file | |
sed -i '1s/^/your text\n/' file | |
#End of the file | |
sed -i "2i192.241.xx.xx venus.example.com radious" /etc/hosts | |
or | |
echo "192.241.xx.xx venus.example.com radious" >> /etc/hosts |
OlderNewer