Skip to content

Instantly share code, notes, and snippets.

Avatar

EduardCloud EduardCloud

View GitHub Profile
View AzureLoginApi.ps1
#Note that Write-Log Function is not present
function AzureLoginApi {
Param (
[Parameter(Mandatory = $true)][string]$ClientID,
[Parameter(Mandatory = $true)][string]$ClientSecret,
[Parameter(Mandatory = $true)][string]$Tenant,
[Parameter(Mandatory = $false)][switch]$StorageLogin
)
try {
if ($StorageLogin) { $resource = "https://storage.azure.com/" }
@EduardCloud
EduardCloud / LambdaEfsBackup.py
Created Sep 19, 2017
Backup EFS file-system to S3 with lambda function
View LambdaEfsBackup.py
import boto3
import time
region = 'eu-west-1'
user_data_script = """#!/bin/bash
instanceid=$(curl http://169.254.169.254/latest/meta-data/instance-id)
cd /
mkdir moodledata
mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-xxxxxxxxxxc.efs.eu-west-1.amazonaws.com:/ moodledata
tar czf mooodledata-backup-$(date +%d-%m-%Y_%H-%M).tar.gz /moodledata
aws s3 mv mooodledata-backup-*.tar.gz s3://xxxxxxxxx/