投稿時間:2022-01-02 18:26:34 RSSフィード2022-01-02 18:00 分まとめ(31件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita 外からアクセス可能な見守りタイムラプスカメラを自作する https://qiita.com/mo256man/items/9b451ff246e019437c98 functionfileNametimefileNameファイル名から時刻を取得するファイル名はYYYYMMDDHHmmssjpgとするvarstrTimefileNamesubstrfileNamelength拡張子を取り除くstrTimestrTimereplaceをに置換字しかないので正規表現しないstrTimestrTimereplacegをに置換複数あるので正規表現必須returnmomentstrTimemomentjsで文字列から時刻を取得するその他ここで自分の言葉で書けるほど深く理解したわけではないが、asyncを使ったsleep関数アロー関数コピペレベルimgsrcを書き換える際、同じファイル名だとキャッシュを参照して画像が変わらないことがあるのでパラメーターを渡して常にサーバーに見にいくようにする。 2022-01-02 17:52:50
python Pythonタグが付けられた新着投稿 - Qiita Speech SDKからAzure Cognitive ServicesのSpeech Serviceを使って自分の英語の発音を評価する https://qiita.com/ojaru/items/9a018a5db31da4c16885 ローカルからSpeechSDKを利用して音声を保存したwavファイルをSpeechServiceにアップロードここからは先程作成したSpeechServiceに音声ファイルをPythonでSpeechSDKを操作することでアップロードし、撥音の評価を行います。 2022-01-02 17:18:50
js JavaScriptタグが付けられた新着投稿 - Qiita 外からアクセス可能な見守りタイムラプスカメラを自作する https://qiita.com/mo256man/items/9b451ff246e019437c98 functionfileNametimefileNameファイル名から時刻を取得するファイル名はYYYYMMDDHHmmssjpgとするvarstrTimefileNamesubstrfileNamelength拡張子を取り除くstrTimestrTimereplaceをに置換字しかないので正規表現しないstrTimestrTimereplacegをに置換複数あるので正規表現必須returnmomentstrTimemomentjsで文字列から時刻を取得するその他ここで自分の言葉で書けるほど深く理解したわけではないが、asyncを使ったsleep関数アロー関数コピペレベルimgsrcを書き換える際、同じファイル名だとキャッシュを参照して画像が変わらないことがあるのでパラメーターを渡して常にサーバーに見にいくようにする。 2022-01-02 17:52:50
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ジェネリクスを使ったTypeScriptのメソッドについてです。 https://teratail.com/questions/376366?rss=all ジェネリクスを使ったTypeScriptのメソッドについてです。 2022-01-02 17:51:01
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 閲覧中の記事の下に関連記事を表示させる方法 https://teratail.com/questions/376365?rss=all 関連記事には記事を参照するフィールドを作成する️EVAの設定①バンドルを「記事」に設定する。 2022-01-02 17:26:40
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ワードプレスの警告”open_basedir restriction”の解決方法について https://teratail.com/questions/376364?rss=all ワードプレスの警告openbasedirrestrictionの解決方法についてワードプレスでホームページ作成をしているのですが、下のようなエラー分が表示されています。 2022-01-02 17:22:29
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 音声でWebAPIを呼び出したい https://teratail.com/questions/376363?rss=all google 2022-01-02 17:12:07
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Binanceでの自動取引を実現したい_売り注文エラー https://teratail.com/questions/376362?rss=all Binanceでの自動取引を実現したい売り注文エラー前提・実現したいことpython初心者です。 2022-01-02 17:06:19
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Recognize text in images with ML Kit on Android ができない https://teratail.com/questions/376361?rss=all RecognizetextinimageswithMLKitonAndroidができないこちらを参考に画像から文字認識をやろうと思うのですがうまくいきません。 2022-01-02 17:05:19
Linux Ubuntuタグが付けられた新着投稿 - Qiita Windows10にWSL2を出来るだけコマンド入力をせずにインストールする https://qiita.com/take-0333/items/4c4ecdc7cb574278a81d この記事の対象読者WSLがWindowsにインストールされていない方WSLを入れたいと思っているが、コマンドを打つのに抵抗がある方目次WSLをWindowsにインストールするubuntuLTSの入手およびユーザアカウントとパスワードの作成WSLをWindowsにインストールするまず初めに、Linux用Windowsサブシステムを有効化します。 2022-01-02 17:04:09
AWS AWSタグが付けられた新着投稿 - Qiita ECS タスクから秘匿情報を参照するベストプラクティス https://qiita.com/BumpeiShimada/items/5ed3822233479daff57e containerdefinitionsを見れば、どの秘匿情報が環境変数として参照出来るようになっているのかを一覧出来るようにしたい参照先のSecretの値全てを参照する必要がない場合、セキュリティの観点から不要な情報を取り込まないようにしたい実行する上記まで行った上でコンテナを実行すると、指定された秘匿情報が環境変数として挿入されるようになります。 2022-01-02 17:45:06
Azure Azureタグが付けられた新着投稿 - Qiita Speech SDKからAzure Cognitive ServicesのSpeech Serviceを使って自分の英語の発音を評価する https://qiita.com/ojaru/items/9a018a5db31da4c16885 ローカルからSpeechSDKを利用して音声を保存したwavファイルをSpeechServiceにアップロードここからは先程作成したSpeechServiceに音声ファイルをPythonでSpeechSDKを操作することでアップロードし、撥音の評価を行います。 2022-01-02 17:18:50
海外TECH DEV Community How I Mentor Junior Software Engineers https://dev.to/zhiyueyi/how-i-mentor-junior-software-engineers-26l3 How I Mentor Junior Software EngineersIn I happened to have chances to mentor some software engineer interns at my work I mentored interns in total and maximum interns at the same time This is a great experience to me and to be honest I also learnt a lot while giving mentorship So today I d like to share some of my ideas about mentoring junior software engineers Keep Your Mentee Group Size SmallI would admit that at start I was quite happy that I could mentor interns at the same time It was my first official experience practicing mentorship at work so I was very happy that my capability was recognised by my superior However I found that I was too naive More mentees means greater responsibilities and I would need to spare more time from my work to provide mentorship Why do I have to spend much time to mentee Why not just assign the tasks and wait for results I suppose Mentees usually are not familiar with team culture and norms when they just joined They need guidance so that they can understand what to do and what not to do In the beginning they may not have any question because they would not know what to ask Only when they actually start to work will they find out that problems are everywhere And because I am the mentor I will be the first person they think of and ask for help To let mentees be better adapt to work I need to spend time for explanation and guidance I had maximum interns with me at the same time and they were doing different areas of work front end development and data warehouse development While providing guidance to them I had my own work to do as well So it ended up that I had to work overtime Thus keeping your mentee size small helps you mentor your mentees better and put yourself in a more relax mode Prepare An On boarding GuideTo minimise your time you can prepare an on boarding guide to explain fundamental questions Probably you need to spend several hours to prepare it but it s really useful because it can be reused every time I did an on boarding guide and here s what I included in the guide How to setup the development machine including software needs to install and environment variables to setup If possible it s better to also provide a way to verify if the software is correctly installed There are often strange problems happening It s better to provide a way of verification so that the mentees can at least check own their own first How to setup the project including dependency installation how to run the project and also environment variables to setup This is definitely a must do otherwise no one can work productively Who to ask if general problems are encountered New comers are not familiar with the team structure When some problems happen the mentor is the first person they think of However sometimes the mentor might not know much about some specific topics and they still need to direct the problem to someone who is more familiar So why not just specify the people map in the guide In the guide you can specify system module owners who is the most familiar with that module so that your mentee can be self driven and directly approached the person who is the most knowledgeable to that problem List of video recordings of past technical sharing tutorials or training Sometimes we have internal trainings and sharing held which can be recorded Those trainings and sharing are often about our own projects or products Having these links provide better opportunities to mentees to learn about the project by themselves and to mentors to save more time FAQs for quick references on strange problems No matter how well you prepared there are always strange issues happening For example a weird error message on python project initialization can be caused by a newly created remote development machine having setup issue during the creation These are unusual problems which happen rarely and cannot be found in the knowledge base So it s better to record this problem under FAQ session just in case it happens again and investigation time gets wasted Have Regular on SessionsMentors can be very busy on their own stuffs ans sometimes may omit the mentees The best solution to this issue is to schedule repeated meetings with the mentee on a regular basis It can be weekly or fortnightly I do it fortnightly A on session can be short such as minutes so that it does not create pressures to both sides Most importantly on sessions are not meant for performance evaluation The latter is too formal and makes people nervous While the former is more relaxing it can be just like chit chatting The purpose of on session is NOT to judge or evaluate but to communicate and advise There are a few topics I often use during the on session How is it going recently A general question to warm up Do you encounter any problem at work Did you solve it if so how did you solve it If not how can I help so that you can solve it Does the work align with your expectation If not what is missing for you It s important to let the mentee to speak out so these questions are all encouraging the mentee to share their thoughts Probably a mentor is more knowledgeable in certain fields and more experienced but in this communication everybody is equal on the same page In this way the communication can be helpful and positive true thoughts can be shared and then real problems can be revealed and fixed In the end mentors can also share about their views including praising for what mentee have done well suggesting areas which mentees can improve on When speaking about improvement parts it s better to directly point out areas needs improvements with the focus on the fact only and possibly provide a direction so that the mentee can know how to get improvement started In a word on session is meant to align the expectations between mentors and mentees find out the problems and solve it on equal positions with respects Assign Tasks by Considering DifficultiesWhile assigning tasks to mentees mentors need to understand the tasks too Some tasks may be easy or small and some tasks can be hard or big It s important to assign suitable tasks to mentees considering their experiences capabilities and time What I did is that In the beginning you can assign simple tasks such as logic corrections simple unit tests typo corrections which are easy to complete so that the mentees can be familiar with the work flow and the code base first Gradually when mentees gets more familiar you can assign them some small features such as developing a small form writing a consolidation API or non urgent bug fixes For bug fixes though mentors are more experiences who can spot out the cause and find solutions right away mentors should not directly tell the answer to the mentees Instead mentors should encourage the mentees to read through the code base and understand the contexts on their own and finally let the mentees to solve the problems own their own In this process advices and hints can be provided at appropriate time since there are definitely some contexts which are very hard for mentees to figure out on their own such as lousy logic designs in legacy systems which nobody knows exactly how it works x When mentees are ready you can assign a non urgent mid size feature like a small project to them so that they can start to work independently You can provide them a rough idea and let them try to design the feature on their own You can then review the design and help to improve After that mentees can start to independently work by themselves At this step the mentee is already at the stage where they are capable to work independently And I think it will be a good time for mentees to graduate D SummaryThese are what I learnt from the past one year experience of mentorship To be honest as a mentor I am still quite newbie Please leave your comments below to share your thoughts about mentorship so that I could also learn from you Cheers Featured image is credited to Pixabay pixabay from pexels 2022-01-02 08:45:35
海外TECH DEV Community Vocabulary Building Day 24 https://dev.to/vindhyasadanand/vocabulary-building-day-24-51ba Vocabulary Building Day antic adjective ludicrously odd Checkout Pronunciationgrandiloquent adjective puffed up with vanity Checkout Pronunciationtenacious adjective tending to keep a firm hold of something clinging or adhering closely Checkout Pronunciationperuse verb read something typically in a thorough or careful way Checkout Pronunciationleery adjective openly to disrespectful and unwillingly to confideCheckout PronunciationI hope this helps you if you are preparing for GRE exams 2022-01-02 08:43:54
海外TECH DEV Community Introduction to Infrastructure as Code with Terraform and Packer https://dev.to/donaldsebleung/introduction-to-infrastructure-as-code-with-terraform-and-packer-10cl Introduction to Infrastructure as Code with Terraform and PackerAssets for this article can be found on GitHub In this post we will learn what is Infrastructure as Code followed by a hands on session configuring AWS EC instances with Terraform and Packer PrerequisitesIt is assumed that you Are comfortable with the Linux command line and troubleshootingHave an AWS accountFamiliar with basic AWS services such as Amazon ECFamiliar with the basics of AWS CLIHave AWS CLI configured with an IAM account with sufficient permissions to create and manage the resources involved in this tutorialAre fully aware that following this tutorial may incur monetary costs and you are solely responsible for any such costsAn understanding of core cloud computing concepts IaaS PaaS SaaS etc and the underlying technology hypervisors hardware virtualization OS virtualization etc would be helpful You may follow this tutorial with another cloud provider of your choice in which case the key concepts presented in this article still apply but note that non trivial modifications to the instructions outlined in this article may be required With the prerequisites addressed let s get started Infrastructure as Code IaC Reference Introduction to Infrastructure as Code with TerraformInfrastructure as Code often abbreviated IaC refers to a declarative approach of managing infrastructure such as physical or virtual machines containers cloud instances etc by describing the desired components and state in configuration files which are then passed to an automation tool or suite of tools to be applied to the target infrastructure Declarative means that the configuration files describe what we want the infrastructure to look like rather than how to achieve it When we then apply these configuration files to our infrastructure using automated tool s it is the tool s responsibility to figure out how to achieve the desired state such that the DevOps practitioner s do not have to worry about such details Another benefit of describing the desired state of infrastructure in configuration files is the ability to apply techniques on them such as version control typically used for software i e code which was not previously possible hence the name IaC TerraformReference Introduction to Infrastructure as Code with TerraformTerraform is an open source IaC solution by HashiCorp licensed under the Mozilla Public License MPL which works with multiple cloud platforms as well as popular tools such as Docker and Kubernetes So let s get started Installing TerraformReference Install TerraformIn this and subsequent sections we ll assume you are working in a Linux environment If not you may have to adapt the instructions accordingly The latest Terraform release at the time of writing is v Download the compressed archive containing the Terraform binary for the latest version unzip and delete the archive wget unzip terraform linux amd zip rm terraform linux amd zipIf on ARM replace amd above with arm instead Now move the binary somewhere in your PATH e g usr local bin sudo mv terraform usr local binConfirm it is properly installed by querying the version terraform versionTerraform v on linux amdIf you see output similar to the above you re good to go Print usage instructions terraform helpUsage terraform global options lt subcommand gt args The available commands for execution are listed below The primary workflow commands are given first followed byless common or more advanced commands Creating an EC instance and associated resources with Terraform and connecting to itReference AWS ProviderRemember in our last tutorial where we manually created an EC instance plus associated resources by executing AWS CLI commands and connected to it We re going to do the same thing here except this time we ll do it declaratively with Terraform Here I have my AWS CLI configured to use an IAM administrator and my default region is us east If your configuration is different from mine e g you use a different default region you might not be able to use the exact same AMI as I do so adapt the instructions accordingly Remember that you can discover AMIs in your region by running the aws ec describe images command with appropriate filters First create a dedicated directory ec basic and cd into it mkdir ec basic cd ec basicTerraform configuration files use their own format known as HashiCorp Configuration Language HCL and the file extension is tf Create a Terraform configuration file main tf with the following contents terraform required providers aws source hashicorp aws version gt provider aws region us east How does Terraform know how to work with multiple cloud providers and open source platforms It does so through providers which could be provided by HashiCorp themselves official Verified HashiCorp partners such as Amazon verified The larger Terraform community community Some older providers could also be archived due to various reasons In the file above we specify in the terraform block that we need to install the aws provider from hashicorp aws with an appropriate version The next block provider aws contains configuration for our AWS provider Here we specify the region to use us east Now initialize our project with terraform init terraform initIf successful one of the lines should read Terraform has been successfully initialized Now save the following in a new file default vpc tf resource aws default vpc default This just specifies that Terraform should adopt the default VPC resource for management where the name of the default VPC is default Normally Terraform creates the specified resources if they do not already exist but as mentioned in the documentation for default VPCs this particular resource type aws default vpc is special in that all AWS accounts after already have a default VPC so Terraform just detects the existing default VPC and manages it instead of trying to create a new one which wouldn t make sense anyway To actually have Terraform manage it we need to apply the configuration terraform applyterraform apply applies all configuration files in the current directory whose filenames end in tf Hence we created a dedicated directory to store our tf files The above command prints out a summary of what resources it will create modify and or delete to reach the desired configuration and asks for confirmation before applying the changes Type yes all lowercase and press Enter to confirm In the end you should see output similar to the following Apply complete Resources added changed destroyed Now save the following in a file security group tf resource aws security group ec basic name ec basic description Security group for basic EC instance vpc id aws default vpc default id ingress description SSH from anywhere from port to port protocol tcp cidr blocks egress from port to port protocol cidr blocks ipv cidr blocks This instructs Terraform once applied to create an aws security group with name ec basic if it does not exist already Within the resource aws security group ec basic block we have ingress and egress sub blocks for specifying the rules for inbound and outbound network traffic respectively Here we allow inbound TCP connections on port the default port for SSH from anywhere and allow all outbound traffic Also note this particular line vpc id aws default vpc default idaws default vpc default references the default VPC resource we created earlier It exports the id attribute so aws default vpc default id refers to the ID of the default VPC resource We use this ID to associate our security group to the default VPC This has the benefit that we don t have to hardcode the VPC ID so the configuration is portable across different AWS accounts whose default VPCs likely have different IDs Before we apply let s try another command plan which computes what changes are needed to reach the desired configuration without actually applying them basically a dry run terraform plan Terraform will perform the following actions aws security group ec basic will be created Here it says that the aws security group ec basic resource will be created Now that we ve confirmed everything looks right let s apply the changes Remember to anwer yes and enter terraform applyNext save the following in a file key pair tf defining the public key for our key pair Remember to replace the public key material with your public key resource aws key pair macbook air ubuntu key name macbook air ubuntu public key ssh rsa AAAABNzaCycEAAAADAQABAAABgQCzSIuKPqNJTCOuaqFvSdk A vmkwJ efhjkuBEau NTdKgsZwwVsnEkMZkgQTqaHsqhGxJochwuzVglHsSAsYDFtuhTdtwUq EZFjrHrrbhaFdROBizOIMCsWHmuNKhUaOEQZoGboJqbhwjWErUFZnMhtNFZDxUYYBVfnfeJvJGWDor MypScoD ZVjt HpgMxJSlLkHFSuopHHnSHUzsT VamxVCOvuNmxxmkOvYpHfKGKTQMyb KIOWmrXGzGHjSTiQVjnVYzfgxnlUg StiNdUSnSnAvFht UjWxMqbugjT QHHQVmwGbjdxwvEqifOGeXK KhnFLcWpbinHcevOOUBb mY qRvJHnaRnHSKTjjAuEdRgGUcYmDVUhyZD Jf vFzHIBMAGSxx QeGhSDSrrrEgBh donaldsebleung donaldsebleung MacBookAir This defines a public key to be imported to AWS so we can connect to our instance later Check everything is fine and apply terraform plan terraform applyNow we are ready to define our instance with the given security group and key pair We ll use the AMI with ID ami adceb which is an Ubuntu LTS AMI Save the following in a file instance tf resource aws instance ec basic ami ami adceb instance type t micro vpc security group ids aws security group ec basic id key name aws key pair macbook air ubuntu key name Notice again that we get the security group ID and key name from resources we have defined earlier so as to not hardcode it enabling the configuration to be re used across different AWS accounts Make sure everything is okay and apply terraform plan terraform applyThe last few lines of output should look like this aws instance ec basic Creating aws instance ec basic Still creating s elapsed aws instance ec basic Still creating s elapsed aws instance ec basic Still creating s elapsed aws instance ec basic Still creating s elapsed aws instance ec basic Still creating s elapsed aws instance ec basic Creation complete after s id i ddfb Apply complete Resources added changed destroyed Good our instance is created But what is its public IP address We ll need that to connect to our instance but the output of terraform apply doesn t tell us what it is Of course we can get information on our instance with the AWS CLI but can we do it with Terraform alone The answer is a resounding yes enter output s Save the following in a file output tf output ec basic public ip description Public IP of our created instance value aws instance ec basic public ip This defines an output value ec basic public ip that is printed to the console whenever we run terraform apply The description field is just for documentation purposes the important field is value which instructs the public IP of our EC instance to be reported Apply our configuration Note that nothing should actually change since Terraform already created all desired resources on last apply but we should see the public IP of our instance printed to the console terraform apply Apply complete Resources added changed destroyed Outputs ec basic public ip In my case the public IP of my instance is according to Terraform Yours is likely different Now SSH to your instance replacing with the public IP of your instance ssh ubuntu Congratulations You ve provisioned an EC instance plus associated resources declaratively with Terraform and connected to it successfully To clean up simply run terraform destroy and enter yes when prompted which is the inverse of apply and deletes all resources defined in the current directory terraform destroy Not quite The default VPC cannot be deleted so it is not deleted Instead Terraform stops managing it on your behalf Contrast this approach to AWS CLI where you have to remember what resources you created and delete them one by one When the number of resources is large it can be easy to forget to delete something which could incur additional unexpected costs in the long run Now you should understand why a declarative approach is favorable for managing infrastructure It is these powerful automated tools that enables the practice of DevOps where everything happens at a rapid pace Automatically customize EC instance with Terraform by running a script on first bootReference Run commands on your Linux instance at launchWhile being able to provision a fresh EC instance declaratively with Terraform is useful in its own right oftentimes we might want to perform additional setup on the EC instance once it is created and it might be cumbersome to do it manually especially if the setup is complex e g we might want to set up a full fledged LAMP stack on the EC instance in a uniform manner Fortunately we can combine Terraform with Amazon EC user data to achieve automated setup of our newly created EC instance Assuming you re still in the ec basic directory first move up to the parent directory cd Then make a copy of this directory as ec website We ll see how to specify user data in Terraform to instruct it to automatically execute a bash script on the newly created EC instance on first boot which will install an HTTPS web server cp r ec basic ec websiteEnter the ec website directory cd ec websiteNow modify two files security group tf we ll add an inbound rule to allow HTTPS traffic from anywhereinstance tf we ll add a bash script to be executed on first boot as user datasecurity group tf resource aws security group ec basic name ec basic description Security group for basic EC instance vpc id aws default vpc default id ingress description SSH from anywhere from port to port protocol tcp cidr blocks ingress description HTTPS from anywhere from port to port protocol tcp cidr blocks egress from port to port protocol cidr blocks ipv cidr blocks instance tf resource aws instance ec basic ami ami adceb instance type t micro vpc security group ids aws security group ec basic id key name aws key pair macbook air ubuntu key name user data lt lt EOT bin bashapt get updateapt get install y software properties commonyes add apt repository ppa donaldsebleung miscapt get updateapt get install y donaldsebleung comyes openssl req x newkey rsa keyout key pem out cert pem sha days nodesmv key pem etc donaldsebleung commv cert pem etc donaldsebleung comsystemctl enable now donaldsebleung com serviceEOT Initialize the project just to be safe then apply the config entering yes when prompted terraform init terraform applyAfter the apply step completes wait for a few extra minutes then visit https lt EC INSTANCE PUBLIC IP gt where lt EC INSTANCE PUBLIC IP gt is the public IP of the instance reported by Terraform ignoring warnings from your browser about a self signed certificate You should see the following page Feel free to poke around to learn more about me shameless promotion here P When you re done tear down the infrastructure terraform destroy PackerReference Packer by HashiCorpWe saw how Terraform could be used to provision an EC instance and customize it on first boot by executing a bash script from user data which is amazing and saves a lot of manual work from the administrator But consider a scenario where the initial setup used to customize the EC instance takes a long time to run to completion Now suppose this EC instance encounters a kernel panic on a particular day and no amount of reboots will solve it The instance would have to be destroyed and re created which would take a long time before the new instance arrives at a functional state i e whatever services that instance offers would be down for a long time causing prolonged negative impact to business Instead of wasting time automatically customizing each EC instance after it has been created what if we could customize the EC instance up front save that new state and launch all subsequent instances from that new state Then whenever our instance s are down for whatever reason we can re launch a new instance with everything already set up and running Enter Packer Packer is another offering by HashiCorp that deals with the automated provisioning of customized images also released under the MPL With Packer we can use a base image and bake our customized setup into it to form a new image which can then be used to provision EC instances with Terraform such that we only have to run the setup once instead of on every instance launch Installing PackerReference Download Packer wget unzip packer linux amd zip rm packer linux amd zip sudo mv packer usr local binCheck the version packer versionPrint a help message packer help Baking a customized AMI with Packer and using it to launch a customized EC instance with TerraformReference Getting Started with AWSLike Terraform Packer also uses HCL as its configuration language Assuming you re still in the ec website directory first move up to the parent directory cd Now create a directory ec custom packer and cd into it mkdir ec custom packer cd ec custom packerSave the following into a file ec custom packer pkr hcl packer required plugins amazon version gt source github com hashicorp amazon variable ami prefix type string default donaldsebleung com locals timestamp regex replace timestamp TZ source amazon ebs donaldsebleung com ami name var ami prefix local timestamp instance type t micro region us east source ami ami adbfe ssh username ubuntu build sources source amazon ebs donaldsebleung com provisioner shell inline sudo apt get update sudo apt get install y software properties common yes sudo add apt repository ppa donaldsebleung misc sudo apt get update sudo apt get install y donaldsebleung com yes openssl req x newkey rsa keyout key pem out cert pem sha days nodes sudo mv key pem etc donaldsebleung com sudo mv cert pem etc donaldsebleung com sudo systemctl enable now donaldsebleung com service A brief explanation of the blocks involved The packer block specifies the plugin to be installed for creating AWS AMIs similar to how Terraform requires providers for provisioning AWS infrastructure Here we use the amazon plugin from github com hashicorp amazon i e an official plugin provided by HashiCorpWe define an ami prefix variable and generate a timestamp to construct a unique name for our new AMI since each of our AWS AMIs must have unique names You can learn more about timestamp generation through the docsThe source block specifies the base AMI and instance type used to build our new customized AMI as well as what user to log in as through SSH to run the build script Note that we don t have to provide our SSH public key since Packer auto generates and deletes afterwards an SSH key pair for this purposeThe build block defines the actual build The source block above doesn t actually do anything on its own but is used for the build when referenced Here we also define a shell provisioner which specifies the shell commands to run one by oneNow initialize the current directory which installs the required plugin s packer init Before we perform the build let s also validate our Packer config packer validate The configuration is valid Now let s build our image This make take around minutes or so packer build If successful you should see the following output near the end gt Wait completed after minutes seconds gt Builds finished The artifacts of successful builds are gt amazon ebs donaldsebleung com AMIs were created us east ami cfeeceddNote down the AMI ID in my case ami cfeecedd Also note that unlike Terraform Packer doesn t manage the AMI once it s built so you have to manually delete the AMI yourself once you re done with it Move back up to the parent directory cd Make a copy of ec website as ec custom terraform and cd into it cp r ec website ec custom terraform cd ec custom terraformNow modify instance tf by replacing the AMI ID with that of your custom image built with Packer and remove the user data Initialize and apply terraform init terraform applyOnce the last step completes visit https lt EC PUBLIC IP gt immediately The site should already be up and running Tear down the infrastructure terraform destroyFinally unless you intend to keep the custom AMI around de register it with AWS CLI replacing the image ID as approrpiate aws ec deregister image image id ami cfeecedd ConclusionWe learnt What IaC is its declarative approach to managing infrastructure and its advantages over traditional techniquesWhat Terraform is and how to use it to automatically set up and tear down AWS infrastructureHow to customize EC instances with setup scripts through user data and apply them with TerraformWhat Packer is how it alleviates the issue of long setup time of customized EC instances through Terraform alone how to build a custom AMI with Packer for provisioning custom instances on the get go with TerraformThe interested reader is encouraged to consult further resources Terraform by HashiCorpPacker by HashiCorpIntroduction to DevOps Practices and ToolsI hope you enjoyed the article ReferencesDonaldKellett iac intro terraform packer Introduction to Infrastructure as Code with Terraform Install Terraform AWS Provider Resource aws default vpc Resource aws security group Resource aws key pair Resource aws instance Run commands on your Linux instance at launch Packer by HashiCorp Download Packer Getting Started with AWS timestamp Function Introduction to DevOps Practices and Tools 2022-01-02 08:42:41
海外TECH DEV Community 10 Resources for Web Developers https://dev.to/yigitsr/10-resources-for-web-developers-46g7 Resources for Web DevelopersHi all In this post I m gonna share some resources related with web development and UI design Hope you find them useful OmatsuriOpen source web app that includes frontend tools SmallDevToolsIn this website you can find useful developer tools KeyframesYou can create animations shadows and play with colors ColorHuntFind color palettes for your project UIDesignDailyUI designs for inspiration CarbonShare your code as beautiful editable images DesignResourcesThis is a collection of design resources You can find many design recources from Figma to Unsplash CSSLayoutYou can create css layouts and patterns from Accordion to Navigation UISnippetsTo copy the style just right click the animation PatternCSSA CSS library to turn empty background to beautiful patterns Follow me onGitHubTwitterTwitchInstagram 2022-01-02 08:39:17
金融 ニュース - 保険市場TIMES チューリッヒ、企業情報サイトのリニューアル実施 https://www.hokende.com/news/blog/entry/2022/01/02/180000 チューリッヒ、企業情報サイトのリニューアル実施企業イメージの刷新チューリッヒ保険会社は月日、同社の企業情報サイトをリニューアルしたと発表した。 2022-01-02 18:00:00
海外ニュース Japan Times latest articles For first time in two years, Japan has some room for economic optimism https://www.japantimes.co.jp/news/2022/01/02/business/economy-business/japan-2022-economic-outlook/ For first time in two years Japan has some room for economic optimismOmicron and inflation risks loom but economists expect to be a year of recovery as consumption rises and people tap into the savings they ve 2022-01-02 17:27:34
海外ニュース Japan Times latest articles Komeito chief calls for Japan to create Asian security framework https://www.japantimes.co.jp/news/2022/01/02/national/politics-diplomacy/natsuo-yamaguchi-asian-security/ Komeito chief calls for Japan to create Asian security frameworkNatsuo Yamaguchi proposed that Japan take the lead in establishing an Asian architecture that would include China and the U S in a bid to stem 2022-01-02 17:08:49
海外ニュース Japan Times latest articles Ryoyu Kobayashi leaps to second straight Four Hills victory https://www.japantimes.co.jp/sports/2022/01/02/more-sports/winter-sports-more-sports/kobayashi-four-hill/ standings 2022-01-02 17:41:58
海外ニュース Japan Times latest articles Can Europe stay neutral and avert a U.S.-China war? https://www.japantimes.co.jp/opinion/2022/01/02/commentary/world-commentary/europe-averting-u-s-china-war/ Can Europe stay neutral and avert a U S China war While the EU wants to deepen trans Atlantic cooperation there is no consensus on how to do so without alienating China or undermining the very international 2022-01-02 17:03:06
ニュース BBC News - Home Covid: Pupils to wear masks in class in England to tackle Omicron https://www.bbc.co.uk/news/education-59840634?at_medium=RSS&at_campaign=KARANGA schools 2022-01-02 08:49:58
ニュース BBC News - Home Gas prices: MPs and peers urge PM to act on energy bills https://www.bbc.co.uk/news/uk-59849731?at_medium=RSS&at_campaign=KARANGA green 2022-01-02 08:35:42
ニュース BBC News - Home Cape Town: Major blaze rips through South Africa parliament building https://www.bbc.co.uk/news/world-africa-59850904?at_medium=RSS&at_campaign=KARANGA column 2022-01-02 08:12:12
ニュース BBC News - Home South Korean crosses DMZ in rare defection to North Korea https://www.bbc.co.uk/news/world-asia-59851097?at_medium=RSS&at_campaign=KARANGA policy 2022-01-02 08:03:19
ニュース BBC News - Home Evans wins opening singles in GB's ATP Cup tie against Germany https://www.bbc.co.uk/sport/tennis/59851249?at_medium=RSS&at_campaign=KARANGA Evans wins opening singles in GB x s ATP Cup tie against GermanyDan Evans gets Great Britain s ATP Cup campaign off to a winning start with a straight set victory in the opening singles tie against Germany 2022-01-02 08:16:57
北海道 北海道新聞 道内で新たに16人感染、札幌は12人 新型コロナ https://www.hokkaido-np.co.jp/article/629534/ 新型コロナウイルス 2022-01-02 17:20:31
北海道 北海道新聞 ワクチン支える日本の技術 21年度内にも実用化 https://www.hokkaido-np.co.jp/article/629501/ 新型コロナウイルス 2022-01-02 17:20:19
北海道 北海道新聞 札幌市内百貨店で初売り 神社に初詣客 https://www.hokkaido-np.co.jp/article/629549/ 札幌市内 2022-01-02 17:11:18
北海道 北海道新聞 餅詰まらせ80代の女性2人死亡 7人搬送、東京消防庁 https://www.hokkaido-np.co.jp/article/629550/ 東京消防庁 2022-01-02 17:10:00
北海道 北海道新聞 ラグビー、明大と帝京大が決勝へ 全国大学選手権 https://www.hokkaido-np.co.jp/article/629548/ 選手権 2022-01-02 17:06:00

コメント

このブログの人気の投稿

投稿時間: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件)