Saravanan666/pypi-org huggingface dataset:
Package: awscli-saml-sso
awscli_saml_sso is a command line tool that aims to get temporary credentials from SAML identity provider in order to authenticate to awscli.InstallationYou need a fully functional python 3 environment, then you can install tool from pypi:pipinstallawscli-saml-ssoUsageYou only need to run the following command in terminal:awscli_saml_sso# Please configure your identity provider url [https://<fqdn>:<port>/adfs/ls/IdpInitiatedSignOn.aspx?loginToRp=urn:amazon:webservices]:>...# Please choose the role you would like to assume:
# [ 0 ]:  arn:aws:iam::<account_number>:role/<role_name>
# [ 1 ]:  arn:aws:iam::<account_number>:role/<role_name>
# ...
# Selection: <select among numbered roles># ----------------------------------------------------------------
# Your new access key pair has been stored in the AWS configuration file /home/.aws/credentials under the saml profile.
# Note that it will expire at 2020-12-01 13:17:27+00:00.
# After this time, you may safely rerun this script to refresh your access key pair.
# To use this credential, call the AWS CLI with the --profile option (e.g. aws --profile saml ec2 describe-instances).
# ----------------------------------------------------------------# Simple API example listing all S3 buckets:
# ['your-lovely-bucket', ...]ask you to fill in required identity provider url in the form ofhttps://<fqdn>:<port>/adfs/ls/IdpInitiatedSignOn.aspx?loginToRp=urn:amazon:webservicesopen web browser to fulfil SSO authentication through your identity providerretrieve attached AWS roles and ask you to choose role you would like to assumeprovide asamlprofile in/home/.aws/credentialsfilled with temporary credentialsAt the end, you just need to use AWS cofiguredsamlprofile to authenticate yourawsclicallsaws--profilesamlec2describe-instancesORAWS_PROFILE=samlawsec2describe-instancesFeaturesAuthenticate through SAML identity provider in web browserSelect among retrieved AWS roles you are allowed to assumeStore temporary credentials in aws configuration filesContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.CreditsAWS - How to Implement Federated API and CLI Access Using SAML 2.0 and AD FSLicenseawscli_saml_ssois open source software released under theGNU GPLv3.
Package: awscli-sqsall
awscli-sqsallawscli plugin to treat SQS queues more like files, withreceive-all-messagesandsend-all-messages.Quickstartreceive-all-messagesdumps all messages to a files.send-all-messagessends
all file lines as messages to a queue. FIFO queues are supported.You should be able to do something like:awssqsreceive-all-messages--queuemy-dlq\|sed'/some fault/d'\|awssqssend-all-messages--queuemy-queueSince receive-all-messages doesn't communicate with send-all-messages, and just
deletes the message after printing, you might want to keep a backup. Try this
instead:awssqsreceive-all-messages--queuemy-dlq\|teesafe_place\|sed'/some fault/d'\|awssqssend-all-messages--queuemy-queueCheck the commands' help for more details.Installingpipinstallawscli-sqsall
awsconfiguresetplugins.sqsallsqsallReleasingIt happes on tag. Check the GitHub Actions.
Package: aws-cli-sso
AWS SAML LoginWorks cross platform (Win, Unix, MacOS)
Was having a real hard time trying to get cli credentials via SAML SSO so thought about writing this small utility.
I can run this daily every morning to get a 12 hour session for myself. Hope you'd find it interesting and useful.Looking forward to contributions!!PrerequisitesNeed to installChromedriver?Google Chrome?Python 2/3?AWS Cli?Make sure all the above software are setup properly inPATHenvironment variableExecutingAdd properties to your AWS credentials file[some-profile]saml_sso_url=<url you use for saml, either okta saml or whatever you use>saml_role_arn=<your iam role to assume>saml_principal_arn=<your saml idp arn>saml_duration=<duration of session in seconds, check iam role for maximum value>Runpython-maws-samlWarning: This will change your credentials file. If you don't want to do that, you can useDRY_RUN=Y python -m aws-samlwhich will only print the values.Installationpip install aws-cli-ssoLocal development/testingpip install -r requirements.txtpython -m aws-saml
Package: awscli-update
AWS CLI v2 Update ScriptA small script to keep the AWS CLI v2 up to date,until AWS figures out how to distribute software
properly.Usageusage: awscli-update [-h] [--version] [-n] [-q] [--no-sudo] [--prefix PREFIX]

