<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Pulumi架構(gòu)即是代碼

          聯(lián)合創(chuàng)作 · 2023-09-27 13:20

          Pulumi 是一個(gè)架構(gòu)即是代碼的開源項(xiàng)目,可在任何云上創(chuàng)建和部署使用容器,無(wú)服務(wù)器功能,托管服務(wù)和基礎(chǔ)架構(gòu)的云軟件的最簡(jiǎn)單方法。

          只需用您喜歡的語(yǔ)言編寫代碼,Pulumi就可以使用基礎(chǔ)架構(gòu)即代碼方法自動(dòng)配置和管理您的AWS,Azure,Google Cloud Platform和/或Kubernetes資源。 跳過(guò)YAML,使用您已經(jīng)熟悉和喜愛的標(biāo)準(zhǔn)語(yǔ)言功能,如循環(huán),函數(shù),類和包管理。

          如下代碼可創(chuàng)建三個(gè) Web 服務(wù)器:

          let aws = require("@pulumi/aws");
          let sg = new aws.ec2.SecurityGroup("web-sg", {
              ingress: [{ protocol: "tcp", fromPort: 80, toPort: 80, cidrBlocks: ["0.0.0.0/0"]}],
          });
          for (let i = 0; i < 3; i++) {
              new aws.ec2.Instance(`web-${i}`, {
                  ami: "ami-7172b611",
                  instanceType: "t2.micro",
                  securityGroups: [ sg.name ],
                  userData: `#!/bin/bash
                      echo "Hello, World!" > index.html
                      nohup python -m SimpleHTTPServer 80 &`,
              });
          }

          或者一個(gè)簡(jiǎn)單的無(wú)服務(wù)器定時(shí)器,在每天早上八點(diǎn)半抓取 Hacker News 的信息:

          const aws = require("@pulumi/aws");
          
          const snapshots = new aws.dynamodb.Table("snapshots", {
              attributes: [{ name: "id", type: "S", }],
              hashKey: "id", billingMode: "PAY_PER_REQUEST",
          });
          
          aws.cloudwatch.onSchedule("daily-yc-snapshot", "cron(30 8 * * ? *)", () => {
              require("https").get("https://news.ycombinator.com", res => {
                  let content = "";
                  res.setEncoding("utf8");
                  res.on("data", chunk => content += chunk);
                  res.on("end", () => new aws.sdk.DynamoDB.DocumentClient().put({
                      TableName: snapshots.name.get(),
                      Item: { date: Date.now(), content },
                  }).promise());
              }).end();
          });

          更多的例子請(qǐng)看 pulumi/examples.

          該項(xiàng)目包含 Pulumi 的命令行工具、語(yǔ)言 SDK 和核心引擎。

          瀏覽 19
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  日本道久久 | 青娱乐换妻偷拍 | 国产欧美鸡巴 | 爱爱无码免费视频 | 国产精品97 |