投稿時間:2022-12-03 16:04:59 RSSフィード2022-12-03 16:00 分まとめ(5件)
カテゴリー等 | サイト名等 | 記事タイトル・トレンドワード等 | リンクURL | 頻出ワード・要約等/検索ボリューム | 登録日 |
---|---|---|---|---|---|
Docker | dockerタグが付けられた新着投稿 - Qiita | Elixir + Phoenix Frameworkアプリケーション作成 [docker] | https://qiita.com/maple__96/items/7c73c5bffced0c92b656 | docker | 2022-12-03 15:03:03 |
技術ブログ | Developers.IO | Vertex AIのカスタムコンテナでバッチ推論をする | https://dev.classmethod.jp/articles/vertex-ai-custom-container-batch-prediction/ | vertex | 2022-12-03 06:39:52 |
技術ブログ | Developers.IO | YAML記述のCloudFormation内でのJSON箇所の組み込み関数記入方法 | https://dev.classmethod.jp/articles/cloudformation-buildin-function-json/ | cloudformation | 2022-12-03 06:25:21 |
海外TECH | DEV Community | Overview of Pulumi and Its Challenge Tutorial 101: The Essential Guide | https://dev.to/makendrang/overview-of-pulumi-and-its-challenge-tutorial-101-the-essential-guide-44jk | Overview of Pulumi and Its Challenge Tutorial The Essential Guide What is Pulumi Pulumi is a universal infrastructure as code platform that allows us to create deploy and manage cloud infrastructure using well known programming languages and tools Pulumi is free open source and optionally integrated with Pulumi Service to make infrastructure management secure reliable and seamless Choose one of the following options to deploy a simple cloud application using Pulumi What is Pulumi service Pulumi is a fully managed service that makes it easy to host the open source Pulumi SDK It provides built in health and security management integrates with source control and CI CD and offers a web console and API that simplify infrastructure visualization and management It s free for personal use along with features that can be used by teams How we can use Pulumi in AWS The Pulumi Infrastructure as Code SDK lets us create deploy and manage AWS containers serverless functions and infrastructure using programming languages like TypeScript Python Go C and Java and markup languages like YAML With the Pulumi AWS Provider Bundle and CLI we can accomplish all of this in minutes Benefits of PulumiManaging the complexity of the modern cloudBringing the cloud closer to application developmentUse cases of technology with infrastructureMake collaboration easier and innovate faster Pulumi ChallengeThousands of developers believe Pulumi is the perfect IaC tool to accelerate developers and manage complexity at modern cloud scale Pulumi Challenges are a great way to experience the Pulumi platform This challenge is Startup in a Box where we will build and deploy our very own website to run on Amazon S using Cloudfront and Checkly all of this in Pulumi The code is in TypeScript PrerequisitesTo do this we need to establish a few things in advance A Pulumi accountThe Pulumi CLIAWS accountCheckly accountInstall Language Runtime Nodejs AWS CLIConfigure Pulumi to access your AWS account Step First Pulumi ProgramWe will be creating a new Pulumi program using an AWS specific Pulumi template using TypeScript Create a new folder called Pulumi challenge and run the following in it mkdir Pulumi challengepulumi new aws typescriptThis command will walk you through creating a new Pulumi project Enter a value or leave blank to accept the default and press lt ENTER gt Press C at any time to quit project name pulumi challenge project description A minimal AWS TypeScript Pulumi program Created project pulumi challenge Please enter your desired stack name To create a stack in an organization use the format lt org name gt lt stack name gt e g acmecorp dev stack name dev productionCreated stack production aws region The AWS region to deploy into us east Saved configInstalling dependencies added packages and audited packages in m packages are looking for funding run npm fund for detailsfound vulnerabilitiesnpm noticenpm notice New minor version of npm available gt npm notice Changelog lt npm notice Run npm install g npm to update npm noticeFinished installing dependenciesYour new project is ready to go To perform an initial deployment run pulumi up The pulumi new command creates a new Pulumi project with native support based on the specified cloud and language After logging in the CLI will guide us to create a new project First we will be asked for a project name and description Press ENTER to accept the default value or enter a new value We will then be prompted for the stack name Accept Dev s default settings by pressing ENTER or enter a new value as Production Finally some configuration values for the stack are requested For AWS projects we will be prompted to enter the AWS region We can accept the default value or choose another value such as us east After npm installs some dependencies your project and stack will be ready Let s take a look at some of the generated project files Pulumi yaml defines the project Pulumi production yaml contains the settings for the newly initialized stack index ts is a Pulumi program that identifies stack resources Lets examine index ts import as pulumi from pulumi pulumi import as aws from pulumi aws import as awsx from pulumi awsx Create an AWS resource S Bucket const bucket new aws s Bucket my bucket Export the name of the bucketexport const bucketName bucket id This Pulumi program creates a new S bucket and exports the name of the bucket Step Create your first resourceNow that our basic AWS project is set up we need to create our first resource In this case we create a new S bucket where we can store our static website Also make sure this bucket is private as we only want to expose it to the CDN we ll configure later Delete the below existing code in pulumi challenge index ts Create an AWS resource S Bucket const bucket new aws s Bucket my bucket Export the name of the bucketexport const bucketName bucket id Copy the below code and paste it into the pulumi challenge index ts const bucket new aws s BucketV bucketV tags Name My bucket const bucketAcl new aws s BucketAclV bAcl bucket bucket id acl aws s PublicReadAcl Replace My bucket with a unique name For example pulumi challenge makendran one Step Working with Local FilesPulumi allows us to define our infrastructure using our preferred programming language Today we use TypeScript This means we can access the Node API This includes finding folders and files We can use these APIs to sync local files to an S bucket along with the original Pulumi template We need to add the npm mime package because it is convenient to pass the mime type of the file to S without encoding it Run the below command to install mime package npm install mime types mimeCopy the below code and paste it in the pulumi challenge index ts import as fs from fs import as mime from mime const staticWebsiteDirectory website fs readdirSync staticWebsiteDirectory forEach file gt const filePath staticWebsiteDirectory file const fileContent fs readFileSync filePath toString new aws s BucketObject file bucket bucket id source new pulumi asset FileAsset filePath contentType mime getType filePath undefined acl aws s PublicReadAcl But we need a real website Create a directory called website in pulumi challenge website and add index html styles css and normalize css to it For index html you have a simple website layout where you can post links to your project s GitHub Twitter and LinkedIn Copy index html from GitHub and paste in the pulumi challenge website index html Make it beautiful with bright colors and CSS backgrounds in the style css file Copy style css from GitHub and paste in the pulumi challenge website style css You also need to normalize some styles so that they display consistently across browsers Copy normalize css from GitHub and paste in the pulumi challenge website normalize css Before deploying the stack Kindly run the command to preview the changes pulumi previewLets go ahead and deploy stack by running the below command pulumi up skip preview Step Create a CDNNext we want to provision an S bucket with Cloudfront These are quite large objects but most of them can be copied and pasted without much thought Copy the below code and paste it in the pulumi challenge index ts const sOriginId mySOrigin const cloudfrontDistribution new aws cloudfront Distribution sDistribution origins domainName bucket bucketRegionalDomainName originId sOriginId enabled true isIpvEnabled true comment Some comment defaultRootObject index html defaultCacheBehavior allowedMethods DELETE GET HEAD OPTIONS PATCH POST PUT cachedMethods GET HEAD targetOriginId sOriginId forwardedValues queryString false cookies forward none viewerProtocolPolicy allow all minTtl defaultTtl maxTtl priceClass PriceClass restrictions geoRestriction restrictionType whitelist locations US CA GB DE viewerCertificate cloudfrontDefaultCertificate true Lets go ahead and deploy stack by running the below command pulumi up skip previewTo get the CloudFront URL Copy the below code and paste it in the pulumi challenge index ts export const url cloudfrontDistribution domainName Lets go ahead and deploy the stack by running the below command pulumi up skip previewTo see the output of the stack run the below commandpulumi stack outputCurrent stack outputs OUTPUT VALUE url dymmjyqks cloudfront netTo view the output in JSON format run the below commandpulumi stack output json url dymmjyqks cloudfront net To see the HTML of the URL run the below commandcurl Step Introduction to ComponentResourcesWe can keep adding resources but Pulumi is more than that We can create our own reusable components Let s turn the above into a CdnWebsite component in pulumi challenge cdn website index ts Create a directory under pulumi challenge as cdn website and a file called index ts Copy index ts from GitHub and paste in the pulumi challenge cdn website index ts Keep the below code alone in the pulumi challenge index ts and delete the remaining code import as pulumi from pulumi pulumi import as aws from pulumi aws import as awsx from pulumi awsx Copy the below code and paste it in the pulumi challenge index ts Deploy Website to S with CloudFront Also shows the challenger how to build a ComponentResourceimport CdnWebsite from cdn website const website new CdnWebsite your startup Replace your startup with a unique name For example pulumi challenge oneLets go ahead and deploy the stack by running the below command pulumi upIt will ask for us to proceed with the update or not Select yes to deploy the change To get the CloudFront URL Copy the below code and paste it in the pulumi challenge index ts export const url website url Lets go ahead and deploy the stack by running the below command pulumi up skip previewUpdating production View Live Type Name Status pulumi pulumi Stack pulumi challenge production Outputs url dfewalsoswej cloudfront net Resources unchangedDuration sTo see the HTML of the URL run the below commandcurl Step Add another providerNow that we ve served our website through S as fast as possible using CdnWebsite and Cloudfront how do you know if our deployment is actually working We can use a great service like Checkly to make sure your site goes through a series of health checks Checkly is the API amp EE monitoring platform for the modern stack programmable flexible and loving JavaScript Source ImageFirst we need to add a new provider npm install checkly pulumiTo get the API key from checklyLogin into checkly account and go to User Settings gt API keys Select Create API keyTo get the Account ID from checklyGo to Account Settings of checkly Run the below command to configure checkly provider API KEY pulumi config set checkly apiKey secret AccountID pulumi config set checkly accountIdCopy the below code and paste it in the pulumi challenge index tsimport as checkly from checkly pulumi import as fs from fs new checkly Check index page activated true frequency type BROWSER locations eu west script websiteUrl apply url gt fs readFileSync checkly embed js toString utf replace websiteUrl url Replace script websiteUrl apply url as script url apply url in the above code and also eu west as us east We can see that we are using fs readFileSync again This is because it stores Checkly code and node based code in its own file so we get auto completion and correct syntax highlighting without having to store them as string objects in our existing code Add the following to the pulumi challenge checkly embed js file const playwright require playwright const expect require expect const browser await playwright chromium launch const page await browser newPage await page goto https websiteUrl expect await page title toBe Pulumi Challenge await browser close Lets go ahead and deploy the stack by running the below command pulumi up Step Dynamic implementation of the Swag providerEveryone loves SWAG and Pulumi wants to give us something for completing this challenge To do this we need to align with dynamic providers through Pulumi Create a new directory and file in pulumi challenge swag provider index ts For this dynamic provider only CommonJS modules are available We can make HTTP requests using got version Run the below command to install got npm install got Copy index ts from GitHub and paste in the pulumi challenge swag provider index ts Now add this last block to pulumi challenge index ts and run pulumi up import Swag from swag provider const swag new Swag your startup name YOUR NAME email YOUR EMAIL address YOUR ADDRESS size SIZE Replace the your startup YOUR NAME YOUR EMAIL and SIZE as per your records Congratulations We have Completed Pullumi s first challenge To remove all these resources perform a pulumi destroy Otherwise use the new site Change it to make it your own To know more about the pulumi challenges refer hereGratitude for perusing my article till end I hope you realized something unique today If you enjoyed this article then please share to your buddies and if you have suggestions or thoughts to share with me then please write in the comment box Follow me and share your thoughts GitHubLinkedInTwitter | 2022-12-03 06:05:35 |
ニュース | BBC News - Home | The Papers: Strep A warnings and Matt Hancock's diaries | https://www.bbc.co.uk/news/blogs-the-papers-63842809?at_medium=RSS&at_campaign=KARANGA | diaries | 2022-12-03 06:31:22 |
コメント
コメントを投稿