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", | |
"Action": [ | |
"lambda:InvokeFunction", | |
"lambda:InvokeAsync" | |
], | |
"Resource": "*" |
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", | |
"Action": [ | |
"s3:PutObject" | |
], | |
"Resource": "arn:aws:s3:::your_s3_bucket_name_here/*" | |
}, |
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 boto3 | |
import json | |
client = boto3.client('lambda') | |
ssm_client = boto3.client('ssm') | |
def lambda_handler(event, context): | |
# ----------------------------------------------------------------------- | |
# Get the list of ARNs of cross-account IAM roles saved in SSM Parameter rolearnlist |
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 boto3 | |
import datetime | |
import time | |
stsclient = boto3.client('sts') | |
s3client = boto3.resource('s3') | |
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
{ | |
"metrics": { | |
"append_dimensions": { | |
"InstanceId": "${aws:InstanceId}" | |
}, | |
"metrics_collected": { | |
"disk": { | |
"measurement": [ | |
"used_percent" | |
], |
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
{ | |
"metrics": { | |
"append_dimensions": { | |
"InstanceId": "${aws:InstanceId}" | |
}, | |
"metrics_collected": { | |
"LogicalDisk": { | |
"measurement": [ | |
"% Free Space" | |
], |
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 | |
mkdir tempcloudwatch | |
cd tempcloudwatch | |
apt install wget -y | |
apt install unzip -y | |
wget https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip | |
unzip AmazonCloudWatchAgent.zip | |
sudo ./install.sh | |
wget https://YOUR-PUBLIC-URL-HERE-WITH-CONFIG-FILE -O config.json | |
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:config.json -s |
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 | |
mkdir tempcloudwatch | |
cd tempcloudwatch | |
yum install wget -y | |
yum install unzip -y | |
wget https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip | |
unzip AmazonCloudWatchAgent.zip | |
sudo ./install.sh | |
wget https://YOUR-PUBLIC-URL-HERE-WITH-CONFIG-FILE -O config.json | |
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:config.json -s |
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
<powershell> | |
mkdir "c:\cwagent" | |
wget "https://s3.amazonaws.com/amazoncloudwatch-agent/windows/amd64/latest/AmazonCloudWatchAgent.zip" -OutFile "C:\cwagent\cwagent.zip" | |
Add-Type -AssemblyName System.IO.Compression.FileSystem | |
function Unzip | |
{ | |
param([string]$zipfile, [string]$outpath) | |
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) | |
} | |
Unzip "C:\cwagent\cwagent.zip" "C:\cwagent" |
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
AWSTemplateFormatVersion: '2010-09-09' | |
Description: Linux CloudWatch Alarms - CPU Memory Instance and System Status | |
#------------------------------------------------------------------------------ | |
Parameters: | |
#------------------------------------------------------------------------------ | |
instanceid: | |
Description: "Choose an instance id" | |
Type: AWS::EC2::Instance::Id | |
instancename: |
OlderNewer