optional arguments:
  -h, --help       show this help message and exit
  --version        show program's version number and exit
  -n, --noop       only compare versions but don't install
  -q, --quiet      only print error messages when updating
  --sudo           use sudo to install (e.g. when installing to /usr/local)
  --prefix PREFIX  install aws-cli in custom path (default is /usr/local)Setuppython3-mpipinstallawscli-updateAuto updateLinuxAssuming theawscli-updatebinary is installed in$HOME/.local/bin(check the location on your machine by runningwhich awscli-update),
you want to install the AWS CLI in$HOME/.local/binand
you want to check for updates every hour,
runcrontab -eand add following line0 * * * * $HOME/.local/bin/awscli-update -q --prefix $HOME/.localmacOSAssuming theawscli-updatebinary is installed in/opt/homebrew/bin(check the location on your machine by runningwhich awscli-update),
you want to install the AWS CLI in/opt/homebrew/binand
you want to check for updates every hour,
runcrontab -eand add following linePATH=$PATH:/usr/sbin
0 * * * * /opt/homebrew/bin/awscli-update -q --prefix /opt/homebrewGeneral thingsIf you want to check for updates more/less often or at specific times,
checkthis editor for cron expressions.DevelopmentCreate venv (python3 -m venv venv)Start venv (source venv/bin/activate)Install dependencies (python3 -m pip install setuptools wheel twine versioneer)Install requirements (python3 -m pip install -r requirements.txt)Build local dist (python3 setup.py develop --user)DeploymentBuild dist (python3 setup.py sdist bdist_wheel)Deploy (twine upload dist/*)
Package: awscliv2
AWS CLI v2 for PythonWrapper forAWS CLI v2.No dependency hell, like with originalawscliCan install and updateawscliv2binariesProvides access to all servicesHas Python interfaceAWS CLI v2 for PythonBefore you startInstallationUsageFrom command lineDocker fallbackExtra commandsAs a Python moduleDevelopmentHow to helpVersioningLatest changesBefore you startThis is not an official AWS CLI v2 application,rant thereCheck the source code of this app, as you are working with sensitive dataBy default this app usesamazon/aws-cliDocker imageTo usebinaries for your OS, runawsv2 --installCross-check the source code again, probably I want to steal your credentialsInstallationpython-mpipinstallawscliv2You can add an alias to your~/.bashrcor~/.zshrcto use it as a regularAWS CLI v2aliasaws='awsv2'UsageFrom command lineInstallAWS CLI v2:# do not worry if this fails, you can still use awsv2 if you have docker installedawsv2--installConfigure default profile if needed:AWS_ACCESS_KEY_ID='my-access-key'AWS_SECRET_ACCESS_KEY='my-secret-key'# --configure <profile_name> <aws_access_key_id> <aws_secret_access_key> [<aws_session_token>]awsv2--configuredefault${AWS_ACCESS_KEY_ID}${AWS_SECRET_ACCESS_KEY}awsv2configuresetregionus-west-1UseAWS CLIas usual:# alias for# docker run --rm -i -v ~/.aws:/root/.aws -v $(pwd):/aws amazon/aws-cli $@awsv2s3ls# or as a python modulepython-mawscliv2s3lsAlso, you can checkscripts/example.shDocker fallbackUnless you runawsv2 --installonce, application will useamazon/aws-cliDocker image. The image is not ideal, and it usesrootuser, so fix downloaded file permissions manually. Or just runawsv2 --installUpdate it withdocker pull amazon/aws-cli.Container uses two volumes:$HOME/.aws->/root/.aws- credentials and config store$(cwd)->/aws- Docker image workdirExtra commandsawscliv2contains a few commands to make your life easier, especially in CI or any non-TTY environment.awsv2 -U/--update/--install- InstallAWS CLI v2awsv2 --configure <profile_name> <aws_access_key_id> <aws_secret_access_key> [<aws_session_token>] [<region>]- set profile in~/.aws/credentialsawsv2 --assume-role <profile_name> <source_profile> <role_arn>- create a new profile with assume role credentialsawsv2 -V/--version- Outputawscliv2andAWS CLI v2versionsAs a Python moduleBasic usagefromawscliv2.apiimportAWSAPIfromawscliv2.exceptionsimportAWSCLIErroraws_api=AWSAPI()try:output=aws_api.execute(["s3","ls"])exceptAWSCLIErrorase:print(f"Something went wrong:{e}")else:print(output)Install binaries for your OS from Pythonfromawscliv2.installersimportinstall_multiplatforminstall_multiplatform()You can also set credentials or assume rolesfromawscliv2.apiimportAWSAPIaws_api=AWSAPI()aws_api.set_credentials("profile_name","access_key","secret_key","","region")aws_api.assume_role("name","source_profile","role_arn")DevelopmentInstallpoetryRunpoetry installUseblackformatter in your IDEHow to helpPing AWS team to release an official PyPI packageShare your experience in issuesVersioningawscliv2version followsPEP 440.Latest changesFull changelog can be found inReleases.
Package: aws-close-account
This is a simple Selenium script to close an AWS account via the web console.
It can also reset the account password, in case it is not known.Warning: This scriptdoes notask for further confirmation - it is expressly
for those that want to skip all those manual steps. So please TAKE CARE and
uninstall it once you don’t need it anymore!WhyI am creating individual AWS accounts for my students at HM (https://hm.edu)
Closing them at the end of term is boring and annoying, so I automated it.Also seehttps://xkcd.com/1319/Since the AWS Organizations now has the Close Account feature, it seems on first glance
that this script is superfluous. However, closing accounts has some very tight quota
(10% of the active accounts in the organization), so this script unfortunately remains relevant.Last tested 1st of January 2023.Requirements / InstallationThis program requires an installed selenium driver to run.
It was tested using the selenium driver for firefox 0.30.0
installed fromhttps://github.com/mozilla/geckodriver/releases.
The selenum driver can be selected with a command line flag.To install aws-close-account to a virtualenv, do:pip install aws-close-accountUsageThe Browser window waits for you to input any captchas and MFA Keys.Quick Start:aws-close-account my-account@example.com
Package: awscloud
awscloudA Python Package to List AWS Cloud Resources for Different AWS Services!InstallationUse the package managerpipto install awscloud.pipinstallawscloudUsageimportboto3,awscloudfromdatetimeimportdatetime,timedelta## Below Start & End Date is used for Metrics Such as EC2's CPU Percentage etc.start_date=datetime.now()-timedelta(days=7)end_date=datetime.now()## Returns List of Attributes and Methods of this Package / Module.print(dir(awscloud.AWSCloud))## Refer Configuration from https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.htmlaws_object=awscloud.AWSCloud(session=boto3.Session(profile_name=PROFILE_NAME,region_name=REGION_NAME))## List AWS EC2 Instances.print(aws_object.List_EC2_Instances())## List AWS EC2 Volumes.print(aws_object.List_EC2_Volumes())## List AWS EC2 Snapshots.print(aws_object.List_EC2_Snapshots())## List AWS EC2 Security Groups.print(aws_object.List_EC2_Security_Groups())## List AWS EC2 Load Balancers.print(aws_object.List_EC2_Load_Balancers())## List AWS EC2 Network Interfaces.print(aws_object.List_EC2_Network_Interfaces())## List AWS EC2 Key Pairs.print(aws_object.List_EC2_Key_Pairs())## List AWS Elastic Beanstalk Applications.print(aws_object.List_Elastic_Beanstalk_Apps())## List AWS S3 Buckets.print(aws_object.List_S3_Buckets())## List AWS Lambda Functions.print(aws_object.List_Lambda_Functions())## List AWS RDS Databases.print(aws_object.List_AWS_RDS())## List AWS EC2 CPU Utilization Metrics.print(aws_object.Get_EC2_CPU_Metrics(start_date=start_date,end_date=end_date))## List AWS Trusted Advisor for Cost Optimizing.print(aws_object.List_Cost_Trust_Advisor())ContributingPull Requests are Welcome. For Major Changes, Please Open an issue First to Discuss What You Would like to Change.Please Make Sure to Update Tests as Appropriate.LicenseMIT
Package: aws-cloudformation-power-switch
AWS CloudFormation power switchAWS CloudFormation power switch allows you to shutdown and startup all EC2, ECS, RDS andAutoScaling instances managed by one or more CloudFormation stacks.install the power switchto install the power switch, type:pipinstallaws-cloudformation-power-switchshutdownto shutdown all instances managed by CloudFormation stacks starting with the namedev, type:cfn-power-switch--dry-run--stack-name-prefixdevonThis will show you which EC2, RDS and AutoScaling instances will be shutdown. For Auto Scaling groups, the
desired number of instances is set to 0. If the minimum is greater than 0, it will change the minimum setting too.startup`to startup all instances managed by a CloudFormation stacks starting with the namedev, type:cfn-power-switch--dry-run--stack-name-prefixdevoffThis will show you which EC2, RDS and AutoScaling instances will be started. The AutoScaling desired number of
instances will be set the maximum desired instances. Remove the--dry-runand it will be activated.deploy the power switchTo deploy the power switch as an AWS Lambda, type:gitclonehttps://github.com/binxio/aws-cloudformation-power-switch.gitcdaws-cloudformation-power-switch.git
awscloudformationdeploy\--capabilitiesCAPABILITY_IAM\--stack-nameaws-cloudformation-power-switch\--template-file./cloudformation/aws-cloudformation-power-switch.yamlDemoinstall the demonstration, type:aws cloudformation deploy \
	--capabilities CAPABILITY_IAM \
	--stack-name aws-cloudformation-power-switch-demo \
	--template-file ./cloudformation/demo-stack.yamlThis deploy an ec2 instance, an autoscaling group and a RDS MySQL database instance, It willshutdown down all EC2, RDS and Auto Scaling instances managed by CloudFormation stacks startingwith the namedevat 23:30 and start them backup at 7:30 in the morning.To manual stop all the instance, type:cfn-power-switch --verbose --stack-name-prefix aws-cloudformation-power-switch offIt will take few minutes before everything is shutdown and you can restart the stack.to start everything back up, type:cfn-power-switch --verbose --stack-name-prefix aws-cloudformation-power-switch offIt will take few minutes before everything is running again.Do not forget to delete the stack:aws cloudformation delete-stack --stack-name aws-cloudformation-power-switch-demoCaveatsThe power switch will only start instances instoppedstate, and stop instances in theavailableorrunning` state. If it is transitioning between states, no action is taken.As CloudFormation does not place theaws:cloudformation:tags on RDS Aurora Clusters, we need to load all CloudFormation stacks and resources to find out whether we need to start or stop it. And listing all CloudFormation stacks is very, very slow...the ECS services desired count is read from the lateststarted [0-9]+ tasksevent of that servicethe auto scaling group desired count is set to the max when powering on.
Package: aws-cloudhsm-cli
CloudHsmCLI 3.0.8Released: 15-Mar-2016DescriptionCloudHsmCLI is a Python package that provides a command line interface
and supporting Python libraries to perform administrative tasks
requiring coordination between the AWS CloudHSM service and the
customer’s LunaSA HSM.Getting Started with CloudHSMSee our documentationonlinefor the latest guide to using the
CloudHSM service.
Package: aws-cloud-instance-list
# aws-cloud-instance-listConsole command which show all instances from current VPC.
This command uses in bastion host for show list of instances and connection using this data to another instance in private network.![list example](./example.png)## Install`bash pip3 installaws-cloud-instance-list`To bastion instance need add managed roleAmazonEC2ReadOnlyAccessFor usingmsshneed add to instance policy`json { "Version":"2012-10-17","Statement":[{"Condition":{"StringEquals":{"aws:ResourceTag/<tag-key>":"<tag-name>"}},"Action":"ec2-instance-connect:SendSSHPublicKey","Resource":"arn:aws:ec2:<region>:<profile_id>:instance/*","Effect":"Allow"}]}`## Update`bash pip3 installaws-cloud-instance-list--upgrade`## Deploy to pypi` python setup.py register-rpypi python setup.py sdist upload-rpypi `#### Check readme` python-mreadme_renderer README.md-o/tmp/README.html `
Package: awscloudwatchlogger
# python setup.py sdist bdist_wheel# twine upload dist/*from awslogger import CloudWatchLoggerimport logging# Replace 'your_aws_key' and 'your_aws_secret' with actual values# Create an instance of the CloudWatchLogger classlogger = CloudWatchLogger(ACCESS_KEY, SECRET_KEY, REGION_NAME)logger.set_log_level(logging.ERROR)  # Set logging level to INFOlog_group_name = 'my-log-group'log_stream_name = 'my-log-stream'logger.create_log_group(log_group_name)logger.create_log_stream(log_group_name, log_stream_name)function_name = 'Test function'# # Log at different levelslogger.put_log_event(log_group_name, log_stream_name, "This is info message.", function_name, log_level=logging.INFO)logger.put_log_event(log_group_name, log_stream_name, "This is debug message.", function_name, log_level=logging.DEBUG)logger.put_log_event(log_group_name, log_stream_name, "This is warning message.", function_name, log_level=logging.WARNING)logger.put_log_event(log_group_name, log_stream_name, "This is critical message.", function_name, log_level=logging.CRITICAL)logger.put_log_event(log_group_name, log_stream_name, "This is error message.", function_name, log_level=logging.ERROR)
Package: aws-cloudwatch-log-minder
AWS Cloudwatch Log minderAWS CloudWatch logs is an useful logging system, but it has two quircks. It does not allow you too set a default
retention period for newly created log groups, and it does not delete empty log streams that are older than
the retention period. This utility:sets a default retention period on log groups without a period set.removes empty log streams older than the retention period of the log groupYou can use it as a command line utility. You can also install it as an AWS Lambda function and have your
logs kept in order, NoOps style!install the log minderto install the log minder, type:pipinstallaws-cloudwatch-log-minderset default retention periodto set the default retention period on log groups without one, type:cwlog-minder--dry-runset-log-retention--days30This will show you which log groups will have its retention period set. Remove the--dry-runand
it the retention period will be set. If you wish to set the retention of all log groups to the same
value, type:cwlog-minder--dry-runset-log-retention--days30--overwritedelete empty log streamsTo delete empty log streams older than the retention period, type:cwlog-minder--dry-rundelete-empty-log-streamsThis will show you which empty log streams will be deleted. Remove the--dry-runand
these stream will be deleted.deploy the log minderTo deploy the log minder as an AWS Lambda, type:gitclonehttps://github.com/binxio/aws-cloudwatch-log-minder.gitcdaws-cloudwatch-log-minder
awscloudformationdeploy\--capabilitiesCAPABILITY_IAM\--stack-nameaws-cloudwatch-log-minder\--template-file./cloudformation/aws-cloudwatch-log-minder.yaml\--parameter-overridesLogRetentionInDays=30This will install the log minder in your AWS account and run every hour.delete empty log groupsTo delete empty log groups, type:cwlog-minder--dry-rundelete-empty-log-groupsThis will show you which empty log groups will be deleted. Remove the--dry-runand
these groups will be deleted. Do not use this command, if your log groups are
managed by CloudFormation or Terraform.verboseexportLOG_LEVEL=DEBUG
cwlog-minder...region and profile selectionAWS regions and credential profiles can be selected via command line
arguments or environment variables.region via parametercwlog-minder--regioneu-west-1...region via environmentexportAWS_DEFAULT_REGION=eu-west-1
cwlog-minder...profile via parametercwlog-minder--profiledev...profile via environmentexportAWS_PROFILE=dev
cwlog-minder...
Package: aws-cloudwatch-logs
Cloudwatch logsGet logs from AWS CloudWatch.A wokring AWS configuration is expcted.I personally useaws-vaultfor that matter.WhyThere are tools likesaw, but I am not quite comfortable with all of them. So I just wanted to try and do it myself.UsageGet help:aws_cloudwatch_logs -h
    aws_cloudwatch_logs get-stream -h
    aws_cloudwatch_logs follow-stream -h
    aws_cloudwatch_logs insights -hGet the most recent log events of a stream# Get log events going 1 hour back in time, until now.
    aws_cloudwatch_logs get-stream --region <aws_region> --group <log_group> --stream <log_stream_prefix>  --start-time 1
    # Get log events going 1 minute back in time, until now.
    aws_cloudwatch_logs get-stream --group <log_group> --stream <log_stream_prefix>  --start-time 1 --time_unit minutesThis returns the most recent log events of the given stream.The--limitoption actually affects the total number if log events returned.Follow the most recent log events of a stream# Get log events going 1 hour back in time, follow the log stream and listen for more.
    aws_cloudwatch_logs follow-stream --region <aws_region> --group <log_group> --stream <log_stream_prefix>  --start-time 1This is mostly the same as  the above. It returns the most recent logevents of the given stream, but stays "connected" and gives every new incoming log event as well.
The loop is broken e.g. by aKeyboardInterrupt.The--limitoption reduces the number of log events retrieved by a single request.
Requests will be repeated (the stream is followed) until the program stops.Using Insightsaws_cloudwatch_logs insights --region <aws_region> --group <log_group> --start_time 1 --limit 1000 --query 'fields @timestamp, @message | sort @timestamp desc | limit 20'This command allows querying AWS CloudWatch logs using Insights.ConfigurationWays to configureWhen used as an executable or script the configuration happens using cli arguments.The tool also considers environment variables.This is the mapping:cli optionenvironemt variabledefault-r,--regionAWS_REGIONeu-west-1-g,--groupLOG_GROUPNone-s,--streamLOG_STREAMNone--start_timeSTART_TIME3--time_unitTIME_UNIThours--limitLIMIT20--queryQUERYfields @timestamp, @message | sort @timestamp desc | limit 20OptionsThe--start_timeexpects an integer. Additionally the option--time_unit, which defaults tohours, can be used.--start_timedefaults to3.Possible values for--time_unitare:hours(default)minutesAlso, there is a--limitoption which limits the result per request.--limitdefaults to20.The given log stream name is evaluated using the optionlogStreamNamePrefixof thefilter_log_eventsfunction of theboto3logs client.
I.e. it's not important to specifiy the complete and exact log stream name, but anexact prefix.
Package: awscm
awscmpronounced as awesomeisa python project for easy monitoring of aws jobs, services, alarms and other things aws.Note: - This is a work in progress. Also I am using this project to learn about python packages , test driven development , python best practices & everything else a python project could need.So Expect massive breaking changes.Installpip3 install awscmWant to HelpCheckout ourCONTRIBUTING.mdThis project pledges by the "Covenant Code of Conduct" and so must you.Read more hereCODE_OF_CONDUCT.md