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
--- | |
Resources: | |
QueueForPipe: | |
Type: AWS::SQS::Queue | |
LambdaServiceRole: | |
Type: AWS::IAM::Role | |
Properties: | |
AssumeRolePolicyDocument: | |
Statement: | |
- Action: sts:AssumeRole |
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 os | |
# Environment variables for configuration | |
role_name = os.environ.get("ROLE_NAME", "OrganizationAccountAccessRole") | |
include_mgmt = os.environ.get("INCLUDE_MGMT", "true").lower() == "true" | |
sts = boto3.client("sts") | |
caller_arn = sts.get_caller_identity()["Arn"] | |
partition = caller_arn.split(":")[1] |
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
#!/usr/bin/env python | |
import boto3 | |
import json | |
sechub = boto3.client("securityhub") | |
sts = boto3.client("sts") | |
caller_arn = sts.get_caller_identity()["Arn"] | |
print(caller_arn) |
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: Creates a Step Functions State Machine that is executed when new items are added to a DynamoDB Table. | |
Resources: | |
Table: | |
Type: "AWS::DynamoDB::Table" | |
Properties: | |
AttributeDefinitions: | |
- AttributeName: "PK" | |
AttributeType: "S" | |
KeySchema: |
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 dict_dot_notation(d, path=[]): | |
d2 = {} | |
for k, v in d.items(): | |
k_path = path + [str(k)] | |
k_formatted = ".".join(k_path) | |
if isinstance(v, dict): | |
# merge in dict with recursive call | |
d2 = {**d2, **dict_dot_notation(v, path=k_path)} | |
elif isinstance(v, list) or isinstance(v, tuple): |
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
it('should persist user to dynamodb', async () => { | |
await createUser(userInput); | |
expect(mockDynamoDbDocumentClient).toHaveReceivedCommandWith(PutCommand, { | |
TableName: 'TestUserTable', | |
Item: userToCreate, | |
}); | |
}); |
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: "3.8" | |
services: | |
changedetection: | |
container_name: changedetection | |
hostname: changedetection | |
image: ghcr.io/dgtlmoon/changedetection.io:latest | |
environment: | |
- TZ=America/Los_Angeles | |
- PLAYWRIGHT_DRIVER_URL=ws://playwright-chrome:3000/?stealth=1&--disable-web-security=true&token=<redacted> |
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
# this Code will help to schedule stop the RDS databasrs using Lambda | |
# Yesh | |
# Version -- 2.0 | |
# Adapted from https://aws.amazon.com/blogs/database/schedule-amazon-rds-stop-and-start-using-aws-lambda/ | |
import boto3 | |
import os | |
import sys | |
import time | |
from datetime import datetime, timezone |
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 { Handler } from 'aws-lambda'; | |
import * as AWS from 'aws-sdk'; | |
const rds = new AWS.RDS(); | |
enum InstanceStatus { | |
STOPPED = 'stopped', | |
AVAILABLE = 'available', | |
} |
NewerOlder