Could not retrieve mirrorlist http://repo.us-west-2.amazonaws.com/latest/main/mirror.list error was
amazon-ebs: 12: Timeout on http://repo.us-west-2.amazonaws.com/latest/main/mirror.list: (28, 'Connection timed out after 10001 milliseconds')
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
# Supply a custom prompt to a LangChain QA Chain | |
system_template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. | |
{context} | |
Question: {question} | |
Helpful Answer:""" | |
messages = [ | |
SystemMessagePromptTemplate.from_template(system_template), | |
HumanMessagePromptTemplate.from_template("{question}"), |
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 | |
# This code deletes buckets on AWS S3. | |
# It is designed to be run on a local machine with credentials for an AWS account that has the | |
# necessary permissions to delete buckets. | |
# It will delete the contents of the buckets before deleting the bucket itself. | |
# It will not attempt to delete a bucket that does not exist. | |
# BUCKETS is a list of bucket names that should be deleted. If a bucket in the list does not | |
# exist, it will be skipped. |
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
""" | |
Usage example: | |
from logger import get_logger | |
log = get_logger() | |
log.info('my_event', my_key1='val 1', my_key2=5, my_key3=[1, 2, 3], my_key4={'a': 1, 'b': 2}) | |
List of metadata keys in each log message: | |
event | |
_func |
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
Ec2InPrivateSubnetWithouttNatGtwy: | |
Type: AWS::EC2::Instance | |
Properties: | |
ImageId: !Ref LatestAmiId | |
InstanceType: !Ref InstanceType | |
# KeyName: NO SSH Key needed | |
IamInstanceProfile: !Ref Ec2InstanceProfile | |
NetworkInterfaces: | |
# The SSM Agent running on the EC2 instances must be able to connect to Session Manager's | |
# public endpoint. You can also set up a PrivateLink connection to allow instances running |
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
env: | |
variables: | |
LAMBDA_PKG_BUCKET_PREFIX: mia | |
phases: | |
install: | |
commands: |
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
# replace json_api value with parsed value | |
for key in json_encoded_key_names: | |
if key in pdp_output.get('product-attributes') and pdp_output['product-attributes'][key] is not None: | |
try: | |
pdp_output['product-attributes'][key] = json.loads(pdp_output['product-attributes'][key]) | |
except json.decoder.JSONDecodeError as e: | |
record_fault('call-resp-processing.atg.missing-required-data', | |
f"""Invalid JSON: {key} in pdp_output['product-attributes'] Reason: | |
{e.msg} Data: {pdp_output['product-attributes'][key]}""") |
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": "VPC Across 3 AZs", | |
"Parameters": { | |
"EnvName": { | |
"Type": "String", | |
"Default": "Dev", | |
"AllowedValues": [ | |
"Dev", "Test", "Prod" | |
], |
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": "VPC Across 3 AZs", | |
"Parameters": { | |
"EnvName": { | |
"Type": "String", | |
"Default": "Dev", | |
"AllowedValues": [ | |
"Dev", "Test", "Prod" | |
], |
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 | |
''' | |
Send memory usage metrics to Amazon CloudWatch | |
This is intended to run on an Amazon EC2 instance and requires an IAM | |
role allowing to write CloudWatch metrics. Alternatively, you can create | |
a boto credentials file and rely on it instead. | |
Original idea based on https://github.com/colinbjohnson/aws-missing-tools |
NewerOlder