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 | |
# Make sure you have IAM non-temporary keys that have permission to sts:AssumeRole configured on a 'permanent' profile in aws cli. | |
# To configure such profile you can use: $ aws configure --profile permanent | |
# To configure a MFA device on IAM, refer to: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_enable_virtual.html#enable-virt-mfa-for-iam-user | |
# | |
# | |
# More info about sts and assume role command available at: https://aws.amazon.com/premiumsupport/knowledge-center/iam-assume-role-cli/ | |
# | |
# Add this bash script to your $PATH to run system wide | |
# Example: if script is located on /usr/local/bin/, make export PATH=/usr/local/bin:$PATH |
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 | |
# This script send relevant metrics for autoscaling for cloudwatch | |
# Make this script executable | |
# Install as crontab on machine that is 24/7 and has IAM Role with: | |
# ecs:DescribeServices | |
# cloudwatch:PutMetricData | |
# | |
# To install crontab: $ crontab -u ec2-user -e | |
# | |
# */1 * * * * PATH=/home/ec2-user/.local/bin /home/ec2-user/metrics.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
service: ec2-instance-manager | |
custom: | |
secrets: ${file(secrets.json)} | |
provider: | |
name: aws | |
runtime: python3.7 | |
stage: dev | |
stackName: ec2-instance-manager-stack |
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
$user = "$($env:service_user)" | |
$pass = "$($env:service_pass)" | |
$securepass = $pass | ConvertTo-SecureString -AsPlainText -Force | |
$credential = New-Object System.Management.Automation.PsCredential -ArgumentList $user,$securepass | |
If($Session -eq $null or $Session.State -eq 'Broken'){ | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection | |
Import-PSSession $Session -AllowClobber | |
} |