投稿時間:2021-07-25 02:25:38 RSSフィード2021-07-25 02:00 分まとめ(29件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Management Tools Blog Cost optimization in AWS using Amazon CloudWatch metric streams, AWS Cost and Usage Reports and Amazon Athena https://aws.amazon.com/blogs/mt/cost-optimization-aws-amazon-cloudwatch-metric-streams-aws-cost-and-usage-reports-and-amazon-athena/ Cost optimization in AWS using Amazon CloudWatch metric streams AWS Cost and Usage Reports and Amazon AthenaYou can use metric streams to create continuous near real time streams of Amazon CloudWatch metrics to a destination of your choice Metric streams make it easier to send CloudWatch metrics to popular third party service providers using an Amazon Kinesis Data Firehose HTTP endpoint You can create a continuous scalable stream that includes the most up to date CloudWatch … 2021-07-24 16:37:20
AWS AWS Management Tools Blog Monitor network throughput of interface VPC endpoints using Amazon CloudWatch https://aws.amazon.com/blogs/mt/monitor-network-throughput-of-interface-vpc-endpoints-using-amazon-cloudwatch/ Monitor network throughput of interface VPC endpoints using Amazon CloudWatchSecurity cost and performance are always a top priority for AWS customers when they design their network nbsp AWS PrivateLink nbsp is becoming increasingly popular because it provides secured private connectivity between Amazon Virtual Private Cloud Amazon VPC AWS services and your on premises networks without exposing your traffic to the public internet In this blog post we show you … 2021-07-24 16:13:56
python Pythonタグが付けられた新着投稿 - Qiita DjangoでWebアプリ開発環境の構築(その①) https://qiita.com/smiler5617/items/92564143097643751027 pythonmanagepyrunserverブラウザでhttplocalhostに接続できれば起動確認はOKサンプルアプリの起動・作成したプロジェクトに移動し、Webアプリのテンプレートを展開cdプロジェクト名※上位階層のプロジェクト名に移動pythonmanagepystartapp適当なアプリ名このコマンドより【プロジェクト名】フォルダの直下に、【アプリ名】のフォルダが作成され、その中に以下のファイルが作成される。 2021-07-25 01:37:00
python Pythonタグが付けられた新着投稿 - Qiita [備忘録]ax+by=cを満たす(x,y)をPythonで求める https://qiita.com/myon-bioinformatics/items/22fba796237e52e3e929 備忘録axbycを満たすxyをPythonで求めるはじめに先日、大学入試の問題を解いていたとき、ユークリッドの互除法に関する問題の解を調べるため、Pythonでコーディングを行ったので、備忘録として残します。 2021-07-25 01:14:46
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Pythonのmultiprocessingで、wavからmp3への変換を行いたい https://teratail.com/questions/351073?rss=all Pythonのmultiprocessingで、wavからmpへの変換を行いたい前提・実現したいこと自宅にあるNASからスマホで音楽を聞くために、wavファイルをmpファイルに変換するPythonスクリプトを作っています。 2021-07-25 01:55:47
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Django adminにおいて記事が削除できない https://teratail.com/questions/351072?rss=all Djangoadminにおいて記事が削除できないDjangoにて簡単な記事アプリを作成中なのですが、記事が削除できない状態に陥っています。 2021-07-25 01:43:43
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) CA1416の警告の意味と対処法 https://teratail.com/questions/351071?rss=all marshalreleasecomobject 2021-07-25 01:32:05
AWS AWSタグが付けられた新着投稿 - Qiita 【500エラー】【AWS】RDSに日本語が保存できない問題 Rails on Docker https://qiita.com/asami___t/items/11313b0c2a1cd7fb92ef 原因RDSで作成したMySQLのDBに日本語が保存できないことRDSではDefaultでcharactersetにlatinが割り当てられるため、日本語を利用する際はutfなどに変更してあげる必要があったのでした。 2021-07-25 01:53:37
AWS AWSタグが付けられた新着投稿 - Qiita Fargate+Secrets Managerで環境変数管理 https://qiita.com/greenteabiscuit/items/7e6c2a11e4882ec6e3f4 FargateSecretsManagerで環境変数管理前提AWSCLIが入っていることcreatesecretcreatesecretをコマンドラインから行います。 2021-07-25 01:36:21
Docker dockerタグが付けられた新着投稿 - Qiita 【500エラー】【AWS】RDSに日本語が保存できない問題 Rails on Docker https://qiita.com/asami___t/items/11313b0c2a1cd7fb92ef 原因RDSで作成したMySQLのDBに日本語が保存できないことRDSではDefaultでcharactersetにlatinが割り当てられるため、日本語を利用する際はutfなどに変更してあげる必要があったのでした。 2021-07-25 01:53:37
Docker dockerタグが付けられた新着投稿 - Qiita 開発学習備忘録 https://qiita.com/hirotomo223/items/5d9463aeac319f5b7605 docker 2021-07-25 01:41:12
Docker dockerタグが付けられた新着投稿 - Qiita docker php-fpm に ldap拡張を組み込む https://qiita.com/okadabasso/items/a51da796d5fdd7e2aa8a 2021-07-25 01:12:21
Git Gitタグが付けられた新着投稿 - Qiita 開発学習備忘録 https://qiita.com/hirotomo223/items/5d9463aeac319f5b7605 docker 2021-07-25 01:41:12
Ruby Railsタグが付けられた新着投稿 - Qiita 【500エラー】【AWS】RDSに日本語が保存できない問題 Rails on Docker https://qiita.com/asami___t/items/11313b0c2a1cd7fb92ef 原因RDSで作成したMySQLのDBに日本語が保存できないことRDSではDefaultでcharactersetにlatinが割り当てられるため、日本語を利用する際はutfなどに変更してあげる必要があったのでした。 2021-07-25 01:53:37
Ruby Railsタグが付けられた新着投稿 - Qiita 開発学習備忘録 https://qiita.com/hirotomo223/items/5d9463aeac319f5b7605 docker 2021-07-25 01:41:12
Ruby Railsタグが付けられた新着投稿 - Qiita Rails バリデーションの使い方と種類について https://qiita.com/Hashimoto-Noriaki/items/15e0b3e952fa31550569 Railsバリデーションの使い方と種類についてバリデーションとはデータを保存する不正なデータがデータベースに保存されないようにデータをチェックするシステムです。 2021-07-25 01:35:07
海外TECH DEV Community Unit Testing - Introduction https://dev.to/foxandxss/unit-testing-introduction-4ohg Unit Testing IntroductionLet s talk about unit testing our applications What is unit testing and why should I care Unit tests are a bunch of Typescript files that we create to make sure that every part of our application works as it is expected to work That means that we need to write hundred of lines of code to assert that our code does what is supposed to do Isn t that a waste of time The boss is always telling us that we need to be faster and hundred of lines doesn t sound like fast Au contraire that bunch of code will save us HOURS Don t believe me I have proofs lt more gt Extra code How many times did you end with code that is not used Maybe we added some extra loops that are not needed or some function to do something and then realize that we are not using it When we code our modules before any test we don t actually know what we are going to need or if our algorithm is going to support any kind of input that could lead to those extra loops More code means more stuff to maintain which also means more money Bad API design Maybe we need to create a new service to do something and then we start writing functions to do the work and we put some of them public to define the service s API Good that is the idea isn t it Some time after we get complaints about our really poor API that well it is not as intuitive as we expected In this category also goes those API functions that are not really needed which is also extra code Refactor What happens when we want to refactor our code We are in big trouble Even when we decide to not break the API maybe that internal change is not working properly on some edge cases where it worked in the past That will break the application for some people and they won t be happy at all and those kind of bugs are normally a pain to debug Will it work That is the end goal and probably the biggest time waster of anything you have to do in your applicaton Something as simple as a calendar involves some maths and some magic numbers to make it work We really need to be sure it works How We open a certain date we manually check with our OS calendar to see if it matches We repeat that for some random dates old ones future ones Then we change something in our service and well we need to check the dates again to assert that nothing is broken Repeat that times for a normal service development How does the unit test help Ok you convinced me that maybe I was wrong about not doing unit testing But how can it help with those problems What if we see a really simple example General example not Angular related and it will be in a really slow peace to make the point Let s say I want an object which will be able to do some basic maths Addition and Division Your first thought is to start writing a class with some methods to do some math We will end doing something like that but what we are going to do is to test it first Test it first Why Bear with me If you want to follow this I have a codesandbox for you to work This codesandbox and the Angular app that we will test in the next sections uses Jest Jest is a testing framework that can be used for any Javascript Typescript project Our object should be able to sum and and get Let s test that File src calculator spec tsdescribe Calculator gt it should be able to sum and to return gt Arrange const calc new Calculator Act const result calc sum Assert expect result toBe Before we even look at the Tests tab at codesandbox let s talk about this piece of code First we see that this looks like something between English and Typescript Testing is meant to be something that is easy to read and easy to understand and just by reading the code we get an idea of what it does Describe a calculator It should be able to run and to return Create a calculator object call a method and expect the result to be Now back to technical details tests are wrapped into describe functions They are used to group our tests The actual tests are functions called it where we actually code our tests Inside those it functions we follow a pattern called AAA Arrange Act Assert With those steps we successfully write a test In this example we are Arranging by creating a Calculator object then Acting by calling it s sum method and Asserting by checking its result with our expected result Alright but what is the result of this test Kind of expected isn t it We wrote our test before we even created our Calculator class Something interesting to notice here is how are we designing our API before we even coded it We say that we want a sum method before we created the class Let s fix this Shall we File src calculator tsexport class Calculator sum num number num number number return And also let s import it to our spec file File src Calculator spec ts import Calculator from calculator describe Calculator gt What does our test says now But That is definitely not right isn t it We hardcoded the result into the method That way our tests surely pass We have to code the minimum possible code to make our tests pass I understand that this is a contrived example and we already know that this implementation is not enough but in a real world scenario as we will see in the next sections you may not know when an implementation is enough or not so our job is to make a test pass as simple as possible as we did in here Since we may not be sure that this implementation is enough we have to write more tests File src calculator spec tsit should be able to sum a number with gt const calc new Calculator const result calc sum expect result toBe If we see the test tab we see test failed test passed And we can see where it failed and why We expected the result of but we got That means that something is wrong with our code This solves our Will it work dilemma We can immediately see that our code doesn t really work so we need to fix it so all our test passes Let s fix it File src calculator tsexport class Calculator sum num number num number number return num num Now our tests says Before we move on let s take a peek to our current spec file import Calculator from calculator describe Calculator gt it should be able to sum and to return gt Arrange const calc new Calculator Act const result calc sum Assert expect result toBe it should be able to sum a number with gt const calc new Calculator const result calc sum expect result toBe First notice here that every it in our spec file is completely independent of the others They run independently and you should never ever rely on the way they are ordered to start something in one one them and assert in the other In fact Jest may run the it in a random order to avoid dependency between them Also look at the code There is some repetition in it The DRY don t repeat yourself principle doesn t apply as strongly as it does in our application code We are allowed to repeat some code for the sake of testing but that doesn t mean that we should repeat all our code In this case we are repeating our Arrange part in those two tests and if we have of them we are going to repeat it times We can do better There is a method called beforeEach that runs before each it function There we can setup whatever we need for each test Let s Arrange our code there so we have access to calc in each test Let s look at the new code File src calculator spec ts import Calculator from calculator describe Calculator gt let calc Calculator beforeEach gt Arrange calc new Calculator it should be able to sum and to return gt Act const result calc sum Assert expect result toBe it should be able to sum a number with gt const result calc sum expect result toBe This is a test refactor We should only do them when all our tests are green to be sure that it doesn t break anything So far so good let s throw more different scenarios to see it behaves correctly it should be able to sum a negative number for a positive result gt const result calc sum expect result toBe it should be able to rum a negatrive number for a negative result gt expect calc sum toBe Notice how I wrote two lines in one in the last example It is still readable so it is good in my book Seems like our code handles this two use cases correctly Now let s move to division but before we do that we could group or sum test in their own describe like this File src calculator spec ts import Calculator from calculator describe Calculator gt let calc Calculator beforeEach gt Arrange calc new Calculator describe sum gt it should be able to sum and to return gt Act const result calc sum Assert expect result toBe it should be able to sum a number with gt const result calc sum expect result toBe it should be able to sum a negative number for a positive result gt const result calc sum expect result toBe it should be able to rum a negatrive number for a negative result gt expect calc sum toBe We can anidate as many describe as we need Also notice the at sum It is a convention that says that we are testing a method Now let s create a new describe for a division with a simple test File src calculator spec ts it should be able to rum a negatrive number for a negative result gt expect calc sum toBe describe division gt it should be able to do an exact division gt const result calc division expect result toBe It fails What a surprise Let s fix it real quick File src calculator ts export class Calculator sum num number num number number return num num division num number num number number return num num This time with the application requisites a bit clearer we wrote a better division method We don t want or Calculator to deal with decimals because who likes decimal anyway File src calculator spec ts it returns a rounded result for a non exact division gt expect calc division toBe Apparently Typescript does like them Let s fix that File src calculator spec ts export class Calculator sum num number num number number return num num division num number num number number return Math round num num Yay not only in rounds numbers now but our other test still works as expected Now we want to throw an exception if we divide something by File src calculator spec ts it throws an exception if we divide by gt expect gt calc division toThrow Division by not allowed This test looks different Instead of passing a variable to expect we are passing a function The idea is something like We expect that when running this function an exception will be thrown Since division won t be able to return anything if it throws an exception we cannot test the result as we previously did This test obviously fails Let s see our code before we change it File spec calculator ts export class Calculator sum num number num number number return num num division num number num number number return Math round num num Division by happened when divisor is but which is which in our code Let s refactor our code but before we do that we need our tests to pass and we have one that is failing What we can do is skip the test until we refactor File src calculator spec ts xit throws an exception if we divide by gt expect gt calc division toThrow Division by not allowed Notice the xit We use this as a way to ignore a test We can always comment out the code but that way we may forget that we had a test to fix With xit we can see that it exist but that it was skipped NOTE codesandbox doesn t manage this xit very well but at least it says that there are no failing testsNow we our broken test ignored let s refactor our code export class Calculator sum num number num number number return num num division dividend number divisor number number return Math round dividend divisor Much better and tests still pass NOTE As mentioned codesandbox doesn t manage this well and you may see a red X saying failed but all correct in the summary that is fine That is a code refactor without the fear of breaking any feature Now swap the xit for it again File src calculator spec ts it throws an exception if we divide by gt expect gt calc division toThrow Division by not allowed And let s fix the code export class Calculator sum num number num number number return num num division dividend number divisor number number if divisor throw new Error Division by not allowed return Math round dividend divisor And that is it Congratulations you just wrote your first test suite Conclusions of this exampleEven when it is really really simple example We already saw how we can address those problems I described earlier Our calculator doesn t have any extra code because we coded just what we needed to make our calculator work Its API design is good enough that is because we used it as we would like to use it on the real world Will it work Sure I have a bunch of tests that proves that What about refactor Go ahead if the tests still pass then you re doing good Maybe you won t notice it with this example but with proper tests you will save a lot of hours maintaining extra code dealing with API design with hopefully won t end on breaking changes refactoring code without fear and of course being sure that your code will work Testing is your friend and with little effort on it will save us real pain See you in the next section where we will dive into mock and spies to then test an Angular component from scratch 2021-07-24 16:20:46
海外TECH DEV Community A simple Python wrapper to AWS Dynamodb https://dev.to/dineshsonachalam/a-simple-python-wrapper-to-aws-dynamodb-3kno A simple Python wrapper to AWS DynamodbI created a minimalistic python wrapper to AWS Dynamodb Github repo Table of contentsInstallationExampleConnect to DynamodDBCreate a new tableGet all table namesCreate a New ItemRead an ItemRead items by filterUpdate existing attribute in an itemAdd a new attribute in an itemAdd an attribute to the listAdd an attribute to the string setIncrease an existing attribute valueDelete an attribute from an itemDelete an attribute from the string setDelete an itemDelete a tableRunning testsGithub Workflow ArtifactsLicense Installationpip install LucidDynamodbNote Prerequisite for Python development Example Connect to DynamoDBYou can connect to DynamoDB by following any of these two ways Using AWS configfrom LucidDynamodb import DynamoDbdb DynamoDb pip install awscli can add user flag aws configureAWS Access Key ID ABCD enter your key here AWS Secret Access Key xyz enter your secret key here Default region name us west enter your region here Default output format None Using AWS secret keyfrom LucidDynamodb import DynamoDbimport osAWS ACCESS KEY ID os getenv AWS ACCESS KEY ID AWS SECRET ACCESS KEY os getenv AWS SECRET ACCESS KEY db DynamoDb region name us east aws access key id AWS ACCESS KEY ID aws secret access key AWS SECRET ACCESS KEY Create a new tablefrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import TableAlreadyExists import logginglogging basicConfig level logging INFO table schema TableName dev jobs KeySchema AttributeName company name KeyType HASH AttributeName role id KeyType RANGE AttributeDefinitions AttributeName company name AttributeType S AttributeName role id AttributeType S GlobalSecondaryIndexes ProvisionedThroughput ReadCapacityUnits WriteCapacityUnits if name main try db DynamoDb db create table table name table schema get TableName key schema table schema get KeySchema attribute definitions table schema get AttributeDefinitions global secondary indexes table schema get GlobalSecondaryIndexes provisioned throughput table schema get ProvisionedThroughput logging info f table schema get TableName table created successfully except TableAlreadyExists as e logging error f table schema get TableName table creation failed e dineshsonachalam macbook examples python create a new table pyINFO botocore credentials Found credentials in environment variables INFO root dev jobs table created successfully Get all table namesfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError import logginglogging basicConfig level logging INFO if name main try db DynamoDb table names db read all table names logging info f Table names table names except UnexpectedError as e logging error f Read all table names failed e dineshsonachalam macbook examples python get all table names pyINFO botocore credentials Found credentials in environment variables INFO root Table names CertMagic dev jobs dev test kp config v test Create a new itemfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError import logginglogging basicConfig level logging INFO if name main try db DynamoDb db create item table name dev jobs item company name Google role id role Software Engineer salary locations Mountain View California Austin Texas Chicago IL yearly hike percent benefits set Internet Medical Edu reimbursements Health insurance Travel reimbursements overall review overall rating compensation and benefits logging info Item created successfully except UnexpectedError as e logging error f Item creation failed e dineshsonachalam macbook examples python create a new item pyINFO botocore credentials Found credentials in environment variables INFO root Item created successfully Read an itemfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import ItemNotFound import logginglogging basicConfig level logging INFO if name main try db DynamoDb item db read item table name dev jobs key company name Google role id logging info f Item item except ItemNotFound as e logging error f Item doesn t exist e dineshsonachalam macbook examples python read an item pyINFO botocore credentials Found credentials in environment variables INFO root Item locations Mountain View California Austin Texas Chicago IL role id overall review compensation and benefits overall rating company name Google role Software Engineer yearly hike percent Decimal salary benefits Travel reimbursements Internet Medical Edu reimbursements Health insurance Read items by filterfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import QueryFilterValidationFailed import loggingfrom boto dynamodb conditions import Keylogging basicConfig level logging INFO if name main try db DynamoDb db create item table name dev jobs item company name Google role id role Software Architect salary locations Mountain View California yearly hike percent benefits set Internet reimbursements overall review overall rating compensation and benefits logging info Item created successfully items db read items by filter table name dev jobs key condition expression Key company name eq Google logging info f Items items except QueryFilterValidationFailed as e logging error f Items doesn t exist e dineshsonachalam macbook examples python read items by filter pyINFO botocore credentials Found credentials in environment variables INFO root Item created successfullyINFO root Items locations Mountain View California Austin Texas Chicago IL role id overall review compensation and benefits overall rating company name Google role Software Engineer yearly hike percent Decimal salary benefits Internet Medical Edu reimbursements Travel reimbursements Health insurance locations Mountain View California role id overall review compensation and benefits overall rating company name Google role Software Architect yearly hike percent Decimal salary benefits Internet reimbursements Update existing attribute in an itemfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError import logginglogging basicConfig level logging INFO if name main try db DynamoDb db update item table name dev jobs key company name Google role id attributes to update role Staff Software Engineer logging info Update is successful item db read item table name dev jobs key company name Google role id logging info f Item item except UnexpectedError as e logging error f Update failed e dineshsonachalam macbook examples python update existing attribute in an item pyINFO botocore credentials Found credentials in environment variables INFO root Update is successfulINFO root Item locations Mountain View California Austin Texas Chicago IL role id overall review compensation and benefits overall rating company name Google role Staff Software Engineer yearly hike percent Decimal salary benefits Health insurance Internet Medical Edu reimbursements Travel reimbursements Add a new attribute in an itemfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError import logginglogging basicConfig level logging INFO if name main try db DynamoDb db update item table name dev jobs key company name Google role id attributes to update overall review yearly bonus percent logging info Update is successful item db read item table name dev jobs key company name Google role id logging info f Item item except UnexpectedError as e logging error f Update failed e dineshsonachalam macbook examples python add a new attribute in an item pyINFO botocore credentials Found credentials in environment variables INFO root Update is successfulINFO root Item locations Mountain View California Austin Texas Chicago IL role id overall review compensation and benefits overall rating yearly bonus percent Decimal company name Google role Staff Software Engineer yearly hike percent Decimal salary benefits Travel reimbursements Internet Medical Edu reimbursements Health insurance Add an attribute to the listfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError import logginglogging basicConfig level logging INFO if name main try db DynamoDb db update item table name dev jobs key company name Google role id attributes to update locations Detroit Michigan operation ADD ATTRIBUTE TO LIST logging info Update is successful item db read item table name dev jobs key company name Google role id logging info f Item item except UnexpectedError as e logging error f Update failed e dineshsonachalam macbook examples python add an attribute to the list pyINFO botocore credentials Found credentials in environment variables INFO root Update is successfulINFO root Item locations Mountain View California Austin Texas Chicago IL Detroit Michigan role id overall review compensation and benefits overall rating yearly bonus percent Decimal company name Google role Staff Software Engineer yearly hike percent Decimal salary benefits Health insurance Travel reimbursements Internet Medical Edu reimbursements Add an attribute to the string setfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError import logginglogging basicConfig level logging INFO if name main try db DynamoDb db update item table name dev jobs key company name Google role id attributes to update benefits Free Food operation ADD ATTRIBUTE TO STRING SET logging info Update is successful item db read item table name dev jobs key company name Google role id logging info f Item item except UnexpectedError as e logging error f Update failed e dineshsonachalam macbook examples python add an attribute to the string set pyINFO botocore credentials Found credentials in environment variables INFO root Update is successfulINFO root Item locations Mountain View California Austin Texas Chicago IL Detroit Michigan role id overall review compensation and benefits overall rating yearly bonus percent Decimal company name Google role Staff Software Engineer yearly hike percent Decimal salary benefits Travel reimbursements Free Food Health insurance Internet Medical Edu reimbursements Increase an existing attribute valuefrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError import logginglogging basicConfig level logging INFO if name main try db DynamoDb db increase attribute value table name dev jobs key company name Google role id attribute name yearly hike percent increment value logging info Attribute value increment completed item db read item table name dev jobs key company name Google role id logging info f Item item except UnexpectedError as e logging error f Attribute value increment failed e dineshsonachalam macbook examples python increase an existing attribute value pyINFO botocore credentials Found credentials in environment variables INFO root Attribute value increment completedINFO root Item locations Mountain View California Austin Texas Chicago IL Detroit Michigan role id overall review compensation and benefits overall rating yearly bonus percent Decimal company name Google role Staff Software Engineer yearly hike percent Decimal salary benefits Internet Medical Edu reimbursements Free Food Health insurance Travel reimbursements Delete an attribute from an itemfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError import logginglogging basicConfig level logging INFO if name main try db DynamoDb db delete attribute table name dev jobs key company name Google role id attribute name yearly hike percent logging info The attribute is deleted successfully item db read item table name dev jobs key company name Google role id logging info f Item item except UnexpectedError as e logging error f The attribute delete operation failed e dineshsonachalam macbook examples python delete an attribute from an item pyINFO botocore credentials Found credentials in environment variables INFO root The attribute is deleted successfullyINFO root Item locations Mountain View California Austin Texas Chicago IL Detroit Michigan role id overall review compensation and benefits overall rating yearly bonus percent Decimal company name Google role Staff Software Engineer salary benefits Travel reimbursements Free Food Health insurance Internet Medical Edu reimbursements Delete an attribute from the string setfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError import logginglogging basicConfig level logging INFO if name main try db DynamoDb db update item table name dev jobs key company name Google role id attributes to update benefits Free Food operation DELETE ATTRIBUTE FROM STRING SET logging info Update is successful item db read item table name dev jobs key company name Google role id logging info f Item item except UnexpectedError as e logging error f Update failed e dineshsonachalam macbook examples python delete an attribute from the string set pyINFO botocore credentials Found credentials in environment variables INFO root Update is successfulINFO root Item locations Mountain View California Austin Texas Chicago IL Detroit Michigan role id overall review compensation and benefits overall rating yearly bonus percent Decimal company name Google role Staff Software Engineer salary benefits Internet Medical Edu reimbursements Health insurance Travel reimbursements Delete an itemfrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import UnexpectedError from boto dynamodb conditions import Keyimport logginglogging basicConfig level logging INFO if name main try db DynamoDb db delete item table name dev jobs key company name Google role id logging info Item deleted successfully items db read items by filter table name dev jobs key condition expression Key company name eq Google logging info f Items items except UnexpectedError as e logging warning f Item delete operation failed e dineshsonachalam macbook examples python delete an item pyINFO botocore credentials Found credentials in environment variables INFO root Item deleted successfullyINFO root Items locations Mountain View California role id overall review compensation and benefits overall rating company name Google role Software Architect yearly hike percent Decimal salary benefits Internet reimbursements Delete a tablefrom LucidDynamodb import DynamoDbfrom LucidDynamodb exceptions import TableNotFound import logginglogging basicConfig level logging INFO if name main try db DynamoDb db delete table table name dev jobs logging info Table deleted successfully table names db read all table names logging info f Table names table names except TableNotFound as e logging error f Table delete operation failed e dineshsonachalam macbook examples python delete a table pyINFO botocore credentials Found credentials in environment variables INFO root Table deleted successfullyINFO root Table names CertMagic dev test kp config v test Running TestsTo run tests run the following commandpytest s LicenseMIT dineshsonachalam 2021-07-24 16:07:24
海外TECH DEV Community Migrating to AWS https://dev.to/aws-builders/migrating-to-aws-2bf0 Migrating to AWSCloud is the way to go And AWS is the most popular cloud service So it is natural that everyone wants to migrate to AWS But often that is not as simple as it sounds The bigger and older your legacy system the harder it is to migrate Amazon suggests a step by step process for performing such a migration Here are my two cents on that Why Migrate The benefits of being on the cloud have been repeatedly advertised over and over in the technical community I don t want to repeat them all over again But here let s look at some reasons why people are not eager to migrate Do we really need to migrate This question has held back many of us Billions of dollars are wasted every year because people are not able to conclude on this The answer is Yes Even the pettiest application deserves a place in the cloud May be you are just a simple desktop application that is doing well within the windows Even then connecting it to the AWS will add a lot of value that you can never imagine without a cloud Cloud LockingThat s another doubt bubbling in our mind Well to think of it if we are not on the cloud today we are locked in the premise And this locking is a lot more wasteful Jokes apart cloud locking is not a major problem anymore In the early days people had serious doubts if this cloud craze would really sustain itself Naturally they were cautious But today things have changed Well nothing is permanent but going by the numbers your on premise systems are going to break down much before Amazon They are not going anywhere We can bank on Amazon while planning our roadmap The strong competition among the service providers will make sure that we always get a very good price SecuritySome organizations are worried if the application and data are secure on the public cloud The fact is that nothing is safe If our application is connected to the internet it is only a matter of time before hackers get in We need a strong team of experts who can combat these hackers and keep us safe Unless information security is our key expertise having such experts on our team is very difficult So the data on our premises can never be secured Amazon on the other hand has an huge army of experts who can sustain the war against these hackers So if we follow the security guidelines they define for us our data on the cloud is a lot more secure than the data on premise Nothing is free from hackers Amazon Google and all the giants have been hacked and they live under the threat of more attacks Yet they are a lot safer than our premise They understand security much better than we do Which CloudOnce we have decided on the migration the natural question is which cloud Disclaimer I am heavily biased towards AWS as you will see in all my blogs But that is because I am impressed by the superiority of their services This is not sponsored by Amazon in any way When it comes to choosing a particular cloud I have seen some tendencies In most of the big corporate houses decisions are made by Directors and CEO s who have no idea about technology The only technology they know is Excel and Power Point Naturally they choose Azure when it comes to cloud There are some who don t want to think or change too much They want to quickly discard the premise and continue unchanged on the cloud They are not interested in improving Their goal is just to quickly get rid of the servers on premise They choose Digital Ocean because they provide the most cost effective server instances Rest of the world goes to AWS the most versatile and cost effective solution Google Oracle IBM Alibaba are great for specific use cases not so popular otherwise How to MigrateNow that we have chosen the path we are all set to get started To help us migrate fast Amazon provides us a roadmap and a good set of utilities and services Let us understand them in detail Commonly referred as the two models of five phases and six R s we hear this jargon all over the industry There is no one size fits all answer to determining the correct strategy for application migration But following these best practices can help us discover the right strategy for our application and organization Amazon recommends these with a disclaimer that after all each organization is different in culture and targets so the actual roadmap has to be chosen by the architects But these best practices provide a good starting point a baseline template that we can alter as per our requirements Five Phase Migration ProcessWith the five phase migration process you start with the least complex application to learn how to migrate while learning more about the target platform and then build toward the more complex applications This is not a waterfall but it should be an iterative process that lets us plan and go about doing this migration Phase Migration Preparation and Business PlanningIf you don t have a plan you are planning to fail Migration of an enterprise a live system is a significant effort A concrete plan is a must for any business endeavor This requires a good understanding of the baseline architecture It needs an engaged leadership that understands the costs benefits and is serious about the project This enables us to define a good roadmap that is aggressive in its goals and realistic in timelines A roadmap that provides fast and incremental returns that keeps the leadership engaged and interested in the process Phase Portfolio Discovery amp PlanningMost legacy systems were beautifully architected once upon a time But over the years they degenerate to a complex chunk of interconnected components that violate every possible architecture design and coding guidelines It is important to take stock of the current state of the enterprise Identify the complexity and dependencies among individual components so that we can segregate them into building blocks that can be migrated one by one Based on this exercise we can identify parts parts that are simpler and less critical than others Naturally we move these before the others This gives us the confidence in the process And it trains the developers who learn from the problems encountered in this process But even before we do this we should first work on a POC Identify the typical interfaces and flow of each system Based on this implement a simple hello world on the cloud that connects to similar databases and interfaces within the cloud This helps us understand what is feasible A friend once told me about his experience with a migration They had migrated most of it but were stuck on a few web applications They had a mean stack that they wanted to run on an Elastic Beanstalk They struggled with it till a few days before the deployment only to discover that MongoDB does not go well on an EBS Since it was AWS it did not take them time to spin off an independent Document DB instance and get the whole thing working in a day But such problems are better identified in a POC rather than a day before the go live Some points to note in this phase A major pitfall in this stage is to use the AWS Console to create the resources and deployments on the cloud This may be very tempting because of the intuitive UI and the helpful tips that the UI provides But this can land us in deep mess It is almost certain that we will not be able to replicate such a deployment without any error We always live with the risk that the tested application will not work on the production setup So it is very important to have a CloudFormation or a Terraform script ready to run on test or production environments As secret for those who are in a mess with this AWS CloudFormation now lets us create a template out of resources that we built using the UI console But it is best not to depend upon such saviors and get into the habit of using Infrastructure as Code Use the Code Commit Switch over to the Native AWS CI CD services like Code Pipeline Code Build and Code Deploy This should be a part of the POC and the migration checklist Any application migration is marked complete only after the pipeline is setup in AWS People often miss this step when the migrating to the cloud Then they have to struggle with transporting the binaries built on the premise Don t waste an EC instance only for Jenkins These services have a very small learning curve and should be learnt and put into practice from the first day Use CloudWatch for monitoring and managing the logs Don t waste an EC for collecting and processing system wide logs There are many advantages of using native CloudWatch over custom artificial applications Don t forego these advantages in the hurry to complete the POC Phase Design Migrate ValidateThis has to be an iterative agile process We cannot just switch off on premise data center and have everything ready on the cloud in a single shot We need a hybrid architecture over the few years of the migration process We pick applications one by one and migrate them to the cloud Based on the learnings of the Phase we make the necessary changes to each application and move it to the cloud one by one We can take bigger steps as we gain more confidence A few important points to note in this phase Don t try to redesign at this stage Take small steps First migrate everything to the cloud onto EC instances But when we migrate individual components we should try to place them individually on different EC instances Since we are splitting them anyway this is not an additional effort But it will pay off the future steps Enable code cloud logs to help us identify the usage and loading patterns on each EC instance We should take the effort to identify the right EC instance for each and reserve it There is a huge difference between the cost of a reserved and on demand EC instances We can start with an on demand instance to start with and evaluate our requirement But we should try to identify and reserve it as early as possible Reserve for a small duration so that we can change it as we learn Plan out a good VPC structure Follow the least privilege principle Even if all the instances are in our preview if they are not required to connect with each other they should not be able to connect This will harden the security of our system It is easy and tempting to ignore and postpone such an effort until everyone forgets about it But it pays off in the long run if we do it right now All through the migration process we will have data flowing from our premise deployment to the cloud This can be a security risk People try to cover it up by restricting based on the IP address etc But it is quite easy to fool such a protection AWS provides us with a range of services for implementing such a hybrid architecture Outpost Local Zone and many others They are not so costly and certainly worth the cost when we consider the security risk they mitigate Migrating compute is relatively simple But data migration is a major challenge We have two problems The huge amount of legacy data just cannot be migrated over the wire We have useful services like Snowball Snowmobile and Snowcone and their variants collectively called the Snow Family provide great options for doing this But a bigger challenge in migrating data is to keep the on premise data data in sync with the data on cloud throughout the migration process AWS Storage Gateway AWS Backup and AWS DataSync help us do this very efficiently Phase Modern Operating ModelNow that the application is migrated we have to focus on making it cloud worthy If we ignore this step all the effort above will be wasted and we might end up increasing the costs So we have to go through the effort of identifying areas where we can optimize By now we have a good fleet of EC instances They have been running for a several months We have a good data of their usage and loading patterns Based on this we can alter the choice of EC instances Some servers that are not doing anything time critical can be changed to Spot Instances If we notice the loading patterns vary with time we can use Auto Scaling with a Load Balancer Autoscaling can be self defeating if lose the advantage of reserving the instances But if we know the load patterns we can also reserve the instances based on time slots That gives us best of both the worlds Slowly dockerize the application Since we had split the enterprise into multiple EC instances now it is very easy to identify components that can be modified without affecting the others Identify potential Lambda functions There are a lot more than we can imagine Over time we should have only dockers and lambda functions in our compute While doing this we should also discard the EC instances one by one and move onto Fargate Drop the Kafka or other messaging services and move to Kinesis EventBridge SNS or SQS as per the requirement Migrate to cloud native databases like Aurora DocumentDB DynamoDB and other purpose built databases like TimeStream Keyspace Neptune Redshift Elasticache Redis Memcache As much as possible move from EC to docker and serverless Move storage to S Use S tiering to push unnecessary stuff into Infrequent Access or Glacier Use rule based or intelligent tiering if there are definite patterns in your data access Such optimizations will go a long way in reducing the costs and improving the resilience and scalability of the application Again don t worry about cloud locking Amazon is here to stay And locking into AWS is a lot better than locking into your premise equipment The Six R sThe principles we discussed above can be summarized in the six migration stragegies also called the R s RehostThis is the simple lift and shift approach move the application from the premises into the cloud with very little changes A lot of this effort can be automated using the AWS Server Migration Service ReplatformThis is often called Lift and tinker and shift That is making basic cloud optimizations on the applications Like using RDS instead of having a database running on an EC instance RepurchaseThis is also called Drop and Shop Here we identify redundant or better forms of the services we using Like lower configuration EC instances or Spot instances With this we replace existing instances and services with better ones Refactor RearchitectHere we change the way the application is architected and developed This usually involves employing cloud native features and services This is where we apply our understanding of AWS The benefits of migration are visible after this phase More effort we apply at this phase better is the outcome The value we generate here is related to the accuracy of the previous phases specially the Replatform RetireOnce we have the refactored and rearchitected system in place we can gradually retire the older infrastructure RetainDespite all the effort we will have some parts of the system that refuse to leave our premise We have to look for a long term plan to migrate them But till then we should enable ways to retain small parts on premise infrastructure ConclusionThese are the basic points that can help simplify the migration to cloud Of course each enterprise is different and the architect has to identify the right path to the migration The text book can only provide the ideal path And real life is quite different Yet we should know and make an attempt to align Wish you all the best for your migration Do share in comments what were your experiences in your adventure on AWS 2021-07-24 16:03:19
海外TECH DEV Community A GitHub Action that automatically generates & updates markdown content (like your README.md) from external or remote files. https://dev.to/dineshsonachalam/a-github-action-that-automatically-generates-updates-markdown-content-like-your-readme-md-from-external-or-remote-files-hp7 A GitHub Action that automatically generates amp updates markdown content like your README md from external or remote files Table of contents Why markdown autodocs Features Examples CODE Block JSON to HTML table Github Workflow Artifacts table Example Repo which uses all the markdown autodocs feature Local usage without Github action Usage Adding markdown autodocs in your workflow Extended example with all possible options available for this Action Github Workflow Artifacts Contributing Used By License Why markdown autodocsTo make your repo more appealing and useful you need to provide example code snippets in your README md Manually copy and pasting each code snippet in their respective places in your README would be inefficient and time consuming This problem can be solved using markdown autodocs a GitHub Action that automatically generates amp updates markdown content like your README md from external or remote files You need to add markers in your README md that will tell markdown autodocs where to insert the code snippet Features Code block Insert code snippet in your markdown file from external or remote files JSON to HTML table Insert HTML Table in your markdown file by converting JSON file contents to HTML table Github Workflow Artifacts table Insert the Github workflow artifacts table in your markdown file by getting the latest artifacts for a workflow run Examples CODE BlockGet code from an external file or URL and insert it in your markdown Options src The relative path to the code to pull in or the URL where the raw code lives JSON to HTML tableGet JSON contents from an external file and convert it into an HTML table and insert s it in your markdown Options src The relative path to the JSON file to pull in Github Workflow Artifacts tableGet the list of the latest artifacts generated from a workflow run Generates a workflow artifacts table consists of artifacts download and workflow URL in an HTML table and inserts it in your markdown file Example Repo which uses all the markdown autodocs feature Local usage without Github actionInstall markdown autodocs CLI npm i g markdown autodocsmarkdown autodocs CLI usage dineshsonachalam macbook markdown autodocs helpUsage markdown autodocs options Options o outputFilePath lt outputFilePaths gt Output file paths c category lt categories gt code block json to html table workflow artifact table r repo lt type gt Repo name b branch lt type gt Branch name a accessToken lt type gt Github Access token h help display help for command Code blockmarkdown autodocs c code block o README md JSON to HTML tablemarkdown autodocs c json to html table o README md Github workflow artifacts tablemarkdown autodocs c workflow artifact table o README md r REPO b BRANCH a ACCESSTOKEN Usage Adding markdown autodocs in your workflowAdd the following step at the end of your job after other steps that might add or change files uses dineshsonachalam markdown autodocs v Extended example with all possible options available for this Action name Markdown autodocs uses dineshsonachalam markdown autodocs v with Optional defaults to author of the commit that triggered the run commit author Author lt actions github com gt Optional defaults to actions github com commit user email actions github com Optional but recommended Defaults to Apply automatic changes commit message Apply automatic changes Optional branch name where commit should be pushed to Defaults to the current branch branch feature  Optional output file paths defaults to README md output file paths README md Categories to automatically sync or transform its contents in the markdown files Defaults to code block json to html table workflow artifact table categories code block json to html table workflow artifact table Used By iro js Modular color picker widget for JavaScript with support for a bunch of color formats LucidDynamodb A minimalistic wrapper to AWS DynamoDB LicenseMIT dineshsonachalam 2021-07-24 16:01:43
Apple AppleInsider - Frontpage News Best deals for July 24 - Nanoleaf Shapes starter kits, standing desk, TP-Link Router https://appleinsider.com/articles/21/07/24/best-deals-for-july-24---20-off-nanoleaf-shapes-starter-kits?utm_medium=rss Best deals for July Nanoleaf Shapes starter kits standing desk TP Link RouterSaturday s best deals include money off two starter sets for the HomeKit compatible Nanoleaf Shapes and off a standing desk for your Mac Best deals for Saturday July Shopping online for the best discounts and deals can be a difficult and annoying task Rather than sifting through miles of advertisements check out this list of sales we ve hand picked just for the AppleInsider audience Read more 2021-07-24 16:07:30
海外TECH Engadget Audi hopes its off-road hybrid will win the 2022 Dakar Rally https://www.engadget.com/audi-rs-q-e-tron-2022-dakar-rally-163605282.html?src=rss Audi hopes its off road hybrid will win the Dakar RallyThe Volkswagen group s desire to crush records with electrified cars now extends to one of the world s toughest off road challenges Autoblogreports that Audi has started testing the RS Q E Tron a from scratch hybrid off roader it hopes will score overall victory in the Dakar Rally If so it would be the first electrified vehicle to win the gruelling competition nbsp The RS Q E Tron relies on an electric drivetrain with two modified Formula E motors one at each axle As you won t find a charging station in the middle of the desert however Audi uses a race ready TFSI engine as part of an energy converter that charges the battery while driving and braking This isn t a zero emissions car then but it stays in a relatively efficient power band between RPM and RPM that should reduce the racer s environmental impact The machine should be highly adaptable too Unlike many EVs the front and rear axles aren t mechanically connected ーsoftware handles torque distribution instead That not only allows for an easily reconfigurable center differential but saves the bulk that would normally be used for a conventional differential and propshaft Audi plans to enter the machine into multiple cross country rallies in before participating in the Dakar Rally in January If Audi is successful the RS Q E Tron will make a stronger case for eco friendly endurance racing While not a pure EV it will handle extremely long stages up to miles with a significantly reduced emissions footprint It also won t surprise you to hear that Audi wants more than just bragging rights It expects lessons learned from the car to reach production cars We wouldn t count on something with a similar drivetrain when the VW group is transitioning to EVs but it s easy to imagine electric SUVs and crossovers that are better suited to off roading 2021-07-24 16:36:05
ニュース BBC News - Home Parkrun back on in England after Covid pandemic suspension https://www.bbc.co.uk/news/uk-57955672 covid 2021-07-24 16:36:51
ニュース BBC News - Home Goole WW2 bomb: Army experts carry out controlled explosion https://www.bbc.co.uk/news/uk-england-humber-57953506 device 2021-07-24 16:52:00
ニュース BBC News - Home De Lange claims Hundred's first five-wicket haul as Rockets beat Brave https://www.bbc.co.uk/sport/cricket/57955648 De Lange claims Hundred x s first five wicket haul as Rockets beat BraveMarchant de Lange takes the first wicket haul in The Hundred as Trent Rockets beat Southern Brave by nine wickets in the men s competition 2021-07-24 16:20:11
ニュース BBC News - Home Brilliant Rodrigues innings leads Superchargers to victory over Welsh Fire in women's Hundred https://www.bbc.co.uk/sport/cricket/57955128 Brilliant Rodrigues innings leads Superchargers to victory over Welsh Fire in women x s HundredJemimah Rodrigues plays the innings of The Hundred so far to take Northern Superchargers almost single handedly to victory over Welsh Fire 2021-07-24 16:42:51
北海道 北海道新聞 五輪柔道、高藤直寿が金メダル1号 女子・渡名喜風南は「銀」 https://www.hokkaido-np.co.jp/article/570692/ 東京五輪 2021-07-25 01:17:25
北海道 北海道新聞 上田晋也さんがコロナ感染 微熱と喉の痛み、体調は安定 https://www.hokkaido-np.co.jp/article/570683/ 上田晋也 2021-07-25 01:10:05
北海道 北海道新聞 なでしこ、札幌ドーム第2戦は黒星 一瞬の隙…英国に0―1 https://www.hokkaido-np.co.jp/article/570701/ 札幌ドーム 2021-07-25 01:04:19

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)