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
1 | |
Below worked for me in AWS CENTOS 🦊 - Amazon Linux 2 AMIS( Karoo) | |
Step 1 : Update the EBS volume from AWS console of attached EC2 | |
Step 2 : Login( SSH ) to EC2 instance in which the volume is attached |
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
const AWS = require('aws-sdk'); | |
exports.handler = async (event, context) => { | |
console.log(JSON.stringify(event)) | |
// ================================ | |
// Define your backups | |
// ================================ | |
const instanceName = event.instanceName || process.env['instanceName']; | |
const backupDaysMax = event.days || process.env['days']; // keep at least 7 daily backups |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": [ | |
"arn:aws:s3:::<bucket-name>/file1.txt", | |
"arn:aws:s3:::<bucket-name>/file2.txt" |
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 json | |
import urllib.parse | |
import boto3 | |
import os | |
print('Loading function') | |
s3 = boto3.client('s3') | |
TOPIC_ARN = os.environ['topicARN'] | |
def lambda_handler(event, context): |
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
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` | |
#Set the Region | |
AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone -H "X-aws-ec2-metadata-token: $TOKEN"` | |
export AWS_DEFAULT_REGION=${AZ::-1} | |
echo $AWS_DEFAULT_REGION | |
#Retrieve latest Linux AMI | |
AMI=$(aws ssm get-parameters --names /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 --query 'Parameters[0].[Value]' --output text) | |
echo $AMI |
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
create database aws; | |
use aws; | |
CREATE TABLE RESTART ( | |
StudentID int not null AUTO_INCREMENT, | |
StudentName varchar(255), | |
RestartCity varchar(255), | |
GraduationDate Datetime, | |
PRIMARY KEY (StudentID) | |
); |
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
SELECT Region, Name, Population, RANK() over(partition by region ORDER BY population desc) as 'Ranked' FROM world.country ; |
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
def isPrime(num): | |
flag = False | |
if num == 1: | |
return False | |
elif num > 1: | |
# check for factors | |
for i in range(2, num): | |
if (num % i) == 0: | |
# if factor is found, set flag to True |
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 -e | |
/root/OoklaServer —daemon | |
exit 0 |
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
sudo apt-get install build-essential libssl-dev git -y | |
git clone https://github.com/wg/wrk.git wrk | |
cd wrk | |
sudo make | |
# move the executable to somewhere in your PATH, ex: | |
sudo cp wrk /usr/local/bin |
NewerOlder