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
import logging | |
import json | |
class FormatterJSON(logging.Formatter): | |
def format(self, record): | |
record.message = record.getMessage() | |
if self.usesTime(): | |
record.asctime = self.formatTime(record, self.datefmt) |
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
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
logger.handlers[0].setFormatter(logging.Formatter('{"level": "%(levelname)s", "message": "%(message)s", "time": "%(asctime)s", "name": "%(name)s"}', | |
"%Y-%m-%dT%H:%M:%S")) | |
logger.info("Hello") |
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
import logging | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
def main(event, context): | |
logger.info("This is an info message") | |
logger.warning("This is a warning message") | |
logger.debug("This is a debug message") | |
logger.error("This is an error message") |
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
How many tenants can a user in Azure Active Directory belong to? | |
What are characteristics of Azure Paired Regions? | |
Azure Information protection == ~Macie | |
Network Security Group == Security Group | |
Application Gateway == Application Load Balancer | |
Azure Support Plans | |
Service Trust Portal == Artifact | |
Resource Group == ~Tags | |
App Services?? | |
Azure Firewall |
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
s3 = boto3.client('s3') | |
## Reading a JSON file in memory | |
with tempfile.TemporaryFile() as data: | |
s3.download_fileobj(bucket_name, 'tests/s3/key.json', data) | |
data.seek(0) | |
status = json.loads(data.read().decode('utf-8'))['status'] | |
## Reading a CSV file in memory | |
with tempfile.TemporaryFile() as package_file: |
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
https://sdadadsazxzxvwr6t3676jnvcxzvcz.s3-ap-southeast-1.amazonaws.com/model.txt |
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
name: Serverless Delete example | |
on: | |
delete: | |
branches: | |
- actions-** | |
# Specify what jobs to run | |
jobs: | |
deploy: |
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
steps: | |
- uses: actions/checkout@v1 | |
- name: Set Branch name to $STAGE env var | |
run: | | |
BRANCH="$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" | |
echo "BRANCH is $BRANCH" | |
echo "::set-env name=STAGE::$BRANCH" |
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
name: Simple Serverless | |
# Triggers | |
on: | |
push: | |
branches: | |
- master | |
# Jobs | |
jobs: |
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
{ | |
"Version": "2012-10-17", | |
"Id": "VPCe and SourceIP", | |
"Statement": [{ | |
"Sid": "VPCe and SourceIP", | |
"Effect": "Deny", | |
"Principal": "*", | |
"Action": "s3:*", | |
"Resource": [ | |
"${aws_s3_bucket.test_endpoint.arn}/*" |