url
stringlengths
11
2.25k
text
stringlengths
88
50k
ts
timestamp[s]date
2026-01-13 08:47:33
2026-01-13 09:30:40
https://docs.aws.amazon.com/zh_cn/lambda/latest/dg/configuration-versions.html#versioning-permissions
管理 Lambda 函数版本 - AWS Lambda 管理 Lambda 函数版本 - AWS Lambda 文档 AWS Lambda 开发人员指南 创建函数版本 使用版本 授予权限 管理 Lambda 函数版本 您可以使用版本来管理函数的部署。例如,您可以发布函数的新版本用于测试版测试,而不会影响稳定的生产版本的用户。您每次发布函数时,Lambda 都会为函数创建一个新版本。新版本是函数的未发布版本的副本。未发布版本的名为 $LATEST 。 重要的是,每当您部署函数代码时,都会覆盖 $LATEST 中的当前代码。要保存 $LATEST 的当前迭代,请创建一个新的函数版本。如果 $LATEST 与之前发布的版本相同,则在将更改部署到 $LATEST 之前,您无法创建新版本。这些更改可能会包括更新代码或修改函数配置设置。 发布函数版本后,其代码、运行时、架构、内存、层和大多数其他配置设置都不可变。这意味着,如果不从 $LATEST 发布新版本,则无法更改这些设置。您可以为已发布函数版本配置以下项目: 触发 目标 预配置并发 异步调用 数据库连接和代理 注意 在 自动 模式下使用 运行时管理控件 时,此函数版本使用的运行时版本会自动更新。使用 Function update (函数更新)或 Manual (手动)模式时,不会更新运行时版本。有关更多信息,请参阅 了解 Lambda 如何管理运行时版本更新 。 Sections 创建函数版本 使用版本 授予权限 创建函数版本 只能在函数的未发布版本上更改函数代码和设置。在您发布版本时,Lambda 会锁定代码和大多数设置,以便为该版本的用户维持一致的体验。 您可以使用 Lambda 控制台创建函数版本。 创建新函数版本 打开 Lamba 控制台的 函数页面 。 选择一个函数,然后选择 版本 选项卡。 在版本配置页面上,选择 Publish new version(发布新版本) 。 (可选)输入版本说明。 选择 发布 。 或者,您可以使用 PublishVersion API 操作发布函数版本。 以下 AWS CLI 命令发布函数的新版本。响应返回有关新版本的配置信息,包括版本号和具有版本后缀的函数 ARN。 aws lambda publish-version --function-name my-function 您应看到以下输出: { "FunctionName": "my-function", "FunctionArn": "arn:aws:lambda:us-east-2:123456789012:function:my-function:1", "Version": "1", "Role": "arn:aws:iam::123456789012:role/lambda-role", "Handler": "function.handler", "Runtime": "nodejs22.x", ... } 注意 Lambda 会分配单调递增的序列号,以便进行版本控制。Lambda 不会重复使用版本号,即使是删除并重新创建函数之后也是如此。 使用版本 您可以使用限定的 ARN 或非限定的 ARN 来引用您的 Lambda 函数。 限定的 ARN – 具有版本后缀的函数 ARN。以下示例引用 helloworld 函数的版本 42。 arn:aws:lambda:aws-region:acct-id:function:helloworld:42 非限定的 ARN – 不具有版本后缀的函数 ARN。 arn:aws:lambda:aws-region:acct-id:function:helloworld 您可以在所有相关 API 操作中使用限定或非非限定的 ARN。但是,不能使用非限定 ARN 来创建别名。 如果您决定不发布函数版本,可以使用 事件源映射 中的限定或非限定 ARN 来调用函数。当您使用非限定 ARN 调用函数时,Lambda 会隐式调用 $LATEST 。 每个 Lambda 函数版本的限定 ARN 都是唯一的。发布版本后,您无法更改 ARN 或函数代码。 Lambda 仅在代码从未发布过或自上次发布版本后已发生更改时,才会发布新函数版本。如果没有任何更改,函数版本将保持为上次发布的版本。 当您发布版本时,Lambda 会创建函数代码和配置的不可变快照。并非所有配置更改都会触发新版本的发布。以下配置更改使函数有资格发布版本: 函数代码 环境变量 运行时 处理程序 图层 内存大小 超时 VPC 配置 死信队列 (DLQ) 配置 IAM 角色 描述 架构(x86_64 或 arm64) 临时存储大小 包类型 日志记录配置 文件系统配置 SnapStart 跟踪配置 预留并发 等操作设置在更改时不会触发新版本的发布。 授予权限 您可以使用基于 资源的策略 或 基于身份的策略 授予对函数的访问权限。权限的范围取决于您要将策略应用于整个函数还是函数的某个版本。有关策略中的函数资源名称的更多信息,请参阅 微调策略的“资源和条件”部分 。 您可以使用函数别名,简化事件源和 AWS Identity and Access Management (IAM) 策略的管理。有关更多信息,请参阅 为 Lambda 函数创建别名 。 Javascript 在您的浏览器中被禁用或不可用。 要使用 Amazon Web Services 文档,必须启用 Javascript。请参阅浏览器的帮助页面以了解相关说明。 文档惯例 加权别名 标签 此页面对您有帮助吗?- 是 感谢您对我们工作的肯定! 如果不耽误您的时间,请告诉我们做得好的地方,让我们做得更好。 此页面对您有帮助吗?- 否 感谢您告诉我们本页内容还需要完善。很抱歉让您失望了。 如果不耽误您的时间,请告诉我们如何改进文档。
2026-01-13T09:30:35
https://www.blogger.com/post-edit.g?blogID=1448865833015557942&postID=1194221956200438149&from=pencil
:root{--gm3-sys-color-on-surface-rgb:31,31,31}@media screen and (prefers-color-scheme:dark){:root{--gm3-sys-color-on-surface-rgb:227,227,227}}:root{--wf-harmonize-filter-light:none;--wf-harmonize-filter-dark:none}.q4Wquf,.nfoC7c{display:block;height:25vh;position:relative}@media (min-width:600px){.q4Wquf,.nfoC7c{height:150px}}.q4Wquf.Irjbwb{height:auto}@media screen and (prefers-color-scheme:dark){.q4Wquf:not(.GtvzYd){display:none}}.nfoC7c{margin:0;overflow:hidden}.PwpMUe,.lVUmD{display:block;height:100%;margin:0 auto;width:100%}.St9mde{display:block;-webkit-filter:var(--wf-harmonize-filter-light);filter:var(--wf-harmonize-filter-light);height:100%;max-width:100%;min-height:110px;position:relative;-webkit-transform:translate(-43%,-3%);-ms-transform:translate(-43%,-3%);transform:translate(-43%,-3%);width:auto;z-index:3}@media screen and (prefers-color-scheme:dark){.St9mde{-webkit-filter:var(--wf-harmonize-filter-dark);filter:var(--wf-harmonize-filter-dark)}}.PwpMUe,.lVUmD,.St9mde{-o-object-fit:contain;object-fit:contain}.wsArZ[data-ss-mode="1"] .q4Wquf,.wsArZ[data-ss-mode="1"] .St9mde{height:auto;width:100%}.wsArZ[data-ss-mode="1"] .St9mde{max-width:400px}@media (min-width:600px) and (orientation:landscape),all and (min-width:1600px){.NQ5OL .q4Wquf,.NQ5OL .St9mde{height:auto;width:100%}.NQ5OL .St9mde{max-width:400px}}.q4Wquf.NWba7e,.q4Wquf.NWba7e .St9mde{height:auto}.q4Wquf.NWba7e .St9mde{height:auto;max-width:312px;width:100%}.q4Wquf.NWba7e.zpCp3 .St9mde{max-width:unset}.q4Wquf.IiQozc .St9mde{margin:0 auto;-webkit-transform:none;-ms-transform:none;transform:none}.q4Wquf.Irjbwb .St9mde{height:auto;width:100%}.q4Wquf.EEeaqf .St9mde{max-height:144px;max-width:144px}.SnAaEd{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(233,233,233,0)),color-stop(62.22%,rgba(233,233,233,0)),color-stop(40.22%,rgb(233,233,233)),to(rgba(233,233,233,0)));background-image:-webkit-linear-gradient(top,rgba(233,233,233,0) 0,rgba(233,233,233,0) 62.22%,rgb(233,233,233) 40.22%,rgba(233,233,233,0) 100%);background-image:linear-gradient(to bottom,rgba(233,233,233,0) 0,rgba(233,233,233,0) 62.22%,rgb(233,233,233) 40.22%,rgba(233,233,233,0) 100%);height:100%;left:0;overflow:hidden;position:absolute;right:0;top:0;z-index:2}@media screen and (prefers-color-scheme:dark){.SnAaEd{display:none}}.SnAaEd::after,.SnAaEd::before{content:"";display:block;height:100%;min-width:110px;position:absolute;right:-10%;-webkit-transform:rotate(-104deg);-ms-transform:rotate(-104deg);transform:rotate(-104deg);width:25vh;z-index:2}@media (min-width:600px){.SnAaEd::after,.SnAaEd::before{width:150px}}.SnAaEd::before{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(243,243,243,0)),to(rgba(243,243,243,.9)));background-image:-webkit-linear-gradient(top,rgba(243,243,243,0) 0,rgba(243,243,243,.9) 100%);background-image:linear-gradient(to bottom,rgba(243,243,243,0) 0,rgba(243,243,243,.9) 100%);bottom:-10%}.SnAaEd::after{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(255,255,255,0)),to(rgba(255,255,255,.9)));background-image:-webkit-linear-gradient(top,rgba(255,255,255,0) 0,rgba(255,255,255,.9) 100%);background-image:linear-gradient(to bottom,rgba(255,255,255,0) 0,rgba(255,255,255,.9) 100%);bottom:-80%}.wsArZ[data-ss-mode="1"] .SnAaEd~.St9mde{width:auto}@media (min-width:600px) and (orientation:landscape),all and (min-width:1600px){.NQ5OL .SnAaEd~.St9mde{width:auto}}.RHNWk .St9mde{height:auto}@media (min-width:600px) and (orientation:landscape),all and (min-width:1600px){.NQ5OL .RHNWk .St9mde{width:115px}}.cf660d .St9mde{-webkit-transform:translate(-9%,-3%);-ms-transform:translate(-9%,-3%);transform:translate(-9%,-3%)}.tUhwwc .St9mde{margin:auto;max-height:230px;right:0;top:-3%;-webkit-transform:none;-ms-transform:none;transform:none}.Jkvqxd .St9mde{-webkit-transform:translate(9%,-3%);-ms-transform:translate(9%,-3%);transform:translate(9%,-3%)}.onc8Ic .St9mde{-webkit-transform:translate(var( --c-ps-s,24px ),0);-ms-transform:translate(var( --c-ps-s,24px ),0);transform:translate(var( --c-ps-s,24px ),0)}.WA89Yb .St9mde{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.wsArZ[data-ss-mode="1"] .XEN8Yb .St9mde{max-width:115px}@media (min-width:600px) and (orientation:landscape),all and (min-width:1600px){.NQ5OL .XEN8Yb .St9mde{max-width:115px}}@media (min-width:1240px) and (orientation:landscape),all and (min-width:1600px){.KyPKed .NQ5OL .XEN8Yb .St9mde{max-width:115px}}.IsSr6b .St9mde{max-width:300px}.mmskdd .St9mde{-webkit-transform:none;-ms-transform:none;transform:none}@-webkit-keyframes quantumWizBoxInkSpread{0%{-webkit-transform:translate(-50%,-50%) scale(.2);transform:translate(-50%,-50%) scale(.2)}100%{-webkit-transform:translate(-50%,-50%) scale(2.2);transform:translate(-50%,-50%) scale(2.2)}}@keyframes quantumWizBoxInkSpread{0%{-webkit-transform:translate(-50%,-50%) scale(.2);transform:translate(-50%,-50%) scale(.2)}100%{-webkit-transform:translate(-50%,-50%) scale(2.2);transform:translate(-50%,-50%) scale(2.2)}}@-webkit-keyframes quantumWizIconFocusPulse{0%{-webkit-transform:translate(-50%,-50%) scale(1.5);transform:translate(-50%,-50%) scale(1.5);opacity:0}100%{-webkit-transform:translate(-50%,-50%) scale(2);transform:translate(-50%,-50%) scale(2);opacity:1}}@keyframes quantumWizIconFocusPulse{0%{-webkit-transform:translate(-50%,-50%) scale(1.5);transform:translate(-50%,-50%) scale(1.5);opacity:0}100%{-webkit-transform:translate(-50%,-50%) scale(2);transform:translate(-50%,-50%) scale(2);opacity:1}}@-webkit-keyframes quantumWizRadialInkSpread{0%{-webkit-transform:scale(1.5);transform:scale(1.5);opacity:0}100%{-webkit-transform:scale(2.5);transform:scale(2.5);opacity:1}}@keyframes quantumWizRadialInkSpread{0%{-webkit-transform:scale(1.5);transform:scale(1.5);opacity:0}100%{-webkit-transform:scale(2.5);transform:scale(2.5);opacity:1}}@-webkit-keyframes quantumWizRadialInkFocusPulse{0%{-webkit-transform:scale(2);transform:scale(2);opacity:0}100%{-webkit-transform:scale(2.5);transform:scale(2.5);opacity:1}}@keyframes quantumWizRadialInkFocusPulse{0%{-webkit-transform:scale(2);transform:scale(2);opacity:0}100%{-webkit-transform:scale(2.5);transform:scale(2.5);opacity:1}}:root{--wf-tfs:calc(var(--c-tfs,32)/16*1rem);--wf-tfs-bp2:calc(var(--c-tfs,36)/16*1rem);--wf-tfs-bp3:calc(var(--c-tfs,36)/16*1rem);--wf-tfs-bp5:calc(var(--c-tfs,44)/16*1rem);--wf-stfs:calc(var(--c-stfs,16)/16*1rem);--wf-stfs-bp5:calc(var(--c-stfs,16)/16*1rem)}:root{--wf-harmonize-filter-light:none;--wf-harmonize-filter-dark:none}.Dzz9Db,.GpMPBe{display:block;height:25vh;position:relative}@media (min-width:600px){.Dzz9Db,.GpMPBe{height:150px}}@media screen and (prefers-color-scheme:dark){.Dzz9Db:not(.GtvzYd){display:none}}.Dzz9Db.Irjbwb{height:auto}.GpMPBe{margin:0;overflow:hidden}.UFQPDd,.JNOvdd{display:block;height:100%;margin:0 auto;-o-object-fit:contain;object-fit:contain;width:100%}.f4ZpM{display:block;-webkit-filter:var(--wf-harmonize-filter-light);filter:var(--wf-harmonize-filter-light);height:100%;max-width:100%;min-height:110px;position:relative;-webkit-transform:translate(-43%,-3%);-ms-transform:translate(-43%,-3%);transform:translate(-43%,-3%);width:auto;z-index:3}@media screen and (prefers-color-scheme:dark){.f4ZpM{-webkit-filter:var(--wf-harmonize-filter-dark);filter:var(--wf-harmonize-filter-dark)}}.wsArZ[data-ss-mode="1"] .Dzz9Db,.wsArZ[data-ss-mode="1"] .f4ZpM{height:auto;width:100%}.wsArZ[data-ss-mode="1"] .f4ZpM{max-width:400px}@media (min-width:600px) and (orientation:landscape),all and (min-width:1600px){.NQ5OL .Dzz9Db,.NQ5OL .f4ZpM{height:auto;width:100%}.NQ5OL .f4ZpM{max-width:400px}}.Dzz9Db.utFBGf,.Dzz9Db.utFBGf .f4ZpM{height:auto}.Dzz9Db.utFBGf .f4ZpM{height:auto;max-width:312px;width:100%}.Dzz9Db.utFBGf.zpCp3 .f4ZpM{max-width:unset}.Dzz9Db.IiQozc .f4ZpM{margin:0 auto;-webkit-transform:none;-ms-transform:none;transform:none}.Dzz9Db.Irjbwb .f4ZpM{height:auto;width:100%}.Dzz9Db.EEeaqf .f4ZpM{max-height:144px;max-width:144px}.nPt1pc{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(233,233,233,0)),color-stop(62.22%,rgba(233,233,233,0)),color-stop(40.22%,rgb(233,233,233)),to(rgba(233,233,233,0)));background-image:-webkit-linear-gradient(top,rgba(233,233,233,0) 0,rgba(233,233,233,0) 62.22%,rgb(233,233,233) 40.22%,rgba(233,233,233,0) 100%);background-image:linear-gradient(to bottom,rgba(233,233,233,0) 0,rgba(233,233,233,0) 62.22%,rgb(233,233,233) 40.22%,rgba(233,233,233,0) 100%);height:100%;left:0;overflow:hidden;position:absolute;right:0;top:0;z-index:2}@media screen and (prefers-color-scheme:dark){.nPt1pc{display:none}}.nPt1pc::after,.nPt1pc::before{content:"";display:block;height:100%;min-width:110px;position:absolute;right:-10%;-webkit-transform:rotate(-104deg);-ms-transform:rotate(-104deg);transform:rotate(-104deg);width:25vh;z-index:2}@media (min-width:600px){.nPt1pc::after,.nPt1pc::before{width:150px}}.nPt1pc::before{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(243,243,243,0)),to(rgba(243,243,243,.9)));background-image:-webkit-linear-gradient(top,rgba(243,243,243,0) 0,rgba(243,243,243,.9) 100%);background-image:linear-gradient(to bottom,rgba(243,243,243,0) 0,rgba(243,243,243,.9) 100%);bottom:-10%}.nPt1pc::after{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(255,255,255,0)),to(rgba(255,255,255,.9)));background-image:-webkit-linear-gradient(top,rgba(255,255,255,0) 0,rgba(255,255,255,.9) 100%);background-image:linear-gradient(to bottom,rgba(255,255,255,0) 0,rgba(255,255,255,.9) 100%);bottom:-80%}.wsArZ[data-ss-mode="1"] .nPt1pc~.f4ZpM{width:auto}@media (min-width:600px) and (orientation:landscape),all and (min-width:1600px){.NQ5OL .nPt1pc~.f4ZpM{width:auto}}.ZS7CGc .f4ZpM{height:auto}@media (min-width:600px) and (orientation:landscape),all and (min-width:1600px){.NQ5OL .ZS7CGc .f4ZpM{width:115px}}.qiRZ5e .f4ZpM{-webkit-transform:translate(-9%,-3%);-ms-transform:translate(-9%,-3%);transform:translate(-9%,-3%)}.vIv7Gf .f4ZpM{margin:auto;max-height:230px;right:0;top:-3%;-webkit-transform:none;-ms-transform:none;transform:none}.nvYXVd .f4ZpM{-webkit-transform:translate(9%,-3%);-ms-transform:translate(9%,-3%);transform:translate(9%,-3%)}.uOhnzd .f4ZpM{-webkit-transform:translate(24px,0);-ms-transform:translate(24px,0);transform:translate(24px,0)}.MsYMaf .f4ZpM{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.wsArZ[data-ss-mode="1"] .YIi9qf .f4ZpM{max-width:115px}@media (min-width:600px) and (orientation:landscape),all and (min-width:1600px){.NQ5OL .YIi9qf .f4ZpM{max-width:115px}}.QG3Xbe .f4ZpM{max-width:300px}.F6gtje .f4ZpM{-webkit-transform:none;-ms-transform:none;transform:none}@-webkit-keyframes mdc-ripple-fg-radius-in{from{-webkit-animation-timing-function:cubic-bezier(.4,0,.2,1);animation-timing-function:cubic-bezier(.4,0,.2,1);-webkit-transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1);transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1)}to{-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}}@keyframes mdc-ripple-fg-radius-in{from{-webkit-animation-timing-function:cubic-bezier(.4,0,.2,1);animation-timing-function:cubic-bezier(.4,0,.2,1);-webkit-transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1);transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1)}to{-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}}@-webkit-keyframes mdc-ripple-fg-opacity-in{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity,0)}}@keyframes mdc-ripple-fg-opacity-in{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity,0)}}@-webkit-keyframes mdc-ripple-fg-opacity-out{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity,0)}to{opacity:0}}@keyframes mdc-ripple-fg-opacity-out{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity,0)}to{opacity:0}}.VfPpkd-ksKsZd-XxIAqe{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity;position:relative;outline:none;overflow:hidden}.VfPpkd-ksKsZd-XxIAqe::before,.VfPpkd-ksKsZd-XxIAqe::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.VfPpkd-ksKsZd-XxIAqe::before{-webkit-transition:opacity 15ms linear,background-color 15ms linear;transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index,1)}.VfPpkd-ksKsZd-XxIAqe::after{z-index:0;z-index:var(--mdc-ripple-z-index,0)}.VfPpkd-ksKsZd-XxIAqe.VfPpkd-ksKsZd-mWPk3d::before{-webkit-transform:scale(var(--mdc-ripple-fg-scale,1));-ms-transform:scale(var(--mdc-ripple-fg-scale,1));transform:scale(var(--mdc-ripple-fg-scale,1))}.VfPpkd-ksKsZd-XxIAqe.VfPpkd-ksKsZd-mWPk3d::after{top:0;left:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center}.VfPpkd-ksKsZd-XxIAqe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-ZNMTqd::after{top:var(--mdc-ripple-top,0);left:var(--mdc-ripple-left,0)}.VfPpkd-ksKsZd-XxIAqe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-Tv8l5d-lJfZMc::after{-webkit-animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards;animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.VfPpkd-ksKsZd-XxIAqe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-Tv8l5d-OmS1vf::after{-webkit-animation:mdc-ripple-fg-opacity-out .15s;animation:mdc-ripple-fg-opacity-out .15s;-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));-ms-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}.VfPpkd-ksKsZd-XxIAqe::before,.VfPpkd-ksKsZd-XxIAqe::after{top:-50%;left:-50%;width:200%;height:200%}.VfPpkd-ksKsZd-XxIAqe.VfPpkd-ksKsZd-mWPk3d::after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.VfPpkd-ksKsZd-XxIAqe[data-mdc-ripple-is-unbounded],.VfPpkd-ksKsZd-mWPk3d-OWXEXe-ZNMTqd{overflow:visible}.VfPpkd-ksKsZd-XxIAqe[data-mdc-ripple-is-unbounded]::before,.VfPpkd-ksKsZd-XxIAqe[data-mdc-ripple-is-unbounded]::after,.VfPpkd-ksKsZd-mWPk3d-OWXEXe-ZNMTqd::before,.VfPpkd-ksKsZd-mWPk3d-OWXEXe-ZNMTqd::after{top:0;left:0;width:100%;height:100%}.VfPpkd-ksKsZd-XxIAqe[data-mdc-ripple-is-unbounded].VfPpkd-ksKsZd-mWPk3d::before,.VfPpkd-ksKsZd-XxIAqe[data-mdc-ripple-is-unbounded].VfPpkd-ksKsZd-mWPk3d::after,.VfPpkd-ksKsZd-mWPk3d-OWXEXe-ZNMTqd.VfPpkd-ksKsZd-mWPk3d::before,.VfPpkd-ksKsZd-mWPk3d-OWXEXe-ZNMTqd.VfPpkd-ksKsZd-mWPk3d::after{top:var(--mdc-ripple-top,0);left:var(--mdc-ripple-left,0);width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.VfPpkd-ksKsZd-XxIAqe[data-mdc-ripple-is-unbounded].VfPpkd-ksKsZd-mWPk3d::after,.VfPpkd-ksKsZd-mWPk3d-OWXEXe-ZNMTqd.VfPpkd-ksKsZd-mWPk3d::after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.VfPpkd-ksKsZd-XxIAqe::before,.VfPpkd-ksKsZd-XxIAqe::after{background-color:#000;background-color:var(--mdc-ripple-color,#000)}.VfPpkd-ksKsZd-XxIAqe:hover::before,.VfPpkd-ksKsZd-XxIAqe.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE::before{opacity:.04;opacity:var(--mdc-ripple-hover-opacity,.04)}.VfPpkd-ksKsZd-XxIAqe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe::before,.VfPpkd-ksKsZd-XxIAqe:not(.VfPpkd-ksKsZd-mWPk3d):focus::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-focus-opacity,.12)}.VfPpkd-ksKsZd-XxIAqe:not(.VfPpkd-ksKsZd-mWPk3d)::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.VfPpkd-ksKsZd-XxIAqe:not(.VfPpkd-ksKsZd-mWPk3d):active::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-press-opacity,.12)}.VfPpkd-ksKsZd-XxIAqe.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity,0.12)}.VfPpkd-Bz112c-LgbsSe{font-size:24px;width:48px;height:48px;padding:12px}.VfPpkd-Bz112c-LgbsSe.VfPpkd-Bz112c-LgbsSe-OWXEXe-e5LLRc-SxQuSe .VfPpkd-Bz112c-Jh9lGc{width:40px;height:40px;margin-top:4px;margin-bottom:4px;margin-right:4px;margin-left:4px}.VfPpkd-Bz112c-LgbsSe.VfPpkd-Bz112c-LgbsSe-OWXEXe-e5LLRc-SxQuSe .VfPpkd-Bz112c-J1Ukfc-LhBDec{max-height:40px;max-width:40px}.VfPpkd-Bz112c-LgbsSe:disabled{color:rgba(0,0,0,.38);color:var(--mdc-theme-text-disabled-on-light,rgba(0,0,0,.38))}.VfPpkd-Bz112c-LgbsSe svg,.VfPpkd-Bz112c-LgbsSe img{width:24px;height:24px}.VfPpkd-Bz112c-LgbsSe{display:inline-block;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;border:none;outline:none;background-color:transparent;fill:currentColor;color:inherit;text-decoration:none;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:0;overflow:visible}.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-RLmnJb{position:absolute;top:50%;height:48px;left:50%;width:48px;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}@media screen and (forced-colors:active){.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Bz112c-J1Ukfc-LhBDec,.VfPpkd-Bz112c-LgbsSe:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Bz112c-J1Ukfc-LhBDec{display:block}}.VfPpkd-Bz112c-LgbsSe:disabled{cursor:default;pointer-events:none}.VfPpkd-Bz112c-LgbsSe[hidden]{display:none}.VfPpkd-Bz112c-LgbsSe-OWXEXe-KVuj8d-Q3DXx{-webkit-box-align:center;-webkit-align-items:center;align-items:center;display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.VfPpkd-Bz112c-J1Ukfc-LhBDec{pointer-events:none;border:2px solid transparent;border-radius:6px;-webkit-box-sizing:content-box;box-sizing:content-box;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);height:100%;width:100%;display:none}@media screen and (forced-colors:active){.VfPpkd-Bz112c-J1Ukfc-LhBDec{border-color:CanvasText}}.VfPpkd-Bz112c-J1Ukfc-LhBDec::after{content:"";border:2px solid transparent;border-radius:8px;display:block;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);height:calc(100% + 4px);width:calc(100% + 4px)}@media screen and (forced-colors:active){.VfPpkd-Bz112c-J1Ukfc-LhBDec::after{border-color:CanvasText}}.VfPpkd-Bz112c-kBDsod{display:inline-block}.VfPpkd-Bz112c-kBDsod.VfPpkd-Bz112c-kBDsod-OWXEXe-IT5dJd,.VfPpkd-Bz112c-LgbsSe-OWXEXe-IT5dJd .VfPpkd-Bz112c-kBDsod{display:none}.VfPpkd-Bz112c-LgbsSe-OWXEXe-IT5dJd .VfPpkd-Bz112c-kBDsod.VfPpkd-Bz112c-kBDsod-OWXEXe-IT5dJd{display:inline-block}.VfPpkd-Bz112c-mRLv6{height:100%;left:0;outline:none;position:absolute;top:0;width:100%}.VfPpkd-Bz112c-LgbsSe{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity}.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-Jh9lGc::before,.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-Jh9lGc::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-Jh9lGc::before{-webkit-transition:opacity 15ms linear,background-color 15ms linear;transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index,1)}.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-Jh9lGc::after{z-index:0;z-index:var(--mdc-ripple-z-index,0)}.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d .VfPpkd-Bz112c-Jh9lGc::before{-webkit-transform:scale(var(--mdc-ripple-fg-scale,1));-ms-transform:scale(var(--mdc-ripple-fg-scale,1));transform:scale(var(--mdc-ripple-fg-scale,1))}.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d .VfPpkd-Bz112c-Jh9lGc::after{top:0;left:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center}.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-ZNMTqd .VfPpkd-Bz112c-Jh9lGc::after{top:var(--mdc-ripple-top,0);left:var(--mdc-ripple-left,0)}.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-Tv8l5d-lJfZMc .VfPpkd-Bz112c-Jh9lGc::after{-webkit-animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards;animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-Tv8l5d-OmS1vf .VfPpkd-Bz112c-Jh9lGc::after{-webkit-animation:mdc-ripple-fg-opacity-out .15s;animation:mdc-ripple-fg-opacity-out .15s;-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));-ms-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-Jh9lGc::before,.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-Jh9lGc::after{top:0;left:0;width:100%;height:100%}.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d .VfPpkd-Bz112c-Jh9lGc::before,.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d .VfPpkd-Bz112c-Jh9lGc::after{top:var(--mdc-ripple-top,0);left:var(--mdc-ripple-left,0);width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d .VfPpkd-Bz112c-Jh9lGc::after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-Jh9lGc::before,.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-Jh9lGc::after{background-color:#000;background-color:var(--mdc-ripple-color,#000)}.VfPpkd-Bz112c-LgbsSe:hover .VfPpkd-Bz112c-Jh9lGc::before,.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Bz112c-Jh9lGc::before{opacity:.04;opacity:var(--mdc-ripple-hover-opacity,.04)}.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Bz112c-Jh9lGc::before,.VfPpkd-Bz112c-LgbsSe:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Bz112c-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-focus-opacity,.12)}.VfPpkd-Bz112c-LgbsSe:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Bz112c-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.VfPpkd-Bz112c-LgbsSe:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Bz112c-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-press-opacity,.12)}.VfPpkd-Bz112c-LgbsSe.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity,0.12)}.VfPpkd-Bz112c-LgbsSe:disabled:hover .VfPpkd-Bz112c-Jh9lGc::before,.VfPpkd-Bz112c-LgbsSe:disabled.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Bz112c-Jh9lGc::before{opacity:0;opacity:var(--mdc-ripple-hover-opacity,0)}.VfPpkd-Bz112c-LgbsSe:disabled.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Bz112c-Jh9lGc::before,.VfPpkd-Bz112c-LgbsSe:disabled:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Bz112c-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:0;opacity:var(--mdc-ripple-focus-opacity,0)}.VfPpkd-Bz112c-LgbsSe:disabled:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Bz112c-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.VfPpkd-Bz112c-LgbsSe:disabled:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Bz112c-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:0;opacity:var(--mdc-ripple-press-opacity,0)}.VfPpkd-Bz112c-LgbsSe:disabled.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity,0)}.VfPpkd-Bz112c-LgbsSe .VfPpkd-Bz112c-Jh9lGc{height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:-1}.VfPpkd-dgl2Hf-ppHlrf-sM5MNb{display:inline}.VfPpkd-LgbsSe{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-sizing:border-box;box-sizing:border-box;min-width:64px;border:none;outline:none;line-height:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-appearance:none;overflow:visible;vertical-align:middle;background:transparent}.VfPpkd-LgbsSe .VfPpkd-BFbNVe-bF1uUb{width:100%;height:100%;top:0;left:0}.VfPpkd-LgbsSe::-moz-focus-inner{padding:0;border:0}.VfPpkd-LgbsSe:active{outline:none}.VfPpkd-LgbsSe:hover{cursor:pointer}.VfPpkd-LgbsSe:disabled{cursor:default;pointer-events:none}.VfPpkd-LgbsSe[hidden]{display:none}.VfPpkd-LgbsSe .VfPpkd-kBDsod{margin-left:0;margin-right:8px;display:inline-block;position:relative;vertical-align:top}[dir=rtl] .VfPpkd-LgbsSe .VfPpkd-kBDsod,.VfPpkd-LgbsSe .VfPpkd-kBDsod[dir=rtl]{margin-left:8px;margin-right:0}.VfPpkd-LgbsSe .VfPpkd-UdE5de-uDEFge{font-size:0;position:absolute;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);top:50%;left:50%;line-height:normal}.VfPpkd-LgbsSe .VfPpkd-vQzf8d{position:relative}.VfPpkd-LgbsSe .VfPpkd-J1Ukfc-LhBDec{pointer-events:none;border:2px solid transparent;border-radius:6px;-webkit-box-sizing:content-box;box-sizing:content-box;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);height:calc(100% + 4px);width:calc(100% + 4px);display:none}@media screen and (forced-colors:active){.VfPpkd-LgbsSe .VfPpkd-J1Ukfc-LhBDec{border-color:CanvasText}}.VfPpkd-LgbsSe .VfPpkd-J1Ukfc-LhBDec::after{content:"";border:2px solid transparent;border-radius:8px;display:block;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);height:calc(100% + 4px);width:calc(100% + 4px)}@media screen and (forced-colors:active){.VfPpkd-LgbsSe .VfPpkd-J1Ukfc-LhBDec::after{border-color:CanvasText}}@media screen and (forced-colors:active){.VfPpkd-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-J1Ukfc-LhBDec,.VfPpkd-LgbsSe:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-J1Ukfc-LhBDec{display:block}}.VfPpkd-LgbsSe .VfPpkd-RLmnJb{position:absolute;top:50%;height:48px;left:0;right:0;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.VfPpkd-vQzf8d+.VfPpkd-kBDsod{margin-left:8px;margin-right:0}[dir=rtl] .VfPpkd-vQzf8d+.VfPpkd-kBDsod,.VfPpkd-vQzf8d+.VfPpkd-kBDsod[dir=rtl]{margin-left:0;margin-right:8px}svg.VfPpkd-kBDsod{fill:currentColor}.VfPpkd-LgbsSe-OWXEXe-dgl2Hf{margin-top:6px;margin-bottom:6px}.VfPpkd-LgbsSe{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;text-decoration:none}.VfPpkd-LgbsSe{padding:0 8px 0 8px}.VfPpkd-LgbsSe-OWXEXe-k8QpJ{-webkit-transition:-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:box-shadow .28s cubic-bezier(.4,0,.2,1);transition:box-shadow .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);padding:0 16px 0 16px}.VfPpkd-LgbsSe-OWXEXe-k8QpJ.VfPpkd-LgbsSe-OWXEXe-Bz112c-UbuQg{padding:0 12px 0 16px}.VfPpkd-LgbsSe-OWXEXe-k8QpJ.VfPpkd-LgbsSe-OWXEXe-Bz112c-M1Soyc{padding:0 16px 0 12px}.VfPpkd-LgbsSe-OWXEXe-MV7yeb{-webkit-transition:-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:box-shadow .28s cubic-bezier(.4,0,.2,1);transition:box-shadow .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);padding:0 16px 0 16px}.VfPpkd-LgbsSe-OWXEXe-MV7yeb.VfPpkd-LgbsSe-OWXEXe-Bz112c-UbuQg{padding:0 12px 0 16px}.VfPpkd-LgbsSe-OWXEXe-MV7yeb.VfPpkd-LgbsSe-OWXEXe-Bz112c-M1Soyc{padding:0 16px 0 12px}.VfPpkd-LgbsSe-OWXEXe-INsAgc{border-style:solid;-webkit-transition:border .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1)}.VfPpkd-LgbsSe-OWXEXe-INsAgc .VfPpkd-Jh9lGc{border-style:solid;border-color:transparent}.VfPpkd-LgbsSe{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity}.VfPpkd-LgbsSe .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe .VfPpkd-Jh9lGc::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.VfPpkd-LgbsSe .VfPpkd-Jh9lGc::before{-webkit-transition:opacity 15ms linear,background-color 15ms linear;transition:opacity 15ms linear,background-color 15ms linear;z-index:1}.VfPpkd-LgbsSe .VfPpkd-Jh9lGc::after{z-index:0}.VfPpkd-LgbsSe.VfPpkd-ksKsZd-mWPk3d .VfPpkd-Jh9lGc::before{-webkit-transform:scale(var(--mdc-ripple-fg-scale,1));-ms-transform:scale(var(--mdc-ripple-fg-scale,1));transform:scale(var(--mdc-ripple-fg-scale,1))}.VfPpkd-LgbsSe.VfPpkd-ksKsZd-mWPk3d .VfPpkd-Jh9lGc::after{top:0;left:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center}.VfPpkd-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-ZNMTqd .VfPpkd-Jh9lGc::after{top:var(--mdc-ripple-top,0);left:var(--mdc-ripple-left,0)}.VfPpkd-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-Tv8l5d-lJfZMc .VfPpkd-Jh9lGc::after{-webkit-animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards;animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.VfPpkd-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-Tv8l5d-OmS1vf .VfPpkd-Jh9lGc::after{-webkit-animation:mdc-ripple-fg-opacity-out .15s;animation:mdc-ripple-fg-opacity-out .15s;-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));-ms-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}.VfPpkd-LgbsSe .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe .VfPpkd-Jh9lGc::after{top:-50%;left:-50%;width:200%;height:200%}.VfPpkd-LgbsSe.VfPpkd-ksKsZd-mWPk3d .VfPpkd-Jh9lGc::after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.VfPpkd-Jh9lGc{position:absolute;-webkit-box-sizing:content-box;box-sizing:content-box;overflow:hidden;z-index:0;top:0;left:0;bottom:0;right:0}.VfPpkd-LgbsSe{font-family:Roboto,sans-serif;font-size:.875rem;letter-spacing:.0892857143em;font-weight:500;text-transform:uppercase;height:36px;border-radius:4px}.VfPpkd-LgbsSe:not(:disabled){color:#6200ee}.VfPpkd-LgbsSe:disabled{color:rgba(0,0,0,.38)}.VfPpkd-LgbsSe .VfPpkd-kBDsod{font-size:1.125rem;width:1.125rem;height:1.125rem}.VfPpkd-LgbsSe .VfPpkd-Jh9lGc::before{background-color:#6200ee}.VfPpkd-LgbsSe .VfPpkd-Jh9lGc::after{background-color:#6200ee}.VfPpkd-LgbsSe:hover .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Jh9lGc::before{opacity:.04}.VfPpkd-LgbsSe.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}.VfPpkd-LgbsSe:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.VfPpkd-LgbsSe:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}.VfPpkd-LgbsSe.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-text-button-pressed-state-layer-opacity,0.12)}.VfPpkd-LgbsSe .VfPpkd-Jh9lGc{border-radius:4px}.VfPpkd-LgbsSe .VfPpkd-J1Ukfc-LhBDec{border-radius:2px}.VfPpkd-LgbsSe .VfPpkd-J1Ukfc-LhBDec::after{border-radius:4px}.VfPpkd-LgbsSe-OWXEXe-k8QpJ{font-family:Roboto,sans-serif;font-size:.875rem;letter-spacing:.0892857143em;font-weight:500;text-transform:uppercase;height:36px;border-radius:4px}.VfPpkd-LgbsSe-OWXEXe-k8QpJ:not(:disabled){background-color:#6200ee}.VfPpkd-LgbsSe-OWXEXe-k8QpJ:disabled{background-color:rgba(0,0,0,.12)}.VfPpkd-LgbsSe-OWXEXe-k8QpJ:not(:disabled){color:#fff}.VfPpkd-LgbsSe-OWXEXe-k8QpJ:disabled{color:rgba(0,0,0,.38)}.VfPpkd-LgbsSe-OWXEXe-k8QpJ .VfPpkd-kBDsod{font-size:1.125rem;width:1.125rem;height:1.125rem}.VfPpkd-LgbsSe-OWXEXe-k8QpJ .VfPpkd-Jh9lGc::before{background-color:#fff}.VfPpkd-LgbsSe-OWXEXe-k8QpJ .VfPpkd-Jh9lGc::after{background-color:#fff}.VfPpkd-LgbsSe-OWXEXe-k8QpJ:hover .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe-OWXEXe-k8QpJ.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Jh9lGc::before{opacity:.08}.VfPpkd-LgbsSe-OWXEXe-k8QpJ.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe-OWXEXe-k8QpJ:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.24}.VfPpkd-LgbsSe-OWXEXe-k8QpJ:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.VfPpkd-LgbsSe-OWXEXe-k8QpJ:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.24}.VfPpkd-LgbsSe-OWXEXe-k8QpJ.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-filled-button-pressed-state-layer-opacity,0.24)}.VfPpkd-LgbsSe-OWXEXe-k8QpJ .VfPpkd-Jh9lGc{border-radius:4px}.VfPpkd-LgbsSe-OWXEXe-k8QpJ .VfPpkd-J1Ukfc-LhBDec{border-radius:2px}.VfPpkd-LgbsSe-OWXEXe-k8QpJ .VfPpkd-J1Ukfc-LhBDec::after{border-radius:4px}.VfPpkd-LgbsSe-OWXEXe-MV7yeb{font-family:Roboto,sans-serif;font-size:.875rem;letter-spacing:.0892857143em;font-weight:500;text-transform:uppercase;height:36px;border-radius:4px;-webkit-box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:not(:disabled){background-color:#6200ee}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:disabled{background-color:rgba(0,0,0,.12)}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:not(:disabled){color:#fff}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:disabled{color:rgba(0,0,0,.38)}.VfPpkd-LgbsSe-OWXEXe-MV7yeb .VfPpkd-kBDsod{font-size:1.125rem;width:1.125rem;height:1.125rem}.VfPpkd-LgbsSe-OWXEXe-MV7yeb .VfPpkd-Jh9lGc::before{background-color:#fff}.VfPpkd-LgbsSe-OWXEXe-MV7yeb .VfPpkd-Jh9lGc::after{background-color:#fff}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:hover .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe-OWXEXe-MV7yeb.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Jh9lGc::before{opacity:.08}.VfPpkd-LgbsSe-OWXEXe-MV7yeb.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe-OWXEXe-MV7yeb:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.24}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.24}.VfPpkd-LgbsSe-OWXEXe-MV7yeb.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-protected-button-pressed-state-layer-opacity,0.24)}.VfPpkd-LgbsSe-OWXEXe-MV7yeb .VfPpkd-Jh9lGc{border-radius:4px}.VfPpkd-LgbsSe-OWXEXe-MV7yeb .VfPpkd-J1Ukfc-LhBDec{border-radius:2px}.VfPpkd-LgbsSe-OWXEXe-MV7yeb .VfPpkd-J1Ukfc-LhBDec::after{border-radius:4px}.VfPpkd-LgbsSe-OWXEXe-MV7yeb.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe,.VfPpkd-LgbsSe-OWXEXe-MV7yeb:not(.VfPpkd-ksKsZd-mWPk3d):focus{-webkit-box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:hover{-webkit-box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:not(:disabled):active{-webkit-box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12);box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12)}.VfPpkd-LgbsSe-OWXEXe-MV7yeb:disabled{-webkit-box-shadow:0 0 0 0 rgba(0,0,0,.2),0 0 0 0 rgba(0,0,0,.14),0 0 0 0 rgba(0,0,0,.12);box-shadow:0 0 0 0 rgba(0,0,0,.2),0 0 0 0 rgba(0,0,0,.14),0 0 0 0 rgba(0,0,0,.12)}.VfPpkd-LgbsSe-OWXEXe-INsAgc{font-family:Roboto,sans-serif;font-size:.875rem;letter-spacing:.0892857143em;font-weight:500;text-transform:uppercase;height:36px;border-radius:4px;padding:0 15px 0 15px;border-width:1px}.VfPpkd-LgbsSe-OWXEXe-INsAgc:not(:disabled){color:#6200ee}.VfPpkd-LgbsSe-OWXEXe-INsAgc:disabled{color:rgba(0,0,0,.38)}.VfPpkd-LgbsSe-OWXEXe-INsAgc .VfPpkd-kBDsod{font-size:1.125rem;width:1.125rem;height:1.125rem}.VfPpkd-LgbsSe-OWXEXe-INsAgc .VfPpkd-Jh9lGc::before{background-color:#6200ee}.VfPpkd-LgbsSe-OWXEXe-INsAgc .VfPpkd-Jh9lGc::after{background-color:#6200ee}.VfPpkd-LgbsSe-OWXEXe-INsAgc:hover .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe-OWXEXe-INsAgc.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Jh9lGc::before{opacity:.04}.VfPpkd-LgbsSe-OWXEXe-INsAgc.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Jh9lGc::before,.VfPpkd-LgbsSe-OWXEXe-INsAgc:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}.VfPpkd-LgbsSe-OWXEXe-INsAgc:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.VfPpkd-LgbsSe-OWXEXe-INsAgc:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}.VfPpkd-LgbsSe-OWXEXe-INsAgc.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-outlined-button-pressed-state-layer-opacity,0.12)}.VfPpkd-LgbsSe-OWXEXe-INsAgc .VfPpkd-Jh9lGc{border-radius:4px}.VfPpkd-LgbsSe-OWXEXe-INsAgc .VfPpkd-J1Ukfc-LhBDec{border-radius:2px}.VfPpkd-LgbsSe-OWXEXe-INsAgc .VfPpkd-J1Ukfc-LhBDec::after{border-radius:4px}.VfPpkd-LgbsSe-OWXEXe-INsAgc:not(:disabled){border-color:rgba(0,0,0,.12)}.VfPpkd-LgbsSe-OWXEXe-INsAgc:disabled{border-color:rgba(0,0,0,.12)}.VfPpkd-LgbsSe-OWXEXe-INsAgc.VfPpkd-LgbsSe-OWXEXe-Bz112c-UbuQg{padding:0 11px 0 15px}.VfPpkd-LgbsSe-OWXEXe-INsAgc.VfPpkd-LgbsSe-OWXEXe-Bz112c-M1Soyc{padding:0 15px 0 11px}.VfPpkd-LgbsSe-OWXEXe-INsAgc .VfPpkd-Jh9lGc{top:-1px;left:-1px;bottom:-1px;right:-1px;border-width:1px}.VfPpkd-LgbsSe-OWXEXe-INsAgc .VfPpkd-RLmnJb{left:-1px;width:calc(100% + 2px)}.nCP5yc{font-family:"Google Sans",Roboto,Arial,sans-serif;font-size:.875rem;letter-spacing:.0107142857em;font-weight:500;text-transform:none;-webkit-transition:border .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1),box-shadow .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1),box-shadow .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);-webkit-box-shadow:none;box-shadow:none}.nCP5yc .VfPpkd-Jh9lGc{height:100%;position:absolute;overflow:hidden;width:100%;z-index:0}.nCP5yc:not(:disabled){background-color:rgb(26,115,232);background-color:var(--gm-fillbutton-container-color,rgb(26,115,232))}.nCP5yc:not(:disabled){color:#fff;color:var(--gm-fillbutton-ink-color,#fff)}.nCP5yc:disabled{background-color:rgba(60,64,67,.12);background-color:var(--gm-fillbutton-disabled-container-color,rgba(60,64,67,.12))}.nCP5yc:disabled{color:rgba(60,64,67,.38);color:var(--gm-fillbutton-disabled-ink-color,rgba(60,64,67,.38))}.nCP5yc .VfPpkd-Jh9lGc::before,.nCP5yc .VfPpkd-Jh9lGc::after{background-color:rgb(32,33,36);background-color:var(--gm-fillbutton-state-color,rgb(32,33,36))}.nCP5yc:hover .VfPpkd-Jh9lGc::before,.nCP5yc.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Jh9lGc::before{opacity:.16;opacity:var(--mdc-ripple-hover-opacity,.16)}.nCP5yc.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Jh9lGc::before,.nCP5yc:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.24;opacity:var(--mdc-ripple-focus-opacity,.24)}.nCP5yc:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.nCP5yc:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.2;opacity:var(--mdc-ripple-press-opacity,.2)}.nCP5yc.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity,0.2)}.nCP5yc .VfPpkd-BFbNVe-bF1uUb{opacity:0}.nCP5yc .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-uI4vCe-LkdAo,.nCP5yc .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-IdXvz-LkdAo-Bd00G{stroke:#fff}@media (-ms-high-contrast:active),screen and (forced-colors:active){.nCP5yc .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-uI4vCe-LkdAo,.nCP5yc .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-IdXvz-LkdAo-Bd00G{stroke:CanvasText}}.nCP5yc:hover{-webkit-box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15);box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15);-webkit-box-shadow:0 1px 2px 0 var(--gm-fillbutton-keyshadow-color,rgba(60,64,67,.3)),0 1px 3px 1px var(--gm-fillbutton-ambientshadow-color,rgba(60,64,67,.15));box-shadow:0 1px 2px 0 var(--gm-fillbutton-keyshadow-color,rgba(60,64,67,.3)),0 1px 3px 1px var(--gm-fillbutton-ambientshadow-color,rgba(60,64,67,.15))}.nCP5yc:hover .VfPpkd-BFbNVe-bF1uUb{opacity:0}.nCP5yc:active{-webkit-box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 2px 6px 2px rgba(60,64,67,.15);box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 2px 6px 2px rgba(60,64,67,.15);-webkit-box-shadow:0 1px 2px 0 var(--gm-fillbutton-keyshadow-color,rgba(60,64,67,.3)),0 2px 6px 2px var(--gm-fillbutton-ambientshadow-color,rgba(60,64,67,.15));box-shadow:0 1px 2px 0 var(--gm-fillbutton-keyshadow-color,rgba(60,64,67,.3)),0 2px 6px 2px var(--gm-fillbutton-ambientshadow-color,rgba(60,64,67,.15))}.nCP5yc:active .VfPpkd-BFbNVe-bF1uUb{opacity:0}.nCP5yc:disabled{-webkit-box-shadow:none;box-shadow:none}.nCP5yc:disabled:hover .VfPpkd-Jh9lGc::before,.nCP5yc:disabled.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Jh9lGc::before{opacity:0;opacity:var(--mdc-ripple-hover-opacity,0)}.nCP5yc:disabled.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Jh9lGc::before,.nCP5yc:disabled:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:0;opacity:var(--mdc-ripple-focus-opacity,0)}.nCP5yc:disabled:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.nCP5yc:disabled:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:0;opacity:var(--mdc-ripple-press-opacity,0)}.nCP5yc:disabled.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity,0)}.nCP5yc:disabled .VfPpkd-BFbNVe-bF1uUb{opacity:0}.Rj2Mlf{font-family:"Google Sans",Roboto,Arial,sans-serif;font-size:.875rem;letter-spacing:.0107142857em;font-weight:500;text-transform:none;-webkit-transition:border .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1),box-shadow .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1),box-shadow .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);-webkit-box-shadow:none;box-shadow:none}.Rj2Mlf .VfPpkd-Jh9lGc{height:100%;position:absolute;overflow:hidden;width:100%;z-index:0}.Rj2Mlf:not(:disabled){color:rgb(26,115,232);color:var(--gm-hairlinebutton-ink-color,rgb(26,115,232))}.Rj2Mlf:not(:disabled){border-color:rgb(218,220,224);border-color:var(--gm-hairlinebutton-outline-color,rgb(218,220,224))}.Rj2Mlf:not(:disabled):hover{border-color:rgb(218,220,224);border-color:var(--gm-hairlinebutton-outline-color,rgb(218,220,224))}.Rj2Mlf:not(:disabled).VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe,.Rj2Mlf:not(:disabled):not(.VfPpkd-ksKsZd-mWPk3d):focus{border-color:rgb(23,78,166);border-color:var(--gm-hairlinebutton-outline-color--stateful,rgb(23,78,166))}.Rj2Mlf:not(:disabled):active,.Rj2Mlf:not(:disabled):focus:active{border-color:rgb(218,220,224);border-color:var(--gm-hairlinebutton-outline-color,rgb(218,220,224))}.Rj2Mlf:disabled{color:rgba(60,64,67,.38);color:var(--gm-hairlinebutton-disabled-ink-color,rgba(60,64,67,.38))}.Rj2Mlf:disabled{border-color:rgba(60,64,67,.12);border-color:var(--gm-hairlinebutton-disabled-outline-color,rgba(60,64,67,.12))}.Rj2Mlf:hover:not(:disabled),.Rj2Mlf.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe:not(:disabled),.Rj2Mlf:not(.VfPpkd-ksKsZd-mWPk3d):focus:not(:disabled),.Rj2Mlf:active:not(:disabled){color:rgb(23,78,166);color:var(--gm-hairlinebutton-ink-color--stateful,rgb(23,78,166))}.Rj2Mlf .VfPpkd-BFbNVe-bF1uUb{opacity:0}.Rj2Mlf .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-uI4vCe-LkdAo,.Rj2Mlf .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-IdXvz-LkdAo-Bd00G{stroke:rgb(26,115,232)}@media (-ms-high-contrast:active),screen and (forced-colors:active){.Rj2Mlf .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-uI4vCe-LkdAo,.Rj2Mlf .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-IdXvz-LkdAo-Bd00G{stroke:CanvasText}}.Rj2Mlf .VfPpkd-Jh9lGc::before,.Rj2Mlf .VfPpkd-Jh9lGc::after{background-color:rgb(26,115,232);background-color:var(--gm-hairlinebutton-state-color,rgb(26,115,232))}.Rj2Mlf:hover .VfPpkd-Jh9lGc::before,.Rj2Mlf.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Jh9lGc::before{opacity:.04;opacity:var(--mdc-ripple-hover-opacity,.04)}.Rj2Mlf.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Jh9lGc::before,.Rj2Mlf:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-focus-opacity,.12)}.Rj2Mlf:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.Rj2Mlf:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-press-opacity,.12)}.Rj2Mlf.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity,0.12)}.Rj2Mlf:disabled:hover .VfPpkd-Jh9lGc::before,.Rj2Mlf:disabled.VfPpkd-ksKsZd-XxIAqe-OWXEXe-ZmdkE .VfPpkd-Jh9lGc::before{opacity:0;opacity:var(--mdc-ripple-hover-opacity,0)}.Rj2Mlf:disabled.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe .VfPpkd-Jh9lGc::before,.Rj2Mlf:disabled:not(.VfPpkd-ksKsZd-mWPk3d):focus .VfPpkd-Jh9lGc::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:0;opacity:var(--mdc-ripple-focus-opacity,0)}.Rj2Mlf:disabled:not(.VfPpkd-ksKsZd-mWPk3d) .VfPpkd-Jh9lGc::after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.Rj2Mlf:disabled:not(.VfPpkd-ksKsZd-mWPk3d):active .VfPpkd-Jh9lGc::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:0;opacity:var(--mdc-ripple-press-opacity,0)}.Rj2Mlf:disabled.VfPpkd-ksKsZd-mWPk3d{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity,0)}.b9hyVd{font-family:"Google Sans",Roboto,Arial,sans-serif;font-size:.875rem;letter-spacing:.0107142857em;font-weight:500;text-transform:none;-webkit-transition:border .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1),box-shadow .28s cubic-bezier(.4,0,.2,1);transition:border .28s cubic-bezier(.4,0,.2,1),box-shadow .28s cubic-bezier(.4,0,.2,1),-webkit-box-shadow .28s cubic-bezier(.4,0,.2,1);border-width:0;-webkit-box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15);box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15);-webkit-box-shadow:0 1px 2px 0 var(--gm-protectedbutton-keyshadow-color,rgba(60,64,67,.3)),0 1px 3px 1px var(--gm-protectedbutton-ambientshadow-color,rgba(60,64,67,.15));box-shadow:0 1px 2px 0 var(--gm-protectedbutton-keyshadow-color,rgba(60,64,67,.3)),0 1px 3px 1px var(--gm-protectedbutton-ambientshadow-color,rgba(60,64,67,.15))}.b9hyVd .VfPpkd-Jh9lGc{height:100%;position:absolute;overflow:hidden;width:100%;z-index:0}.b9hyVd:not(:disabled){background-color:#fff;background-color:var(--gm-protectedbutton-container-color,#fff)}.b9hyVd:not(:disabled){color:rgb(26,115,232);color:var(--gm-protectedbutton-ink-color,rgb(26,115,232))}.b9hyVd:disabled{background-color:rgba(60,64,67,.12);background-color:var(--gm-protectedbutton-disabled-container-color,rgba(60,64,67,.12))}.b9hyVd:disabled{color:rgba(60,64,67,.38);color:var(--gm-protectedbutton-disabled-ink-color,rgba(60,64,67,.38))}.b9hyVd:hover:not(:disabled),.b9hyVd.VfPpkd-ksKsZd-mWPk3d-OWXEXe-AHe6Kc-XpnDCe:not(:disabled),.b9hyVd:not(.VfPpkd-ksKsZd-mWPk3d):focus:not(:disabled),.b9hyVd:active:not(:disabled){color:rgb(23,78,166);color:var(--gm-protectedbutton-ink-color--stateful,rgb(23,78,166))}.b9hyVd .VfPpkd-BFbNVe-bF1uUb{opacity:0}.b9hyVd .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-uI4vCe-LkdAo,.b9hyVd .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-IdXvz-LkdAo-Bd00G{stroke:rgb(26,115,232)}@media (-ms-high-contrast:active),screen and (forced-colors:active){.b9hyVd .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-uI4vCe-LkdAo,.b9hyVd .VfPpkd-UdE5de-uDEFge .VfPpkd-JGcpL-IdXvz-LkdAo-B
2026-01-13T09:30:35
https://aws.amazon.com/search/?searchQuery=
AWS Search Skip to main content Filter: All English Contact us AWS Marketplace Support My account Search Filter: All Sign in to console Create account Search the AWS website Filter Sort by Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading Did you find what you were looking for today? Let us know so we can improve the quality of the content on our pages Yes No Create an AWS account Learn What Is AWS? What Is Cloud Computing? What Is Agentic AI? Cloud Computing Concepts Hub AWS Cloud Security What's New Blogs Press Releases Resources Getting Started Training AWS Trust Center AWS Solutions Library Architecture Center Product and Technical FAQs Analyst Reports AWS Partners Developers Builder Center SDKs & Tools .NET on AWS Python on AWS Java on AWS PHP on AWS JavaScript on AWS Help Contact Us File a Support Ticket AWS re:Post Knowledge Center AWS Support Overview Get Expert Help AWS Accessibility Legal English Back to top Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. x facebook linkedin instagram twitch youtube podcasts email Privacy Site terms Cookie Preferences © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2026-01-13T09:30:35
https://github.com/compiler-explorer/compiler-explorer/issues/new
Sign in to GitHub · GitHub Skip to content You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert Sign in to GitHub {{ message }} --> Username or email address Password Forgot password? Uh oh! There was an error while loading. Please reload this page . New to GitHub? Create an account Sign in with a passkey Terms Privacy Docs Contact GitHub Support Manage cookies Do not share my personal information You can’t perform that action at this time.
2026-01-13T09:30:35
https://young-programmers.blogspot.com/2015/
Young Programmers Podcast: 2015 skip to main | skip to sidebar Young Programmers Podcast A video podcast for computer programmers in grades 3 and up. We learn about Scratch, Tynker, Alice, Python, Pygame, and Scala, and interview interesting programmers. From professional software developer and teacher Dave Briccetti, and many special guests. Viewing the Videos or Subscribing to the Podcast Some of the entries have a picture, which you can click to access the video. Otherwise, to see the videos, use this icon to subscribe to or view the feed: Or, subscribe in iTunes Thursday, February 12, 2015 This Podcast Moves to YouTube Hi all. I have moved to YouTube: https://www.youtube.com/user/dcbriccetti To this playlist, specifically: https://www.youtube.com/playlist?list=PLA87D270FAD3A8C73 See you there. at 7:12 PM Newer Posts Older Posts Home Subscribe to: Comments (Atom) About Me Dave Briccetti View my complete profile Where to Get Software Kojo Python Alice Scratch Other Blogs Dave Briccetti’s Blog One of My Best Classes Ever 10 years ago Tags alice (3) Android (1) arduino (1) art (1) audacity (2) dictionary (2) Flickr (1) functions (2) gamedev (1) garageband (1) GIMP (2) Google (2) guest (4) hacker (1) higher-order functions (1) inkscape (1) interview (9) Java (2) JavaFX (2) Jython (3) Kojo (2) lift (1) music (2) physics (1) platform (1) programmer (4) pygame (6) python (31) PythonCard (1) random (6) Sande (2) Scala (5) scratch (10) shdh (2) shdh34 (2) sound (3) sprite (2) Swing (3) teaching (3) twitter (2) Tynker (1) Web Services (1) xturtle (1) Followers Blog Archive ▼  2015 (1) ▼  February (1) This Podcast Moves to YouTube ►  2013 (4) ►  July (1) ►  June (3) ►  2012 (2) ►  February (1) ►  January (1) ►  2011 (8) ►  November (1) ►  July (3) ►  May (1) ►  February (2) ►  January (1) ►  2010 (6) ►  October (2) ►  June (2) ►  February (2) ►  2009 (37) ►  December (4) ►  November (1) ►  September (7) ►  August (11) ►  July (14)  
2026-01-13T09:30:35
https://vml.visma.ai/cookies
Cookie Policy & Privacy Settings | Visma Machine Learning About us Who are we? Learn more about Visma Machine Learning What we do Learn more about the products we offer What our customers say Read our customers' testimonials Products Autosuggest Automate your workflow Smartscan Extract data from your documents Resources Blog Product news and showcases Showcase of prototypes Prototypes, ideas and experiments Support Get started Find out more about onboarding to Visma Machine Learning FAQ We have answers to your frequently asked questions. Privacy policy Learn how we handle your data and protect your privacy Cookie policy Learn about how we use cookies to enhance your experience API Documentation Contact Us About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Showcase of prototypes Support Get started FAQ Privacy policy Cookie policy API Documentation Loading... Gærtorvet 1-5 1799 Copenhagen Denmark E-mail: worksmarter@visma.com About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Prototypes Documentation Support Get started FAQ Privacy policy Cookie policy Security Information Operating Status © 2026 Visma Group. All rights reserved Cookie Policy Learn about our cookie usage and how to manage your privacy preferences. This cookie policy describes Visma Software International AS/Visma Machine Learning Assets' ( “we“, “us“, “our“ ) use of cookies when you visit our website/use our application. If you have any questions about our use of cookies that are not answered by the information below, please contact us on worksmarter@visma.com . What are cookies and why do we use them? Cookies are small text files that are stored on your device when you visit a website. Cookies help the website remember information about your visit to improve the website's functionality and display more personalised and useful content. When you visit our website, we install certain cookies on your device that are strictly necessary for the functionality of the website. Subject to your consent, we may also use cookies or other tracking tools to collect information about your device and your interaction with our website. At the bottom of this cookie policy, you will find a complete list of the cookies we use and the purposes we use them for. Does our use of cookies involve processing of personal data? Using cookies includes processing of personal data. This may include cookie IDs, IP-addresses, activity on the website and similar. All processing of personal data is subject to security and privacy standards enshrined in the applicable data protection legislation. You can read more about our processing of your personal data in our privacy statement. How can you manage or delete cookies? You can, at any time, withdraw your consent to our use of cookies that are not strictly necessary for the functioning of the website. Please note that cookies allow us to give you the best possible experience on our website and that blocking cookies will affect the website's performance. If you want to withdraw your consent, or otherwise manage your cookie preferences, you can easily do so by clicking on the icon in the bottom-left corner. What cookies do we use? Strictly necessary cookies Strictly necessary cookies make our website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies. Name Purpose Optional Retention time* Recipient session This cookie is typically used to maintain an anonymized user session by the server. No session vml.visma.ai logged-in This cookie is typically used to maintain an anonymized user session by the server. No session vml.visma.ai OptanonAlertBoxClosed This cookie is set by websites using certain versions of the cookie law compliance solution from OneTrust. It is set after visitors have seen a cookie information notice and in some cases only when they actively close the notice down. It enables the website not to show the message more than once to a user. The cookie has a normal lifespan of one year and contains no personal information. No 1 year vml.visma.ai OptanonConsent This cookie is set by the cookie compliance solution from OneTrust. It stores information about the categories of cookies the site uses and whether visitors have given or withdrawn consent for the use of each category. This enables site owners to prevent cookies in each category from being set in the users browser, when consent is not given. The cookie has a normal lifespan of one year, so that returning visitors to the site will have their preferences remembered. It contains no information that can identify the site visitor. No 1 year vml.visma.ai *The retention time is calculated from the last time you visited the website. The cookie is deleted automatically after the expiry of the time. Functional cookies Functional cookies enable our website to remember information that changes the way the website behaves or looks; for example, your preferred language or the region that you are in. We are currently not using any functional cookies cookies. Analytical cookies Analytical cookies allow us to analyse traffic sources so we can measure and improve the performance of our site. Analytical cookies enable us to see how visitors move around the website. We are currently not using any analytical cookies cookies. Marketing cookies Marketing cookies are used to build a profile of your interests to show you relevant adverts on this and other websites. The intention is to display ads that are relevant and engaging for you. If you do not allow these cookies, you will experience less targeted advertising and personalised content. We are currently not using any marketing cookies cookies.
2026-01-13T09:30:35
https://support.microsoft.com/sl-si/windows/upravljanje-pi%C5%A1kotkov-v-microsoft-edge-ogled-omogo%C4%8Danje-blokiranje-brisanje-in-uporaba-168dab11-0753-043d-7c16-ede5947fc64d
Upravljanje piškotkov v Microsoft Edge: ogled, omogočanje, blokiranje, brisanje in uporaba - Microsoftova podpora Sorodne teme × Varnost, zaščita in zasebnost sistema Windows Pregled Pregled zaščite, varnosti in zasebnosti varnost v sistemu Windows Pridobite pomoč za aplikacijo Varnost sistema Windows Ostanite zaščiteni z aplikacijo Varnost sistema Windows Preden reciklirate, prodate ali podarite konzolo Xbox ali računalnik s sistemom Windows Odstranjevanje zlonamerne programske opreme iz računalnika s sistemom Windows Zaščita sistema Windows Pridobite pomoč za zaščito sistema Windows Ogled in brisanje zgodovine brskanja v brskalniku Microsoft Edge Brisanje in upravljanje piškotkov Varno odstranite dragoceno vsebino pri ponovni namestitvi sistema Windows Iskanje in zaklepanje izgubljene naprave s sistemom Windows Zasebnost sistema Windows Pridobite pomoč za zasebnost v sistemu Windows Nastavitve zasebnosti v sistemu Windows, ki jih uporabljajo aplikacije Ogled podatkov na nadzorni plošči za zasebnost Preskoči na glavno vsebino Microsoft Podpora Podpora Podpora Domača stran Microsoft 365 Office Izdelki Microsoft 365 Outlook Microsoft Teams OneDrive Microsoft Copilot OneNote Windows več ... Naprave Surface Dodatna oprema računalnika Xbox Igranje iger v računalniku HoloLens Surface Hub Jamstvo za strojno opremo Račun in obračunavanje kupec Microsoft Store in obračunavanje Viri Novosti Forumi skupnosti Skrbniki okolja Microsoft 365 Portal za majhna podjetja Razvijalec Izobraževanje Prijavite zlorabo podpore Varnost izdelkov Več Kupite Microsoft 365 Ves Microsoft Global Microsoft 365 Teams Copilot Windows Surface Xbox Podpora Programska oprema Programska oprema Programi za Windows UI OneDrive Outlook OneNote Microsoftove ekipe Računalniki in naprave Računalniki in naprave Dodatki za računalnike Zabava Zabava Igre za računalnike Podjetja Podjetja Microsoftova varnost Azure Dynamics 365 Microsoft 365 za podjetja Microsoft Industry Microsoft Power Platform Windows 365 Razvijalci in IT Razvijalci in IT Razvijalec za Microsoft Microsoft Learn Podpora za aplikacije UI na tržnici Microsoftova skupnost tehnikov Microsoft Marketplace Visual Studio Marketplace Rewards Drugih Drugih Brezplačni prenosi in varnost Oglejte si zemljevid spletnega mesta Išči Iskanje pomoči Ni rezultatov Prekliči Vpis Vpišite se z Microsoftovim Vpišite se ali ustvarite račun. Pozdravljeni, Izberite drug račun. Imate več računov Izberite račun, s katerim se želite vpisati. Sorodne teme Varnost, zaščita in zasebnost sistema Windows Pregled Pregled zaščite, varnosti in zasebnosti varnost v sistemu Windows Pridobite pomoč za aplikacijo Varnost sistema Windows Ostanite zaščiteni z aplikacijo Varnost sistema Windows Preden reciklirate, prodate ali podarite konzolo Xbox ali računalnik s sistemom Windows Odstranjevanje zlonamerne programske opreme iz računalnika s sistemom Windows Zaščita sistema Windows Pridobite pomoč za zaščito sistema Windows Ogled in brisanje zgodovine brskanja v brskalniku Microsoft Edge Brisanje in upravljanje piškotkov Varno odstranite dragoceno vsebino pri ponovni namestitvi sistema Windows Iskanje in zaklepanje izgubljene naprave s sistemom Windows Zasebnost sistema Windows Pridobite pomoč za zasebnost v sistemu Windows Nastavitve zasebnosti v sistemu Windows, ki jih uporabljajo aplikacije Ogled podatkov na nadzorni plošči za zasebnost Upravljanje piškotkov v Microsoft Edge: ogled, omogočanje, blokiranje, brisanje in uporaba Velja za Windows 10 Windows 11 Microsoft Edge Piškotki so majhni deli podatkov, ki jih spletna mesta, ki jih obiščete, shranijo v vašo napravo. Služijo različnim namenom, kot so zapomniti si poverilnice za prijavo, nastavitve mesta in sledenje uporabniškega vedenja. Vendar pa boste morda želeli izbrisati piškotke zaradi zasebnosti ali odpraviti težave z brskanjem. V tem članku so navodila, kako: Prikaži vse piškotke Dovoli vse piškotke Dovoli piškotke z določenega spletnega mesta Blokiranje piškotkov tretjih oseb Blokiraj vse piškotke Blokiranje piškotkov z določenega spletnega mesta Brisanje vseh piškotkov Brisanje piškotkov z določenega spletnega mesta Brisanje piškotkov ob zapiranju brskalnika Uporaba piškotkov za vnaprejšnje nalaganje strani za hitrejše brskanje Prikaži vse piškotke Odprite brskalnik Edge, v zgornjem desnem kotu   okna brskalnika izberite Nastavitve in drugo.  Izberite Nastavitve > zasebnost, iskanje in storitve . Izberite Piškotki , nato pa kliknite Ogled vseh piškotkov in podatkov o spletnem mestu, da si ogledate vse shranjene piškotke in povezane informacije o spletnem mestu. Dovoli vse piškotke Če dovolite piškotke, lahko spletna mesta shranjujejo in pridobivajo podatke v brskalniku, kar lahko izboljša vašo izkušnjo brskanja tako, da si zapomni nastavitve in podatke za prijavo. Odprite brskalnik Edge, v zgornjem desnem kotu   okna brskalnika izberite Nastavitve in drugo.  Izberite Nastavitve > zasebnost, iskanje in storitve . Izberite Piškotki in omogočite preklopni gumb Dovoli spletnim mestom shranjevanje in branje podatkov o piškotkih (priporočeno), da dovolijo vse piškotke. Dovoli piškotke z določenega spletnega mesta Če dovolite piškotke, lahko spletna mesta shranjujejo in pridobivajo podatke v brskalniku, kar lahko izboljša vašo izkušnjo brskanja tako, da si zapomni nastavitve in podatke za prijavo. Odprite brskalnik Edge, v zgornjem desnem kotu   okna brskalnika izberite Nastavitve in drugo. Izberite Nastavitve > zasebnost, iskanje in storitve . Izberite Piškotki in pojdite na Dovoljeno shranjevanje piškotkov. Izberite Dodaj spletno mesto, če želite dovoliti piškotke na osnovi izdelka, tako da vnesete URL spletnega mesta. Blokiranje piškotkov tretjih oseb Če ne želite, da spletna mesta drugih ponudnikov shranjujejo piškotke v vaš računalnik, lahko piškotke blokirate. S tem nekatere strani morda ne bodo pravilno prikazane ali pa boste od spletnega mesta prejeli sporočilo, da morate dovoliti piškotke, če si ga želite ogledati. Odprite brskalnik Edge, v zgornjem desnem kotu   okna brskalnika izberite Nastavitve in drugo. Izberite Nastavitve > zasebnost, iskanje in storitve . Izberite Piškotki in omogočite preklopni gumb Blokiraj piškotke od drugod. Blokiraj vse piškotke Če ne želite, da spletna mesta drugih ponudnikov shranjujejo piškotke v vaš računalnik, lahko piškotke blokirate. S tem nekatere strani morda ne bodo pravilno prikazane ali pa boste od spletnega mesta prejeli sporočilo, da morate dovoliti piškotke, če si ga želite ogledati. Odprite brskalnik Edge, v zgornjem desnem kotu   okna brskalnika izberite Nastavitve in drugo. Izberite Nastavitve > zasebnost, iskanje in storitve . Izberite Piškotki in onemogočite možnost Dovoli spletnim mestom shranjevanje in branje podatkov o piškotkih (priporočeno), da blokirajo vse piškotke. Blokiranje piškotkov z določenega spletnega mesta Microsoft Edge vam omogoča blokiranje piškotkov z določenega spletnega mesta, vendar lahko s tem nekaterim stranem preprečite pravilno prikazovanje ali pa se na spletnem mestu prikaže sporočilo, da morate dovoliti piškotke za ogled tega spletnega mesta. Blokiranje piškotkov z določenega spletnega mesta: Odprite brskalnik Edge, v zgornjem desnem kotu   okna brskalnika izberite Nastavitve in drugo. Izberite Nastavitve > zasebnost, iskanje in storitve . Izberite Piškotki in pojdite na Ni dovoljeno shranjevanje in branje piškotkov . Izberite Dodaj   spletno mesto , če želite blokirati piškotke na osnovi izdelka, tako da vnesete URL spletnega mesta. Brisanje vseh piškotkov Odprite brskalnik Edge, v zgornjem desnem kotu   okna brskalnika izberite Nastavitve in drugo. Izberite Nastavitve > zasebnost, iskanje in storitve . Izberite Počisti podatke o brskanju in nato izberite Izberite, kaj želite počistiti zraven možnosti Počisti podatke o brskanju zdaj .  V razdelku Časovni obseg na seznamu izberite časovni obseg. Izberite Piškotki in drugi podatki spletnega mesta in nato Počisti zdaj . Opomba:  Piškotke lahko izbrišete tudi tako, da skupaj pritisnete CTRL + SHIFT + DELETE in nato nadaljujete s 4. in 5. korakom. Vsi vaši piškotki in drugi podatki o spletnem mestu bodo zdaj izbrisani za časovni obseg, ki ste ga izbrali. S tem se izpišete iz večine spletnih mest. Brisanje piškotkov z določenega spletnega mesta Odprite brskalnik Edge, izberite Nastavitve in drugo >   nastavitve > zasebnost, iskanje in storitve . Izberite Piškotki , kliknite Ogled vseh piškotkov in podatkov o spletnem mestu ter poiščite spletno mesto, katerega piškotke želite izbrisati. Izberite puščico dol   na desni strani spletnega mesta, za katerega želite izbrisati piškotke, in izberite Izbriši . Piškotki za izbrano spletno mesto so zdaj izbrisani. Ta korak ponovite za vsa mesta, katerih piškotke želite izbrisati.  Brisanje piškotkov ob zapiranju brskalnika Odprite brskalnik Edge, izberite Nastavitve in drugo >   nastavitve > zasebnost, iskanje in storitve . Izberite Počisti podatke o brskanju , nato pa izberite Izberite, kaj želite počistiti vsakič, ko zaprete brskalnik . Vklopite preklopni gumb Piškotki in drugi podatki o spletnem mestu. Ko je ta funkcija vklopljena, se vsakič, ko zaprete brskalnik Edge, izbrišejo vsi piškotki in drugi podatki o spletnem mestu. S tem se izpišete iz večine spletnih mest. Uporaba piškotkov za vnaprejšnje nalaganje strani za hitrejše brskanje Odprite brskalnik Edge, v zgornjem desnem kotu   okna brskalnika izberite Nastavitve in drugo.  Izberite Nastavitve > zasebnost, iskanje in storitve . Izberite Piškotki in omogočite preklopni gumb Preload strani za hitrejše brskanje in iskanje. NAROČITE SE NA VIRE RSS Ali potrebujete dodatno pomoč? Ali želite več možnosti? Odkrijte Skupnost Stik z nami Raziščite ugodnosti naročnine, prebrskajte izobraževalne tečaje, preberite, kako zaščitite svojo napravo in še več. Ugodnosti naročnine na Microsoft 365 Izobraževanje za Microsoft 365 Microsoftova varnost Središče za dostopnost Skupnosti vam pomagajo postaviti vprašanja in odgovoriti nanje, posredovati povratne informacije in prisluhniti strokovnjakom z bogatim znanjem. Vprašajte Microsoftovo skupnost Microsoftova tehnična skupnost Preskuševalci sistema Windows Preskuševalci storitve Microsoft 365 Poiščite rešitve za pogoste težave ali poiščite pomoč pri posredniku za podporo. Spletna podpora Vam je bila informacija v pomoč? Da Ne Hvala! Imate še kakšne povratne informacije za Microsoft? Ali nam lahko pomagate izboljšati uporabnost? (Pošljite povratne informacije Microsoftu, da vam bomo lahko pomagali.) Kako ste zadovoljni s kakovostjo jezika? Kaj je vplivalo na vašo izkušnjo? Težava je bila odpravljena Počisti navodila Razumljivo Brez nejasnih izrazov Slike so bile v pomoč Kakovost prevoda Se ne ujema z mojim zaslonom Napačna navodila Preveč tehnično Ni dovolj informacij Ni dovolj slik Kakovost prevoda Ali imate še kakšne povratne informacije? (Izbirno) Pošlji povratne informacije Če pritisnete »Pošlji«, bomo vaše povratne informacije uporabili za izboljšanje Microsoftovih izdelkov in storitev. Vaš skrbnik za IT bo lahko zbiral te podatke. Izjavi o zasebnosti. Zahvaljujemo se vam za povratne informacije. × Kaj je novega? Microsoft Copilot Microsoft 365 Aplikacije za Windows 11 Microsoft Store Profil računa Središče za prenose Vračila Sledenje naročilom Recikliranje Commercial Warranties Izobraževanje Microsoft Education Naprave za izobraževanje Microsoft Teams za izobraževanje Microsoft 365 Education Office Education Izobraževanje in razvoj učiteljev Posebne ponudbe za študente in starše Azure za študente Poslovanje Microsoftova varnost Azure Dynamics 365 Microsoft 365 Microsoft Advertising Microsoft 365 Copilot Microsoft Teams Razvijalci in IT Razvijalec za Microsoft Microsoft Learn Podpora za aplikacije UI na tržnici Microsoftova skupnost tehnikov Microsoft Marketplace Microsoft Power Platform Marketplace Rewards Visual Studio Podjetje Zaposlitev O Microsoftu Zasebnost pri Microsoftu Vlagatelji Trajnost Slovenščina (Slovenija) Ikona za zavrnitev sodelovanja pri možnostih glede zasebnosti Vaše možnosti glede zasebnosti Ikona za zavrnitev sodelovanja pri možnostih glede zasebnosti Vaše možnosti glede zasebnosti Zasebnost o zdravstvenem stanju potrošnikov Obrnite se na Microsoft Zasebnost Upravljanje piškotkov Pogoji za uporabo Blagovne znamke O naših oglasih EU Compliance DoCs © Microsoft 2026
2026-01-13T09:30:35
https://vml.visma.ai/login
About us Who are we? Learn more about Visma Machine Learning What we do Learn more about the products we offer What our customers say Read our customers' testimonials Products Autosuggest Automate your workflow Smartscan Extract data from your documents Resources Blog Product news and showcases Showcase of prototypes Prototypes, ideas and experiments Support Get started Find out more about onboarding to Visma Machine Learning FAQ We have answers to your frequently asked questions. Privacy policy Learn how we handle your data and protect your privacy Cookie policy Learn about how we use cookies to enhance your experience API Documentation Contact Us About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Showcase of prototypes Support Get started FAQ Privacy policy Cookie policy API Documentation Loading... Gærtorvet 1-5 1799 Copenhagen Denmark E-mail: worksmarter@visma.com About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Prototypes Documentation Support Get started FAQ Privacy policy Cookie policy Security Information Operating Status © 2026 Visma Group. All rights reserved Log in You need a Visma account to continue Sign in with Google
2026-01-13T09:30:35
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#with-s3-tutorial-create-policy
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:35
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#with-s3-tutorial-configure-s3-trigger
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:35
http://anh.cs.luc.edu/handsonPythonTutorial/float.html#precision-formats
1.14. Decimals, Floats, and Floating Point Arithmetic — Hands-on Python Tutorial for Python 3 Navigation index next | previous | Hands-on Python Tutorial » 1. Beginning With Python » 1.14. Decimals, Floats, and Floating Point Arithmetic ¶ Floating point numbers like 12.345 are a basic type, but there are some complications due to their inexactness. This section may be deferred until you actually need numbers other than integers. 1.14.1. Floats, Division, Mixed Types ¶ As you moved on in school from your first integer division to fractions and decimals, you probably thought of 6/8 as a fraction and could convert to a decimal .75. Python can do decimal calculations, too, approximately . Try all set-off lines in this section in the Shell : 6 / 8 6 / 3 2.3 / 25.7 There is more going on here than meets the eye. As you should know, decimal representations of values can be a pain. They may not be able to be expressed with a finite number of characters. Try 2 / 3 Also, as you may have had emphasized in science class, real number measurements are often not exact, and so the results of calculations with them are not exact. In fact there are an infinite number of real number just between 0 and 1, and a computer is finite. It cannot store all those numbers exactly! On the other hand, Python does store integers exactly (well at least far past the number of atoms in the universe - eventually even integers could get too big to store in a computer). The difference in the way integers and decimals are stored and processed leads to decimals and integers being different type s in Python. Try type ( 3.5 ) Note that 3.5 is of type ‘float’, not ‘decimal’. There are several reasons for that name having to do with the actual way the type is stored internally. “Decimal” implies base ten, our normal way for writing numbers with ten digits 0,1,2,3,4,5,6,7,8,9. Computers actually use base two, with only two symbols 0,1. (Did you note what symbols were in the machine language in Context ?) Also floats use an encoding something like scientific notation from science class, with exponents that allow the decimal point to move or “float”, as in the decimal case: 2345.6 = (2.3456)10 3 Try type ( - 2 ) type ( - 2.0 ) Even a number that is actually an integer can be represented in the float type if a decimal point is included. Always be sure to remember that floats may not be exact. The use of base two makes this true even in cases where decimal numbers can be expressed exactly! More on that in String Formats for Float Precision . It is sometimes important to know the numeric type of the result of a binary operation. Any combination of +, -, and * with operands of type int produces an int. If there is an operation /, or if either operand is of type float, the result is float. Try each in the Shell (and guess the resulting type): [1] 3.3 - 1.1 2.0 + 3 2 * 2.5 [1] Python 3 does what you would expect mathematically with an expression like (1/2)*6.5 Caution: This is not the case in other common languages like Java and C++ (or with Python 2). They treat the / operation with integers like the current Python //, so the result of the expression above is 0, since 1//2 is 0. 1.14.2. Exponentiation, Square Roots ¶ Exponentiation is finding powers. In mathematical notation, (3)(3)(3)(3)=3 4 . In Python there is no fancy typography with raised exponent symbols like the 4, so Python uses ** before a power: Try in the Shell : 3 ** 4 5 * 2 ** 3 If you expected 1000 for the second expression, remember exponentiation has even higher precedence than multiplication and division: 2**3 is 2*2*2 or 8, and 5*8 is 40. Exponents do not need to be integers. A useful example is the 0.5 power: it produces a square root. Try in the Shell : 9 **. 5 2 **. 5 The result of a power operation is of int type only if both parameters are integers and the correct result is an integer. 1.14.3. String Formats for Float Precision ¶ You generally do not want to display a floating point result of a calculation in its raw form, often with an enormous number of digits after the decimal point, like 23.457413902458498. You are likely to prefer rounding it to something like 23.46. There are two approaches. First there is a format function (not method) with a second parameter allowed to specialize the formatting of objects as strings. Read the following example interpreter sequence showing possibilities when a float is being formatted: >>> x = 23.457413902458498 >>> s = format ( x , '.5f' ) >>> s '23.45741' >>> format ( x , '.2f' ) '23.46' >>> x 23.457413902458498 Note that the results are rounded not truncated : the result to two places is 23.46, not 23.45. The formatting string '.5f' means round to 5 places after the decimal point. Similarly '.2f' means round to two decimal places. Warning This format function returns the formatted string. It does not change the parameters. As a complete statement in a program format(x, '.2f') , is useless: The '23.46' gets returned and thrown away , with no effect on x . The first version, saving the formatted value to s , will allow the formatted string to be used again (as s ). This rounding notation can also be placed after a colon inside the braces of format strings, for use with the string format method . You can put a colon : and the formatting information we used in the simple format method above (like .5f . but with NO quotes) Recall there are many ways to indicate what values to substitute into a format string. The first way introduced is just to omit any reference to the variables and substitute the method’s parameters in order as in: >>> x = 2.876543 >>> y = 16.3591 >>> 'x long: {:.5f}, x short: {:.3f}, y: {:.2f}.' . format ( x , x , y ) 'x long: 2.87654, x short: 2.877, y: 16.36.' The first part inside the formatting braces can also indicate what value to substitute, as when using a dictionary. >>> x = 2.876543 >>> 'long: {x:.5f}, short: {x:.3f}.' . format ( ** locals ()) 'long: 2.87654, short: 2.877.' The instructions for the data to insert can also be given by position index (from the optional end of String Format Operation ): >>> x = 2.876543 >>> 'longer: {0:.5f}, shorter: {0:.3f}.' . format ( x ) 'longer: 2.87654, shorter: 2.877.' In each of these approaches, the colon and formatting specification come at the end of the expression inside the braces, just before the closing } . This follows the { and symbols (if any) identifying what value to use for the substitution. There are many more fancy formatting options for the string format method that we will not discuss. Going to the opposite extreme, and using formatting with many digits, you can check that Python does not necessarily remember simple decimal numbers exactly: >>> format ( . 1 , '.20f' ) '0.10000000000000000555' >>> format ( . 2 , '.20f' ) '0.20000000000000001110' >>> format ( . 1 + . 2 , '.20f' ) '0.30000000000000004441' >>> format ( . 3 , '.20f' ) '0.29999999999999998890' Python stores the numbers correctly to about 16 or 17 digits. You may not care about such slight errors, but you will be able to check in Chapter 3 that if Python tests the expressions .1 + .2 and .3 for equality, it decides that they are not equal! In fact, as you can see above, the approximations that Python stores for the two expressions are not exactly equal. Warning Do not depend on the exactness of floating point arithmetic, even for apparently simple expressions! Floating point formatting code similar to this section is also in example program floatFormat.py . 1.14.3.1. Floating Point Exercise ¶ Write a program, discount.py , that prompts the user for an original price and for a discount percentage and prints out the new price to the nearest cent. For example if the user enters 2.89 for the price and 20 for the discount percentage, the value would be (1 - 20/100) * 2.89 rounded to two decimal places, 2.31. For price .65 with a 25 percent discount, the value would be (1 - 25/100) * .65 rounded to two decimal places, .49. [2] Write the general calculation code following the pattern of the calculations illustrated in the two concrete examples. [2] In Python 3.0+, the previous expressions make sense, but in earlier versions of Python and in other languages like C++ and Java, where there are not separate division operators // and /, these expressions would be wrong because of the multiple meanings of the operator / with different types. The expressions would work in these other languages if, for example, 100 were replaced by 100.0. Table Of Contents 1.14. Decimals, Floats, and Floating Point Arithmetic 1.14.1. Floats, Division, Mixed Types 1.14.2. Exponentiation, Square Roots 1.14.3. String Formats for Float Precision 1.14.3.1. Floating Point Exercise Previous topic 1.13. Loops and Sequences Next topic 1.15. Summary This Page Show Source Quick search Enter search terms or a module, class or function name. Navigation index next | previous | Hands-on Python Tutorial » 1. Beginning With Python » © Copyright 2019, Dr. Andrew N. Harrington. Last updated on Jan 05, 2020. Created using Sphinx 1.3.1+.
2026-01-13T09:30:35
http://anh.cs.luc.edu/handsonPythonTutorial/float.html#precision-formats
1.14. Decimals, Floats, and Floating Point Arithmetic — Hands-on Python Tutorial for Python 3 Navigation index next | previous | Hands-on Python Tutorial » 1. Beginning With Python » 1.14. Decimals, Floats, and Floating Point Arithmetic ¶ Floating point numbers like 12.345 are a basic type, but there are some complications due to their inexactness. This section may be deferred until you actually need numbers other than integers. 1.14.1. Floats, Division, Mixed Types ¶ As you moved on in school from your first integer division to fractions and decimals, you probably thought of 6/8 as a fraction and could convert to a decimal .75. Python can do decimal calculations, too, approximately . Try all set-off lines in this section in the Shell : 6 / 8 6 / 3 2.3 / 25.7 There is more going on here than meets the eye. As you should know, decimal representations of values can be a pain. They may not be able to be expressed with a finite number of characters. Try 2 / 3 Also, as you may have had emphasized in science class, real number measurements are often not exact, and so the results of calculations with them are not exact. In fact there are an infinite number of real number just between 0 and 1, and a computer is finite. It cannot store all those numbers exactly! On the other hand, Python does store integers exactly (well at least far past the number of atoms in the universe - eventually even integers could get too big to store in a computer). The difference in the way integers and decimals are stored and processed leads to decimals and integers being different type s in Python. Try type ( 3.5 ) Note that 3.5 is of type ‘float’, not ‘decimal’. There are several reasons for that name having to do with the actual way the type is stored internally. “Decimal” implies base ten, our normal way for writing numbers with ten digits 0,1,2,3,4,5,6,7,8,9. Computers actually use base two, with only two symbols 0,1. (Did you note what symbols were in the machine language in Context ?) Also floats use an encoding something like scientific notation from science class, with exponents that allow the decimal point to move or “float”, as in the decimal case: 2345.6 = (2.3456)10 3 Try type ( - 2 ) type ( - 2.0 ) Even a number that is actually an integer can be represented in the float type if a decimal point is included. Always be sure to remember that floats may not be exact. The use of base two makes this true even in cases where decimal numbers can be expressed exactly! More on that in String Formats for Float Precision . It is sometimes important to know the numeric type of the result of a binary operation. Any combination of +, -, and * with operands of type int produces an int. If there is an operation /, or if either operand is of type float, the result is float. Try each in the Shell (and guess the resulting type): [1] 3.3 - 1.1 2.0 + 3 2 * 2.5 [1] Python 3 does what you would expect mathematically with an expression like (1/2)*6.5 Caution: This is not the case in other common languages like Java and C++ (or with Python 2). They treat the / operation with integers like the current Python //, so the result of the expression above is 0, since 1//2 is 0. 1.14.2. Exponentiation, Square Roots ¶ Exponentiation is finding powers. In mathematical notation, (3)(3)(3)(3)=3 4 . In Python there is no fancy typography with raised exponent symbols like the 4, so Python uses ** before a power: Try in the Shell : 3 ** 4 5 * 2 ** 3 If you expected 1000 for the second expression, remember exponentiation has even higher precedence than multiplication and division: 2**3 is 2*2*2 or 8, and 5*8 is 40. Exponents do not need to be integers. A useful example is the 0.5 power: it produces a square root. Try in the Shell : 9 **. 5 2 **. 5 The result of a power operation is of int type only if both parameters are integers and the correct result is an integer. 1.14.3. String Formats for Float Precision ¶ You generally do not want to display a floating point result of a calculation in its raw form, often with an enormous number of digits after the decimal point, like 23.457413902458498. You are likely to prefer rounding it to something like 23.46. There are two approaches. First there is a format function (not method) with a second parameter allowed to specialize the formatting of objects as strings. Read the following example interpreter sequence showing possibilities when a float is being formatted: >>> x = 23.457413902458498 >>> s = format ( x , '.5f' ) >>> s '23.45741' >>> format ( x , '.2f' ) '23.46' >>> x 23.457413902458498 Note that the results are rounded not truncated : the result to two places is 23.46, not 23.45. The formatting string '.5f' means round to 5 places after the decimal point. Similarly '.2f' means round to two decimal places. Warning This format function returns the formatted string. It does not change the parameters. As a complete statement in a program format(x, '.2f') , is useless: The '23.46' gets returned and thrown away , with no effect on x . The first version, saving the formatted value to s , will allow the formatted string to be used again (as s ). This rounding notation can also be placed after a colon inside the braces of format strings, for use with the string format method . You can put a colon : and the formatting information we used in the simple format method above (like .5f . but with NO quotes) Recall there are many ways to indicate what values to substitute into a format string. The first way introduced is just to omit any reference to the variables and substitute the method’s parameters in order as in: >>> x = 2.876543 >>> y = 16.3591 >>> 'x long: {:.5f}, x short: {:.3f}, y: {:.2f}.' . format ( x , x , y ) 'x long: 2.87654, x short: 2.877, y: 16.36.' The first part inside the formatting braces can also indicate what value to substitute, as when using a dictionary. >>> x = 2.876543 >>> 'long: {x:.5f}, short: {x:.3f}.' . format ( ** locals ()) 'long: 2.87654, short: 2.877.' The instructions for the data to insert can also be given by position index (from the optional end of String Format Operation ): >>> x = 2.876543 >>> 'longer: {0:.5f}, shorter: {0:.3f}.' . format ( x ) 'longer: 2.87654, shorter: 2.877.' In each of these approaches, the colon and formatting specification come at the end of the expression inside the braces, just before the closing } . This follows the { and symbols (if any) identifying what value to use for the substitution. There are many more fancy formatting options for the string format method that we will not discuss. Going to the opposite extreme, and using formatting with many digits, you can check that Python does not necessarily remember simple decimal numbers exactly: >>> format ( . 1 , '.20f' ) '0.10000000000000000555' >>> format ( . 2 , '.20f' ) '0.20000000000000001110' >>> format ( . 1 + . 2 , '.20f' ) '0.30000000000000004441' >>> format ( . 3 , '.20f' ) '0.29999999999999998890' Python stores the numbers correctly to about 16 or 17 digits. You may not care about such slight errors, but you will be able to check in Chapter 3 that if Python tests the expressions .1 + .2 and .3 for equality, it decides that they are not equal! In fact, as you can see above, the approximations that Python stores for the two expressions are not exactly equal. Warning Do not depend on the exactness of floating point arithmetic, even for apparently simple expressions! Floating point formatting code similar to this section is also in example program floatFormat.py . 1.14.3.1. Floating Point Exercise ¶ Write a program, discount.py , that prompts the user for an original price and for a discount percentage and prints out the new price to the nearest cent. For example if the user enters 2.89 for the price and 20 for the discount percentage, the value would be (1 - 20/100) * 2.89 rounded to two decimal places, 2.31. For price .65 with a 25 percent discount, the value would be (1 - 25/100) * .65 rounded to two decimal places, .49. [2] Write the general calculation code following the pattern of the calculations illustrated in the two concrete examples. [2] In Python 3.0+, the previous expressions make sense, but in earlier versions of Python and in other languages like C++ and Java, where there are not separate division operators // and /, these expressions would be wrong because of the multiple meanings of the operator / with different types. The expressions would work in these other languages if, for example, 100 were replaced by 100.0. Table Of Contents 1.14. Decimals, Floats, and Floating Point Arithmetic 1.14.1. Floats, Division, Mixed Types 1.14.2. Exponentiation, Square Roots 1.14.3. String Formats for Float Precision 1.14.3.1. Floating Point Exercise Previous topic 1.13. Loops and Sequences Next topic 1.15. Summary This Page Show Source Quick search Enter search terms or a module, class or function name. Navigation index next | previous | Hands-on Python Tutorial » 1. Beginning With Python » © Copyright 2019, Dr. Andrew N. Harrington. Last updated on Jan 05, 2020. Created using Sphinx 1.3.1+.
2026-01-13T09:30:35
https://docs.aws.amazon.com/zh_cn/lambda/latest/dg/lambda-api-permissions-ref.html
微调策略的“资源和条件”部分 - AWS Lambda 微调策略的“资源和条件”部分 - AWS Lambda 文档 AWS Lambda 开发人员指南 了解策略中的“条件”部分 在策略的“资源”部分中引用函数 支持的 IAM 操作及函数行为 微调策略的“资源和条件”部分 您可以通过在 AWS Identity and Access Management (IAM) 策略中指定资源和条件来限制用户权限的范围。策略中的每个操作都支持资源和条件类型的组合,这些类型根据操作的行为而有所不同。 每条 IAM 策略语句为对一个资源执行的一个操作授予权限。如果操作不对指定资源执行操作,或者您授予对所有资源执行操作的权限,则策略中资源的值为通配符( * )。对于许多操作,可以通过指定资源的 Amazon 资源名称(ARN)或与多个资源匹配的 ARN 模式来限制用户可修改的资源。 按资源类型划分,限制操作范围的一般设计如下: 函数 – 对函数进行的操作可以通过函数、版本或别名 ARN 限制到特定函数上。 事件源映射 – 可以通过 ARN 将操作限制到特定的事件源映射资源上。事件源映射始终与函数相关联,所以也可以使用 lambda:FunctionArn 条件来限制关联函数的操作。 层 – 与层使用和权限相关的操作作用于层的版本。 代码签名配置 – 可以通过 ARN 将操作限制到特定的代码签名配置资源上。 标签 – 使用标准标签条件。有关更多信息,请参阅 在 Lambda 中使用基于属性的访问控制 。 要按资源限制权限,请指定资源的 ARN。 Lambda 资源 ARN 格式 函数 – arn:aws:lambda: us-west-2 : 123456789012 :function: my-function 函数版本 – arn:aws:lambda: us-west-2 : 123456789012 :function: my-function : 1 函数别名 – arn:aws:lambda: us-west-2 : 123456789012 :function: my-function : TEST 事件源映射 – arn:aws:lambda: us-west-2 : 123456789012 :event-source-mapping: fa123456-14a1-4fd2-9fec-83de64ad683de6d47 层 – arn:aws:lambda: us-west-2 : 123456789012 :layer: my-layer 层版本 – arn:aws:lambda: us-west-2 : 123456789012 :layer: my-layer : 1 代码签名配置 – arn:aws:lambda: us-west-2 : 123456789012 :code-signing-config: my-csc 例如,以下策略允许 AWS 账户 123456789012 中的用户调用美国西部(俄勒冈)AWS 区域中名为 my-function 的函数。 例 调用函数策略 JSON { "Version":"2012-10-17", "Statement": [ { "Sid": "Invoke", "Effect": "Allow", "Action": [ "lambda:InvokeFunction" ], "Resource": "arn:aws:lambda:us-west-2:123456789012:function: my-function " } ] } 这是一种特殊情形,其中,操作标识符 ( lambda:InvokeFunction ) 不同于 API 操作 ( Invoke )。对于其他操作,操作标识符为操作名称加上 lambda: 前缀。 各个部分 了解策略中的“条件”部分 在策略的“资源”部分中引用函数 支持的 IAM 操作及函数行为 了解策略中的“条件”部分 条件是可选的策略元素,它应用其他逻辑来确定是否允许执行操作。除了所有操作支持的公用 条件 之外,Lambda 定义了一些条件类型,您可以用来限制某些操作的额外参数的值。 例如, lambda:Principal 条件允许您限制用户可以根据函数的 基于资源的策略 授予调用访问权限的服务或账户。以下策略允许用户授予对 Amazon Simple Notification Service (Amazon SNS) 主题的权限,以调用名为 test 的函数。 例 管理函数策略权限 JSON { "Version":"2012-10-17", "Statement": [ { "Sid": "ManageFunctionPolicy", "Effect": "Allow", "Action": [ "lambda:AddPermission", "lambda:RemovePermission" ], "Resource": "arn:aws:lambda:us-west-2:123456789012:function:test:*", "Condition": { "StringEquals": { "lambda:Principal": "sns.amazonaws.com" } } } ] } 该条件要求委托人是 Amazon SNS 而不是其他服务或账户。资源模式要求函数名称为 test 并包含版本号或别名。例如 test:v1 。 有关 Lambda 和其他 AWS 服务的资源和条件的更多信息,请参阅 服务授权参考 中的 AWS 服务的操作、资源和条件键 。 在策略的“资源”部分中引用函数 您可以使用 Amazon Resource Name(ARN)在策略语句中引用 Lambda 函数。函数 ARN 的格式取决于您是要引用整个函数(无限定)、某个函数 版本 ,还是 别名 (限定)。 调用 Lambda API 时,用户可以通过在 GetFunction FunctionName 参数中传递版本 ARN 或别名 ARN,或者通过在 GetFunction Qualifier 参数中设置值,来指定一个版本或别名。Lambda 通过比较 IAM 策略中的资源元素与在 API 调用中传递的 FunctionName 和 Qualifier 来做出授权决策。如果不匹配,Lambda 会拒绝该请求。 无论您是允许还是拒绝某个函数操作,都必须在策略声明中使用正确的函数 ARN 类型才能获得预期的结果。例如,假设您的策略引用了非限定 ARN,Lambda 会接受引用非限定 ARN 的请求,但拒绝引用限定 ARN 的请求。 注意 不能使用通配符 (*) 匹配账户 ID。有关接受的语法的更多信息,请参阅《 IAM 用户指南 》中的 IAM JSON 策略参考 。 例 允许调用非限定 ARN JSON { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "lambda:InvokeFunction", "Resource": "arn:aws:lambda:us-west-2:123456789012:function:myFunction" } ] } 如果您的策略引用了特定的限定 ARN,Lambda 会接受引用该 ARN 的请求,但拒绝引用非限定 ARN 的请求(例如 myFunction:2 )。 例 允许调用特定的限定 ARN JSON { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "lambda:InvokeFunction", "Resource": "arn:aws:lambda:us-west-2:123456789012:function:myFunction:1" } ] } 如果您的策略引用了任何限定 ARN :* ,Lambda 会接受任何限定 ARN,但拒绝引用非限定 ARN 的请求。 例 允许调用任何限定 ARN JSON { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "lambda:InvokeFunction", "Resource": "arn:aws:lambda:us-west-2:123456789012:function:myFunction:*" } ] } 如果您的策略引用了任何使用 * 的 ARN,Lambda 会接受任何限定或非限定 ARN。 例 允许调用任何限定或非限定 ARN JSON { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "lambda:InvokeFunction", "Resource": "arn:aws:lambda:us-west-2:123456789012:function:myFunction*" } ] } 支持的 IAM 操作及函数行为 操作定义了可通过 IAM 策略允许的内容。有关 Lambda 中支持的操作列表,请参阅《Service Authorization Reference》中的 Actions, resources, and condition keys for AWS Lambda 。在大多数情况下,如果 IAM 操作允许 Lambda API 操作,则 IAM 操作的名称与 Lambda API 操作的名称相同,但以下情况除外: API 操作 IAM 操作 调用 lambda:InvokeFunction GetLayerVersion GetLayerVersionByArn lambda:GetLayerVersion 除了 《Service Authorization Reference》 中定义的资源和条件,Lambda 还支持某些操作的以下资源和条件。其中许多资源和条件与策略“资源”部分中的引用函数有关。对函数进行的操作可以通过函数、版本或别名 ARN 限制为特定函数,如下表中所述。 操作 资源 Condition AddPermission RemovePermission 调用 ( 权限: lambda:InvokeFunction ) 函数版本 函数别名 不适用 UpdateFunctionConfiguration 不适用 lambda:CodeSigningConfigArn CreateFunctionUrlConfig DeleteFunctionUrlConfig GetFunctionUrlConfig UpdateFunctionUrlConfig 函数别名 不适用 Javascript 在您的浏览器中被禁用或不可用。 要使用 Amazon Web Services 文档,必须启用 Javascript。请参阅浏览器的帮助页面以了解相关说明。 文档惯例 通过标签保护函数 安全性、治理与合规性 此页面对您有帮助吗?- 是 感谢您对我们工作的肯定! 如果不耽误您的时间,请告诉我们做得好的地方,让我们做得更好。 此页面对您有帮助吗?- 否 感谢您告诉我们本页内容还需要完善。很抱歉让您失望了。 如果不耽误您的时间,请告诉我们如何改进文档。
2026-01-13T09:30:35
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#with-s3-tutorial-dummy-test
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:35
https://bifromq.apache.org/docs/installation/intro/#__docusaurus_skipToContent_fallback
Installation Overview | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ Next (Incubating) Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation Docker Linux Windows Install from Source Configuration Convention & Migration Notes on Kubernetes Deployment BifroMQ Cluster User Guide Plugin Administration Benchmark Contribution Installation Version: Next (Incubating) On this page Installation Overview Prerequisites ​ BifroMQ requires Java 17 or higher for its operation. Ensure your Java runtime environment is updated to meet these requirements before proceeding with the BifroMQ installation. Installation Directory Structure ​ Upon installation, BifroMQ organizes its files within the following directory structure: Directory Description bin Executable scripts for starting and managing BifroMQ. conf Configuration files necessary for customizing BifroMQ operations. lib Program libs for running BifroMQ. plugins BifroMQ plugins in pf4j compatible format. data User's persistent data. logs Log files. Running BifroMQ ​ The startup script for BifroMQ recognizes several environment variables that allow for customization and optimization of its runtime environment: Environment Variable Description LOG_DIR Specifies the directory where BifroMQ should store its log files. Defaults to ./logs if unset. DATA_DIR Determines the directory for storing BifroMQ data. Defaults to ./data if unset. JAVA_HOME Specifies the path to the Java Runtime Environment (JRE) that BifroMQ should use. MEM_LIMIT Limits the maximum amount of memory that BifroMQ can use. JVM_PERF_OPTS Custom JVM performance options for tuning the JVM instance running BifroMQ. JVM_GC_OPTS Garbage Collection (GC) options to optimize memory management for BifroMQ. JVM_HEAP_OPTS Specifies JVM heap size and other memory settings directly impacting BifroMQ's performance. EXTRA_JVM_OPTS Additional JVM options that users may want to pass to customize the BifroMQ runtime environment. JVM_DEBUG Enables debugging options for the JVM, useful for development and troubleshooting. JAVA_DEBUG_PORT When JVM_DEBUG is enabled, sets the port for the JVM debugger to attach to. Edit this page Previous Road Map Next Docker Prerequisites Installation Directory Structure Running BifroMQ Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:35
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#with-s3-tutorial-create-execution-role
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:35
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#with-s3-tutorial-create-function-createfunction
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:35
https://bifromq.apache.org/docs/installation/intro/#prerequisites
Installation Overview | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ Next (Incubating) Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation Docker Linux Windows Install from Source Configuration Convention & Migration Notes on Kubernetes Deployment BifroMQ Cluster User Guide Plugin Administration Benchmark Contribution Installation Version: Next (Incubating) On this page Installation Overview Prerequisites ​ BifroMQ requires Java 17 or higher for its operation. Ensure your Java runtime environment is updated to meet these requirements before proceeding with the BifroMQ installation. Installation Directory Structure ​ Upon installation, BifroMQ organizes its files within the following directory structure: Directory Description bin Executable scripts for starting and managing BifroMQ. conf Configuration files necessary for customizing BifroMQ operations. lib Program libs for running BifroMQ. plugins BifroMQ plugins in pf4j compatible format. data User's persistent data. logs Log files. Running BifroMQ ​ The startup script for BifroMQ recognizes several environment variables that allow for customization and optimization of its runtime environment: Environment Variable Description LOG_DIR Specifies the directory where BifroMQ should store its log files. Defaults to ./logs if unset. DATA_DIR Determines the directory for storing BifroMQ data. Defaults to ./data if unset. JAVA_HOME Specifies the path to the Java Runtime Environment (JRE) that BifroMQ should use. MEM_LIMIT Limits the maximum amount of memory that BifroMQ can use. JVM_PERF_OPTS Custom JVM performance options for tuning the JVM instance running BifroMQ. JVM_GC_OPTS Garbage Collection (GC) options to optimize memory management for BifroMQ. JVM_HEAP_OPTS Specifies JVM heap size and other memory settings directly impacting BifroMQ's performance. EXTRA_JVM_OPTS Additional JVM options that users may want to pass to customize the BifroMQ runtime environment. JVM_DEBUG Enables debugging options for the JVM, useful for development and troubleshooting. JAVA_DEBUG_PORT When JVM_DEBUG is enabled, sets the port for the JVM debugger to attach to. Edit this page Previous Road Map Next Docker Prerequisites Installation Directory Structure Running BifroMQ Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:35
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#with-s3-example-prereqs
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:35
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/put-bucket-notification-configuration.html
put-bucket-notification-configuration — AWS CLI 2.32.33 Command Reference AWS CLI Command Reference Home User Guide Forum GitHub Navigation index next | previous | AWS CLI 2.32.33 Command Reference » aws » s3api » put-bucket-notification-configuration ← put-bucket-metrics-configuration / put-bucket-ownership-controls → Table of Contents put-bucket-notification-configuration Description Synopsis Options Global Options Examples Output Quick search Search box Search Feedback Did you find this page useful? Do you have a suggestion to improve the documentation? Give us feedback . If you would like to suggest an improvement or fix for the AWS CLI, check out our contributing guide on GitHub. User Guide First time using the AWS CLI? See the User Guide for help getting started. [ aws . s3api ] put-bucket-notification-configuration ¶ Description ¶ Note This operation is not supported for directory buckets. Enables notifications of specified events for a bucket. For more information about event notifications, see Configuring Event Notifications . Using this API, you can replace an existing notification configuration. The configuration is an XML file that defines the event types that you want Amazon S3 to publish and the destination where you want Amazon S3 to publish an event notification when it detects an event of the specified type. By default, your bucket has no event notifications configured. That is, the notification configuration will be an empty NotificationConfiguration . <NotificationConfiguration> </NotificationConfiguration> This action replaces the existing notification configuration with the configuration you include in the request body. After Amazon S3 receives this request, it first verifies that any Amazon Simple Notification Service (Amazon SNS) or Amazon Simple Queue Service (Amazon SQS) destination exists, and that the bucket owner has permission to publish to it by sending a test notification. In the case of Lambda destinations, Amazon S3 verifies that the Lambda function permissions grant Amazon S3 permission to invoke the function from the Amazon S3 bucket. For more information, see Configuring Notifications for Amazon S3 Events . You can disable notifications by adding the empty NotificationConfiguration element. For more information about the number of event notification configurations that you can create per bucket, see Amazon S3 service quotas in Amazon Web Services General Reference . By default, only the bucket owner can configure notifications on a bucket. However, bucket owners can use a bucket policy to grant permission to other users to set this configuration with the required s3:PutBucketNotification permission. Note The PUT notification is an atomic operation. For example, suppose your notification configuration includes SNS topic, SQS queue, and Lambda function configurations. When you send a PUT request with this configuration, Amazon S3 sends test messages to your SNS topic. If the message fails, the entire PUT action will fail, and Amazon S3 will not add the configuration to your bucket. If the configuration in the request body includes only one TopicConfiguration specifying only the s3:ReducedRedundancyLostObject event type, the response will also include the x-amz-sns-test-message-id header containing the message ID of the test notification sent to the topic. The following action is related to PutBucketNotificationConfiguration : GetBucketNotificationConfiguration Warning You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt , containing two spaces after my , you must URL encode this value to my%20%20file.txt . See also: AWS API Documentation Synopsis ¶ put - bucket - notification - configuration -- bucket < value > -- notification - configuration < value > [ -- expected - bucket - owner < value > ] [ -- skip - destination - validation | -- no - skip - destination - validation ] [ -- cli - input - json | -- cli - input - yaml ] [ -- generate - cli - skeleton < value > ] [ -- debug ] [ -- endpoint - url < value > ] [ -- no - verify - ssl ] [ -- no - paginate ] [ -- output < value > ] [ -- query < value > ] [ -- profile < value > ] [ -- region < value > ] [ -- version < value > ] [ -- color < value > ] [ -- no - sign - request ] [ -- ca - bundle < value > ] [ -- cli - read - timeout < value > ] [ -- cli - connect - timeout < value > ] [ -- cli - binary - format < value > ] [ -- no - cli - pager ] [ -- cli - auto - prompt ] [ -- no - cli - auto - prompt ] Options ¶ --bucket (string) [required] The name of the bucket. --notification-configuration (structure) [required] A container for specifying the notification configuration of the bucket. If this element is empty, notifications are turned off for the bucket. TopicConfigurations -> (list) The topic to which notifications are sent and the events for which notifications are generated. (structure) A container for specifying the configuration for publication of messages to an Amazon Simple Notification Service (Amazon SNS) topic when Amazon S3 detects specified events. Id -> (string) An optional unique identifier for configurations in a notification configuration. If you don’t provide one, Amazon S3 will assign an ID. TopicArn -> (string) [required] The Amazon Resource Name (ARN) of the Amazon SNS topic to which Amazon S3 publishes a message when it detects events of the specified type. Events -> (list) [required] The Amazon S3 bucket event about which to send notifications. For more information, see Supported Event Types in the Amazon S3 User Guide . (string) The bucket event for which to send notifications. Possible values: s3:ReducedRedundancyLostObject s3:ObjectCreated:* s3:ObjectCreated:Put s3:ObjectCreated:Post s3:ObjectCreated:Copy s3:ObjectCreated:CompleteMultipartUpload s3:ObjectRemoved:* s3:ObjectRemoved:Delete s3:ObjectRemoved:DeleteMarkerCreated s3:ObjectRestore:* s3:ObjectRestore:Post s3:ObjectRestore:Completed s3:Replication:* s3:Replication:OperationFailedReplication s3:Replication:OperationNotTracked s3:Replication:OperationMissedThreshold s3:Replication:OperationReplicatedAfterThreshold s3:ObjectRestore:Delete s3:LifecycleTransition s3:IntelligentTiering s3:ObjectAcl:Put s3:LifecycleExpiration:* s3:LifecycleExpiration:Delete s3:LifecycleExpiration:DeleteMarkerCreated s3:ObjectTagging:* s3:ObjectTagging:Put s3:ObjectTagging:Delete Filter -> (structure) Specifies object key name filtering rules. For information about key name filtering, see Configuring event notifications using object key name filtering in the Amazon S3 User Guide . Key -> (structure) A container for object key name prefix and suffix filtering rules. FilterRules -> (list) A list of containers for the key-value pair that defines the criteria for the filter rule. (structure) Specifies the Amazon S3 object key name to filter on. An object key name is the name assigned to an object in your Amazon S3 bucket. You specify whether to filter on the suffix or prefix of the object key name. A prefix is a specific string of characters at the beginning of an object key name, which you can use to organize objects. For example, you can start the key names of related objects with a prefix, such as 2023- or engineering/ . Then, you can use FilterRule to find objects in a bucket with key names that have the same prefix. A suffix is similar to a prefix, but it is at the end of the object key name instead of at the beginning. Name -> (string) The object key name prefix or suffix identifying one or more objects to which the filtering rule applies. The maximum length is 1,024 characters. Overlapping prefixes and suffixes are not supported. For more information, see Configuring Event Notifications in the Amazon S3 User Guide . Possible values: prefix suffix Value -> (string) The value that the filter searches for in object key names. QueueConfigurations -> (list) The Amazon Simple Queue Service queues to publish messages to and the events for which to publish messages. (structure) Specifies the configuration for publishing messages to an Amazon Simple Queue Service (Amazon SQS) queue when Amazon S3 detects specified events. Id -> (string) An optional unique identifier for configurations in a notification configuration. If you don’t provide one, Amazon S3 will assign an ID. QueueArn -> (string) [required] The Amazon Resource Name (ARN) of the Amazon SQS queue to which Amazon S3 publishes a message when it detects events of the specified type. Events -> (list) [required] A collection of bucket events for which to send notifications (string) The bucket event for which to send notifications. Possible values: s3:ReducedRedundancyLostObject s3:ObjectCreated:* s3:ObjectCreated:Put s3:ObjectCreated:Post s3:ObjectCreated:Copy s3:ObjectCreated:CompleteMultipartUpload s3:ObjectRemoved:* s3:ObjectRemoved:Delete s3:ObjectRemoved:DeleteMarkerCreated s3:ObjectRestore:* s3:ObjectRestore:Post s3:ObjectRestore:Completed s3:Replication:* s3:Replication:OperationFailedReplication s3:Replication:OperationNotTracked s3:Replication:OperationMissedThreshold s3:Replication:OperationReplicatedAfterThreshold s3:ObjectRestore:Delete s3:LifecycleTransition s3:IntelligentTiering s3:ObjectAcl:Put s3:LifecycleExpiration:* s3:LifecycleExpiration:Delete s3:LifecycleExpiration:DeleteMarkerCreated s3:ObjectTagging:* s3:ObjectTagging:Put s3:ObjectTagging:Delete Filter -> (structure) Specifies object key name filtering rules. For information about key name filtering, see Configuring event notifications using object key name filtering in the Amazon S3 User Guide . Key -> (structure) A container for object key name prefix and suffix filtering rules. FilterRules -> (list) A list of containers for the key-value pair that defines the criteria for the filter rule. (structure) Specifies the Amazon S3 object key name to filter on. An object key name is the name assigned to an object in your Amazon S3 bucket. You specify whether to filter on the suffix or prefix of the object key name. A prefix is a specific string of characters at the beginning of an object key name, which you can use to organize objects. For example, you can start the key names of related objects with a prefix, such as 2023- or engineering/ . Then, you can use FilterRule to find objects in a bucket with key names that have the same prefix. A suffix is similar to a prefix, but it is at the end of the object key name instead of at the beginning. Name -> (string) The object key name prefix or suffix identifying one or more objects to which the filtering rule applies. The maximum length is 1,024 characters. Overlapping prefixes and suffixes are not supported. For more information, see Configuring Event Notifications in the Amazon S3 User Guide . Possible values: prefix suffix Value -> (string) The value that the filter searches for in object key names. LambdaFunctionConfigurations -> (list) Describes the Lambda functions to invoke and the events for which to invoke them. (structure) A container for specifying the configuration for Lambda notifications. Id -> (string) An optional unique identifier for configurations in a notification configuration. If you don’t provide one, Amazon S3 will assign an ID. LambdaFunctionArn -> (string) [required] The Amazon Resource Name (ARN) of the Lambda function that Amazon S3 invokes when the specified event type occurs. Events -> (list) [required] The Amazon S3 bucket event for which to invoke the Lambda function. For more information, see Supported Event Types in the Amazon S3 User Guide . (string) The bucket event for which to send notifications. Possible values: s3:ReducedRedundancyLostObject s3:ObjectCreated:* s3:ObjectCreated:Put s3:ObjectCreated:Post s3:ObjectCreated:Copy s3:ObjectCreated:CompleteMultipartUpload s3:ObjectRemoved:* s3:ObjectRemoved:Delete s3:ObjectRemoved:DeleteMarkerCreated s3:ObjectRestore:* s3:ObjectRestore:Post s3:ObjectRestore:Completed s3:Replication:* s3:Replication:OperationFailedReplication s3:Replication:OperationNotTracked s3:Replication:OperationMissedThreshold s3:Replication:OperationReplicatedAfterThreshold s3:ObjectRestore:Delete s3:LifecycleTransition s3:IntelligentTiering s3:ObjectAcl:Put s3:LifecycleExpiration:* s3:LifecycleExpiration:Delete s3:LifecycleExpiration:DeleteMarkerCreated s3:ObjectTagging:* s3:ObjectTagging:Put s3:ObjectTagging:Delete Filter -> (structure) Specifies object key name filtering rules. For information about key name filtering, see Configuring event notifications using object key name filtering in the Amazon S3 User Guide . Key -> (structure) A container for object key name prefix and suffix filtering rules. FilterRules -> (list) A list of containers for the key-value pair that defines the criteria for the filter rule. (structure) Specifies the Amazon S3 object key name to filter on. An object key name is the name assigned to an object in your Amazon S3 bucket. You specify whether to filter on the suffix or prefix of the object key name. A prefix is a specific string of characters at the beginning of an object key name, which you can use to organize objects. For example, you can start the key names of related objects with a prefix, such as 2023- or engineering/ . Then, you can use FilterRule to find objects in a bucket with key names that have the same prefix. A suffix is similar to a prefix, but it is at the end of the object key name instead of at the beginning. Name -> (string) The object key name prefix or suffix identifying one or more objects to which the filtering rule applies. The maximum length is 1,024 characters. Overlapping prefixes and suffixes are not supported. For more information, see Configuring Event Notifications in the Amazon S3 User Guide . Possible values: prefix suffix Value -> (string) The value that the filter searches for in object key names. EventBridgeConfiguration -> (structure) Enables delivery of events to Amazon EventBridge. JSON Syntax: { "TopicConfigurations" : [ { "Id" : "string" , "TopicArn" : "string" , "Events" : [ "s3:ReducedRedundancyLostObject" | "s3:ObjectCreated:*" | "s3:ObjectCreated:Put" | "s3:ObjectCreated:Post" | "s3:ObjectCreated:Copy" | "s3:ObjectCreated:CompleteMultipartUpload" | "s3:ObjectRemoved:*" | "s3:ObjectRemoved:Delete" | "s3:ObjectRemoved:DeleteMarkerCreated" | "s3:ObjectRestore:*" | "s3:ObjectRestore:Post" | "s3:ObjectRestore:Completed" | "s3:Replication:*" | "s3:Replication:OperationFailedReplication" | "s3:Replication:OperationNotTracked" | "s3:Replication:OperationMissedThreshold" | "s3:Replication:OperationReplicatedAfterThreshold" | "s3:ObjectRestore:Delete" | "s3:LifecycleTransition" | "s3:IntelligentTiering" | "s3:ObjectAcl:Put" | "s3:LifecycleExpiration:*" | "s3:LifecycleExpiration:Delete" | "s3:LifecycleExpiration:DeleteMarkerCreated" | "s3:ObjectTagging:*" | "s3:ObjectTagging:Put" | "s3:ObjectTagging:Delete" , ... ], "Filter" : { "Key" : { "FilterRules" : [ { "Name" : "prefix" | "suffix" , "Value" : "string" } ... ] } } } ... ], "QueueConfigurations" : [ { "Id" : "string" , "QueueArn" : "string" , "Events" : [ "s3:ReducedRedundancyLostObject" | "s3:ObjectCreated:*" | "s3:ObjectCreated:Put" | "s3:ObjectCreated:Post" | "s3:ObjectCreated:Copy" | "s3:ObjectCreated:CompleteMultipartUpload" | "s3:ObjectRemoved:*" | "s3:ObjectRemoved:Delete" | "s3:ObjectRemoved:DeleteMarkerCreated" | "s3:ObjectRestore:*" | "s3:ObjectRestore:Post" | "s3:ObjectRestore:Completed" | "s3:Replication:*" | "s3:Replication:OperationFailedReplication" | "s3:Replication:OperationNotTracked" | "s3:Replication:OperationMissedThreshold" | "s3:Replication:OperationReplicatedAfterThreshold" | "s3:ObjectRestore:Delete" | "s3:LifecycleTransition" | "s3:IntelligentTiering" | "s3:ObjectAcl:Put" | "s3:LifecycleExpiration:*" | "s3:LifecycleExpiration:Delete" | "s3:LifecycleExpiration:DeleteMarkerCreated" | "s3:ObjectTagging:*" | "s3:ObjectTagging:Put" | "s3:ObjectTagging:Delete" , ... ], "Filter" : { "Key" : { "FilterRules" : [ { "Name" : "prefix" | "suffix" , "Value" : "string" } ... ] } } } ... ], "LambdaFunctionConfigurations" : [ { "Id" : "string" , "LambdaFunctionArn" : "string" , "Events" : [ "s3:ReducedRedundancyLostObject" | "s3:ObjectCreated:*" | "s3:ObjectCreated:Put" | "s3:ObjectCreated:Post" | "s3:ObjectCreated:Copy" | "s3:ObjectCreated:CompleteMultipartUpload" | "s3:ObjectRemoved:*" | "s3:ObjectRemoved:Delete" | "s3:ObjectRemoved:DeleteMarkerCreated" | "s3:ObjectRestore:*" | "s3:ObjectRestore:Post" | "s3:ObjectRestore:Completed" | "s3:Replication:*" | "s3:Replication:OperationFailedReplication" | "s3:Replication:OperationNotTracked" | "s3:Replication:OperationMissedThreshold" | "s3:Replication:OperationReplicatedAfterThreshold" | "s3:ObjectRestore:Delete" | "s3:LifecycleTransition" | "s3:IntelligentTiering" | "s3:ObjectAcl:Put" | "s3:LifecycleExpiration:*" | "s3:LifecycleExpiration:Delete" | "s3:LifecycleExpiration:DeleteMarkerCreated" | "s3:ObjectTagging:*" | "s3:ObjectTagging:Put" | "s3:ObjectTagging:Delete" , ... ], "Filter" : { "Key" : { "FilterRules" : [ { "Name" : "prefix" | "suffix" , "Value" : "string" } ... ] } } } ... ], "EventBridgeConfiguration" : { } } --expected-bucket-owner (string) The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied). --skip-destination-validation | --no-skip-destination-validation (boolean) Skips validation of Amazon SQS, Amazon SNS, and Lambda destinations. True or false value. --cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton . If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml . --generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input , prints a sample input JSON that can be used as an argument for --cli-input-json . Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml . If provided with the value output , it validates the command inputs and returns a sample output JSON for that command. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated. Global Options ¶ --debug (boolean) Turn on debug logging. --endpoint-url (string) Override command’s default URL with the given URL. --no-verify-ssl (boolean) By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates. --no-paginate (boolean) Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results. --output (string) The formatting style for command output. json text table yaml yaml-stream --query (string) A JMESPath query to use in filtering the response data. --profile (string) Use a specific profile from your credential file. --region (string) The region to use. Overrides config/env settings. --version (string) Display the version of this tool. --color (string) Turn on/off color output. on off auto --no-sign-request (boolean) Do not sign requests. Credentials will not be loaded if this argument is provided. --ca-bundle (string) The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings. --cli-read-timeout (int) The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds. --cli-connect-timeout (int) The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds. --cli-binary-format (string) The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format . base64 raw-in-base64-out --no-cli-pager (boolean) Disable cli pager for output. --cli-auto-prompt (boolean) Automatically prompt for CLI input parameters. --no-cli-auto-prompt (boolean) Disable automatically prompt for CLI input parameters. Examples ¶ Note To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information. Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal’s quoting rules. See Using quotation marks with strings in the AWS CLI User Guide . To enable the specified notifications to a bucket The following put-bucket-notification-configuration example applies a notification configuration to a bucket named amzn-s3-demo-bucket . The file notification.json is a JSON document in the current folder that specifies an SNS topic and an event type to monitor. aws s3api put - bucket - notification - configuration \ -- bucket amzn - s3 - demo - bucket \ -- notification - configuration file : // notification . json Contents of notification.json : { "TopicConfigurations" : [ { "TopicArn" : "arn:aws:sns:us-west-2:123456789012:s3-notification-topic" , "Events" : [ "s3:ObjectCreated:*" ] } ] } The SNS topic must have an IAM policy attached to it that allows Amazon S3 to publish to it. { "Version" : "2008-10-17" , "Id" : "example-ID" , "Statement" : [ { "Sid" : "example-statement-ID" , "Effect" : "Allow" , "Principal" : { "Service" : "s3.amazonaws.com" }, "Action" : [ "SNS:Publish" ], "Resource" : "arn:aws:sns:us-west-2:123456789012::s3-notification-topic" , "Condition" : { "ArnLike" : { "aws:SourceArn" : "arn:aws:s3:*:*:amzn-s3-demo-bucket" } } } ] } Output ¶ None ← put-bucket-metrics-configuration / put-bucket-ownership-controls → Navigation index next | previous | AWS CLI 2.32.33 Command Reference » aws » s3api » put-bucket-notification-configuration © Copyright 2026, Amazon Web Services. Created using Sphinx .
2026-01-13T09:30:35
https://facebook.com/pastebin
Facebook Facebook 이메일 또는 휴대폰 비밀번호 계정을 잊으셨나요? 새 계정 만들기 일시적으로 차단됨 일시적으로 차단됨 회원님의 이 기능 사용 속도가 너무 빠른 것 같습니다. 이 기능 사용에서 일시적으로 차단되었습니다. Back 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) 日本語 Português (Brasil) Français (France) Deutsch 가입하기 로그인 Messenger Facebook Lite 동영상 Meta Pay Meta 스토어 Meta Quest Ray-Ban Meta Meta AI Meta AI 콘텐츠 더 보기 Instagram Threads 투표 정보 센터 개인정보처리방침 개인정보 보호 센터 정보 광고 만들기 페이지 만들기 개발자 채용 정보 쿠키 AdChoices 이용 약관 고객 센터 연락처 업로드 및 비사용자 설정 활동 로그 Meta © 2026
2026-01-13T09:30:35
http://anh.cs.luc.edu/handsonPythonTutorial/strings3.html#string-slices
2.1. Strings, Part III — Hands-on Python Tutorial for Python 3 Navigation index next | previous | Hands-on Python Tutorial » 2. Objects and Methods » 2.1. Strings, Part III ¶ 2.1.1. Object Orientation ¶ Python is an object-oriented language. Every piece of data and even functions and types are objects. The term object-oriented is used to distinguish Python from earlier languages, classified as procedural languages, where types of data and the operations on them were not connected in the language. The functions we have used so far follow the older procedural programming syntax. In the newer paradigm of object-oriented programming, all data are in objects, and a core group of operations that can be done on some particular type of object are tightly bound to the object and called the object’s methods . For example, strings are objects, and strings “know how” to produce an uppercase version of themselves. Try in the Shell : s = 'Hello!' s . upper () Here upper is a method associated with strings. This means upper is a function that is bound to the string before the dot. This function is bound both logically, and as we see in the new notation, also syntactically. One way to think about it is that each type of data knows operations (methods) that can be applied to it. The expression s.upper() calls the method upper that is bound to the string s and returns a new uppercase string result based on s . Strings are immutable, so no string method can change the original string, it can only return a new string. Confirm this by entering each line individually in the Shell to see the original s is unchanged: s s2 = s . upper () s2 s We are using the new object syntax: object . method ( ) meaning that the method associated with the object’s type is applied to the object . This is just a special syntax for a function call with an object. Another string method is lower , analogous to upper, but producing a lowercase result. Test yourself : How would you write the expression to produce a lowercase version of the string s ? Answer: [1] Try it in the Shell . Test yourself in the Shell : How would you use this string s and both the lower and upper methods to create the string 'hello!HELLO!' ? Hint: [2] Answer: [3] Many methods also take additional parameters between the parentheses, using the more general syntax: object . method ( parameters ) The first of many such methods we will introduce is count : Syntax for count : s .count( sub ) Count and return the number of repetitions of a string sub that appear as substrings inside the string s . Read and make sure you see the answers are correct: >>> tale = 'This is the best of times.' >>> tale . count ( 'i' ) 3 >>> tale . count ( 'is' ) 2 >>> tale . count ( 'That' ) 0 >>> tale . count ( ' ' ) 5 There is a blank between the quotes in the line above. Blanks are characters like any other (except you can’t see them)! Just as the parameter can be replaced by a literal or any expression, the object to which a method is bound with the dot may also be given by a literal, or a variable name, or any expression that evaluates to the right kind of object in its place. This is true for any method call. Technically the dot between the object and the method name is an operator, and operators have different levels of precedence. It is important to realize that this dot operator has the highest possible precedence. Read and see the difference parentheses make in the expressions: >>> 'hello ' + 'there' . upper () 'hello THERE' >>> ( 'hello ' + 'there' ) . upper () 'HELLO THERE' To see if you understand this precedence, predict the results of each line and then test in the Shell : 3 * 'X' . count ( 'XXX' ) ( 3 * 'X' ) . count ( 'XXX' ) There are 0 ‘XXX’s in ‘X’, but 1 ‘XXX’ in ‘XXX’. Python lets you see all the methods that are bound to an object (and any object of its type) with the built-in function dir . To see all string methods, supply the dir function with any string. For example, try in the Shell : dir ( '' ) Many of the names in the list start and end with two underscores, like __add__. These are all associated with methods and pieces of data used internally by the Python interpreter. You can ignore them for now. The remaining entries in the list are all user-level methods for strings. You should see lower and upper among them. Some of the methods are much more commonly used than others. Object notation object . method ( parameters ) has been illustrated so far with just the object type str , but it applies to all types. Later in the tutorial methods such as the following will be discussed: If seq is a list , seq.append(element) appends element to the end of the list. If myData is a file , myData.read() will read and return the entire contents of the file.... 2.1.2. String Indices ¶ A string is a sequence of smaller components (individual characters), and it is often useful to deal with parts of strings. Python indexes the characters in a string, starting from 0, so for instance, the characters in the string 'computer' have indices: character c o m p u t e r index 0 1 2 3 4 5 6 7 Each index is associated with a character, and you reference the individual characters much like in a dictionary. Try the following. (You can skip the comments that make the indices explicit.) Enter in the Shell : # 01234567 s = 'computer' s [ 0 ] s [ 5 ] s [ 8 ] You cannot refer directly to a character that is not there. Indices only go to 7 in the example above. Recall the len function, which gives the length of a sequence. It works on strings. Guess the following value, and test in the Shell : len ( s ) A common error is to think the last index will be the same as the length of the string, but as you saw above, that leads to an execution error. If the length of some string is 5, what is the index of its last character? What if the length is 35? Hopefully you did not count by ones all the way from 0. The indices for a string of length n are the elements of the sequence range(n) , which goes from 0 through n-1, or the length of the string minus one, which is 5-1=4 or 35-1 = 34 in these examples. Sometimes you are interested in the last few elements of a string and do not want to do calculations like this. Python makes it easy. You can index from the right end of the string. Since positive integers are used to index from the front, negative integers are used to index from the right end, so the more complete table of indices for 'computer' gives two alternatives for each character: character c o m p u t e r index 0 1 2 3 4 5 6 7 index from the right end -8 -7 -6 -5 -4 -3 -2 -1 Predict and test each individual line, continuing in the Shell : s [ - 1 ] s [ - 3 ] s [ - 10 ] it = 'horse' len ( it ) it [ - 1 ] it [ 1 ] Be careful - remember what the initial index is! 2.1.3. String Slices ¶ It is also useful to extract larger pieces of a string than a single character. That brings us to slices . Try this expression using slice notation, continuing in the Shell : s [ 0 : 4 ] Note that s[4] is the first character past the slice. The simplest syntax for a slice of a string s is: s[ startIndex : pastIndex ] This refers to the substring of s starting at index startIndex and stopping just before index pastIndex. Warning It confuses many people that the index after the colon is not the index of the final character in the slice. The second index is past the end of the slice. Predict and try each line individually in the Shell : s [ 2 : 5 ] s [ 1 : 3 ] If you omit the first index, the slice starts from the beginning. If you omit the second index, the slice goes all the way to the end. Predict and try each line individually in the Shell : s [: 3 ] s [ 5 :] s [:] Predict and try each line individually in the Shell : word = 'program' word [ 2 : 4 ] word [ 1 : - 3 ] word [ 3 :] word [ 3 : 3 ] word [: 1 ] + word [ 4 :] Python evaluates slices in a more forgiving manner than when indexing single characters. In a slice, if you give an index past a limit of where it could be, Python assumes you mean the actual end. Predict and try each line individually in the Shell : word [: 9 ] word [ 8 : 10 ] Enter a slice expression using the variable word from above that produces 'gra' . A useful string method that uses the ideas of indices and slices is find . Syntax options for find method with a string s : s .find( sub ) s .find( sub , start ) s .find( sub , start , end ) Return the integer index in the string s of the beginning of the first complete occurrence of the substring sub . If sub does not appear inside s, return -1. The value -1 would be an impossible result if sub were found, so if -1 is returned, sub must not have been found. If parameters start and end are not included in the parameter list, the search is through the whole string s . If an integer value is given for start , the search starts at index start . If an integer value is given for end , the search ends before index end . In other words if start and end appear, then the search is through the slice s [ start : end ], but the index returned is still counted from the beginning of s . For example, check that the following make sense. The comment line is just there to help you count: >>> # 01234567890 >>> s = 'Mississippi' >>> s . find ( 'i' ) 1 >>> s . find ( 'si' ) 3 >>> s . find ( 'sa' ) -1 >>> s . find ( 'si' , 4 ) 6 Predict and try each line in the Shell : # 0123456789012 line = 'Hello, there!' line . find ( 'e' ) line . find ( 'he' ) line . find ( 'e' , 10 ) line . find ( 'he' , 10 ) We will consider more string methods later, but we can already do useful things with the ones introduced. Inside the Shell, you can look up documentation on any of the methods listed with the dir function. Here is a place that you want to refer to the method itself, not invoke the method, so note that you get help for s.find not for s.find() . Assuming you defined the string s in the Shell earlier, try in the Shell help ( s . find ) The Python documentation uses square brackets to indicate optional elements which get a default value if you leave them out. This shortens the syntax descriptions. If you want method documentation when you do not have a variable of the type created, you can also use the type name. Try in the Shell : dir ( str ) help ( str . capitalize ) In the help documentation for a function with one or more parameters, you may see what looks like a final parameter / . Ignore it. It documents a technical restriction on parameters. It is not actually a parameter. Indexing and slicing works on any kind of Python sequence, so you can index or slice lists also.* Read* this Shell session: >>> vals = [ 5 , 7 , 9 , 22 , 6 , 8 ] >>> vals [ 1 ] 7 >>> vals [ - 2 ] 6 >>> vals [ 1 : 4 ] [7, 9, 22] Unlike strings, lists are mutable, as you will see in Appending to a List . Indices and slices can also be used in assignment statements to change lists, but in this tutorial we not need list indexing, and we will not discuss this subject further. 2.1.4. Index Variables ¶ All the concrete examples in the last two sections used literal numbers for the indices. That is fine for learning the idea, but in practice, variables or expressions are almost always used for indices. As usual the variable or expression is evaluated before being used. Try in Idle and see that the example program index1.py makes sense: s = 'word' print ( 'The full string is: ' , s ) n = len ( s ) for i in range ( n ): print () print ( 'i =' , i ) print ( 'The letter at index i:' , s [ i ]) print ( 'The part before index i (if any):' , s [: i ]) print ( 'The part before index i+2:' , s [: i + 2 ]) We will use index variables in more practical situations as we explain more operations with strings. 2.1.5. split ¶ Syntax options for the split method with a string s : s .split() s .split( sep ) The first version splits s at any sequence of whitespace (blanks, newlines, tabs) and returns the remaining parts of s as a list. If a string sep is specified, it is the separator that gets removed from between the parts of the list. For example, read and follow: >>> tale = 'This is the best of times.' >>> tale . split () ['This', 'is', 'the', 'best', 'of', 'times.'] >>> s = 'Mississippi' >>> s . split ( 'i' ) ['M', 'ss', 'ss', 'pp', ''] >>> s . split () # no white space ['Mississippi'] Predict and test each line in the Shell : line = 'Go: Tear some strings apart!' seq = line . split () seq line . split ( ':' ) line . split ( 'ar' ) lines = 'This includes \\ nsome new \\ nlines.' lines . split () 2.1.6. join ¶ Join is roughly the reverse of split. It joins together a sequence of strings. The syntax is rather different. The separator sep comes first, since it has the right type (a string). Syntax for the join method: sep .join( sequence ) Return a new string obtained by joining together the sequence of strings into one string, interleaving the string sep between sequence elements. For example (continuing in the Shell from the previous section, using seq ), follow: >>> ' ' . join ( seq ) 'Go: Tear some strings apart!' >>> '' . join ( seq ) 'Go:Tearsomestringsapart!' >>> '//' . join ( seq ) 'Go://Tear//some//strings//apart!' Predict and try each line, continuing in the Shell : '##' . join ( seq ) ':' . join ([ 'one' , 'two' , 'three' ]) The methods split and join are often used in sequence: 2.1.6.1. Underscore Exercise ¶ Write a program underscores.py that would input a phrase from the user and print out the phrase with the white space between words replaced by an underscore. For instance if the input is the best one , then it would print the_best_one . The conversion can be done in one or two statements using the recent string methods. 2.1.6.2. Acronym Exercise ¶ * An acronym is a string of capital letters formed by taking the first letters from a phrase. For example, SADD is an acronym for ‘students against drunk driving’. Note that the acronym should be composed of all capital letters even if the original words are not. Write a program acronym.py that has the user input a phrase and then prints the corresponding acronym. To get you started, here are some things you will need to do. First check that you understand the basic syntax to accomplish the different individual tasks: Indicate the proper syntax using a Python function or operation will allow you to accomplish each task. Invent appropriate variable names for the different parts. These are not complete instructions! The idea is to make sure you know the basic syntax to use in all these situations. See the questions after the list to help you put together the final program. What type of data will the input be? What type of data will the output be? Get the phrase from the user. Convert to upper case. Divide the phrase into words. Initialize a new empty list, letters . Get the first letter of each word. Append the first letter to the list letters . Join the letters together, with no space between them. Print the acronym. Which of these steps is in a loop? What for statement controls this loop? Put these ideas together and write and test your program acronym.py . Make sure you use names for the objects that are consistent from one line to the next! (You might not have done that when you first considered the syntax and ideas needed for 1-9 above individually.) 2.1.7. Further Exploration ¶ As the dir('') list showed, there are many more operations on strings than we have discussed, and there are further variations of the ones above with more parameters. Methods startswith , endswith , and replace are discussed later in More String Methods . If you want to reach a systematic reference from inside Idle, go to Help ‣ Python Docs ‣ Library Reference , and find the section Built-in Types, and then the subsection for type str. Many methods use features we have not discussed yet, but currently accessible methods are capitalize , title , strip , rfind , .... [1] s.lower() [2] Use a plus sign to concatenate the pieces. [3] s.lower() + s.upper() Table Of Contents 2.1. Strings, Part III 2.1.1. Object Orientation 2.1.2. String Indices 2.1.3. String Slices 2.1.4. Index Variables 2.1.5. split 2.1.6. join 2.1.6.1. Underscore Exercise 2.1.6.2. Acronym Exercise 2.1.7. Further Exploration Previous topic 2. Objects and Methods Next topic 2.2. More Classes and Methods This Page Show Source Quick search Enter search terms or a module, class or function name. Navigation index next | previous | Hands-on Python Tutorial » 2. Objects and Methods » © Copyright 2019, Dr. Andrew N. Harrington. Last updated on Jan 05, 2020. Created using Sphinx 1.3.1+.
2026-01-13T09:30:35
https://bifromq.apache.org/docs/benchmark/overview/#__docusaurus_skipToContent_fallback
Benchmark Overview | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ Next (Incubating) Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation BifroMQ Cluster User Guide Plugin Administration Benchmark Contribution Benchmark Version: Next (Incubating) Benchmark Overview Coming Soon... Edit this page Previous Security Next Contribution Guide Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:35
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#s3-tutorial-cleanup
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:35
https://bifromq.apache.org/docs/1.0.x/category/install--deploy/
Install & Deploy | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 1.0.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install & Deploy Deploy on Docker Deploy on Linux or Mac Deploy on Windows Deploy from source Deploy Cluster Configuration User Guide Plugin Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 1.0.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Install & Deploy Version: 1.0.x Install & Deploy Install And Deploy BifroMQ. 📄️ Deploy on Docker Prerequisites 📄️ Deploy on Linux or Mac Prerequisites 📄️ Deploy on Windows * JDK 17+ 📄️ Deploy from source Prerequisites 📄️ Deploy Cluster Cluster Previous Connect to BifroMQ Next Deploy on Docker Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:35
https://bifromq.apache.org/docs/installation/intro/#running-bifromq
Installation Overview | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ Next (Incubating) Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation Docker Linux Windows Install from Source Configuration Convention & Migration Notes on Kubernetes Deployment BifroMQ Cluster User Guide Plugin Administration Benchmark Contribution Installation Version: Next (Incubating) On this page Installation Overview Prerequisites ​ BifroMQ requires Java 17 or higher for its operation. Ensure your Java runtime environment is updated to meet these requirements before proceeding with the BifroMQ installation. Installation Directory Structure ​ Upon installation, BifroMQ organizes its files within the following directory structure: Directory Description bin Executable scripts for starting and managing BifroMQ. conf Configuration files necessary for customizing BifroMQ operations. lib Program libs for running BifroMQ. plugins BifroMQ plugins in pf4j compatible format. data User's persistent data. logs Log files. Running BifroMQ ​ The startup script for BifroMQ recognizes several environment variables that allow for customization and optimization of its runtime environment: Environment Variable Description LOG_DIR Specifies the directory where BifroMQ should store its log files. Defaults to ./logs if unset. DATA_DIR Determines the directory for storing BifroMQ data. Defaults to ./data if unset. JAVA_HOME Specifies the path to the Java Runtime Environment (JRE) that BifroMQ should use. MEM_LIMIT Limits the maximum amount of memory that BifroMQ can use. JVM_PERF_OPTS Custom JVM performance options for tuning the JVM instance running BifroMQ. JVM_GC_OPTS Garbage Collection (GC) options to optimize memory management for BifroMQ. JVM_HEAP_OPTS Specifies JVM heap size and other memory settings directly impacting BifroMQ's performance. EXTRA_JVM_OPTS Additional JVM options that users may want to pass to customize the BifroMQ runtime environment. JVM_DEBUG Enables debugging options for the JVM, useful for development and troubleshooting. JAVA_DEBUG_PORT When JVM_DEBUG is enabled, sets the port for the JVM debugger to attach to. Edit this page Previous Road Map Next Docker Prerequisites Installation Directory Structure Running BifroMQ Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:35
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#with-s3-tutorial-prepare-create-buckets
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:35
https://docs.aws.amazon.com/lambda/latest/api/API_PublishVersion.html
PublishVersion - AWS Lambda PublishVersion - AWS Lambda Documentation AWS Lambda API Reference Request Syntax URI Request Parameters Request Body Response Syntax Response Elements Errors See Also PublishVersion Creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn't change. AWS Lambda doesn't publish a version if the function's configuration and code haven't changed since the last version. Use UpdateFunctionCode or UpdateFunctionConfiguration to update the function before publishing a version. Clients can invoke versions directly or with an alias. To create an alias, use CreateAlias . Request Syntax POST /2015-03-31/functions/ FunctionName /versions HTTP/1.1 Content-type: application/json { " CodeSha256 ": " string ", " Description ": " string ", " PublishTo ": " string ", " RevisionId ": " string " } URI Request Parameters The request uses the following URI parameters. FunctionName The name or ARN of the Lambda function. Name formats Function name - MyFunction . Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction . Partial ARN - 123456789012:function:MyFunction . The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length. Length Constraints: Minimum length of 1. Maximum length of 140. Pattern: (arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z] { 2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d { 1}:)?(\d { 12}:)?(function:)?([a-zA-Z0-9-_]+)(:(\$LATEST|[a-zA-Z0-9-_]+))? Required: Yes Request Body The request accepts the following data in JSON format. CodeSha256 Only publish a version if the hash value matches the value that's specified. Use this option to avoid publishing a version if the function code has changed since you last updated it. You can get the hash for the version that you uploaded from the output of UpdateFunctionCode . Type: String Required: No Description A description for the version to override the description in the function configuration. Type: String Length Constraints: Minimum length of 0. Maximum length of 256. Required: No PublishTo Specifies where to publish the function version or configuration. Type: String Valid Values: LATEST_PUBLISHED Required: No RevisionId Only update the function if the revision ID matches the ID that's specified. Use this option to avoid publishing a version if the function configuration has changed since you last updated it. Type: String Required: No Response Syntax HTTP/1.1 201 Content-type: application/json { " Architectures ": [ " string " ], " CapacityProviderConfig ": { " LambdaManagedInstancesCapacityProviderConfig ": { " CapacityProviderArn ": " string ", " ExecutionEnvironmentMemoryGiBPerVCpu ": number , " PerExecutionEnvironmentMaxConcurrency ": number } }, " CodeSha256 ": " string ", " CodeSize ": number , " ConfigSha256 ": " string ", " DeadLetterConfig ": { " TargetArn ": " string " }, " Description ": " string ", " DurableConfig ": { " ExecutionTimeout ": number , " RetentionPeriodInDays ": number }, " Environment ": { " Error ": { " ErrorCode ": " string ", " Message ": " string " }, " Variables ": { " string " : " string " } }, " EphemeralStorage ": { " Size ": number }, " FileSystemConfigs ": [ { " Arn ": " string ", " LocalMountPath ": " string " } ], " FunctionArn ": " string ", " FunctionName ": " string ", " Handler ": " string ", " ImageConfigResponse ": { " Error ": { " ErrorCode ": " string ", " Message ": " string " }, " ImageConfig ": { " Command ": [ " string " ], " EntryPoint ": [ " string " ], " WorkingDirectory ": " string " } }, " KMSKeyArn ": " string ", " LastModified ": " string ", " LastUpdateStatus ": " string ", " LastUpdateStatusReason ": " string ", " LastUpdateStatusReasonCode ": " string ", " Layers ": [ { " Arn ": " string ", " CodeSize ": number , " SigningJobArn ": " string ", " SigningProfileVersionArn ": " string " } ], " LoggingConfig ": { " ApplicationLogLevel ": " string ", " LogFormat ": " string ", " LogGroup ": " string ", " SystemLogLevel ": " string " }, " MasterArn ": " string ", " MemorySize ": number , " PackageType ": " string ", " RevisionId ": " string ", " Role ": " string ", " Runtime ": " string ", " RuntimeVersionConfig ": { " Error ": { " ErrorCode ": " string ", " Message ": " string " }, " RuntimeVersionArn ": " string " }, " SigningJobArn ": " string ", " SigningProfileVersionArn ": " string ", " SnapStart ": { " ApplyOn ": " string ", " OptimizationStatus ": " string " }, " State ": " string ", " StateReason ": " string ", " StateReasonCode ": " string ", " TenancyConfig ": { " TenantIsolationMode ": " string " }, " Timeout ": number , " TracingConfig ": { " Mode ": " string " }, " Version ": " string ", " VpcConfig ": { " Ipv6AllowedForDualStack ": boolean , " SecurityGroupIds ": [ " string " ], " SubnetIds ": [ " string " ], " VpcId ": " string " } } Response Elements If the action is successful, the service sends back an HTTP 201 response. The following data is returned in JSON format by the service. Architectures The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 . Type: Array of strings Array Members: Fixed number of 1 item. Valid Values: x86_64 | arm64 CapacityProviderConfig Configuration for the capacity provider that manages compute resources for Lambda functions. Type: CapacityProviderConfig object CodeSha256 The SHA256 hash of the function's deployment package. Type: String CodeSize The size of the function's deployment package, in bytes. Type: Long ConfigSha256 The SHA256 hash of the function configuration. Type: String DeadLetterConfig The function's dead letter queue. Type: DeadLetterConfig object Description The function's description. Type: String Length Constraints: Minimum length of 0. Maximum length of 256. DurableConfig The function's durable execution configuration settings, if the function is configured for durability. Type: DurableConfig object Environment The function's environment variables . Omitted from AWS CloudTrail logs. Type: EnvironmentResponse object EphemeralStorage The size of the function's /tmp directory in MB. The default value is 512, but can be any whole number between 512 and 10,240 MB. For more information, see Configuring ephemeral storage (console) . Type: EphemeralStorage object FileSystemConfigs Connection settings for an Amazon EFS file system . Type: Array of FileSystemConfig objects Array Members: Minimum number of 0 items. Maximum number of 1 item. FunctionArn The function's Amazon Resource Name (ARN). Type: String Length Constraints: Minimum length of 0. Maximum length of 10000. Pattern: arn:(aws[a-zA-Z-]*)?:lambda:[a-z] { 2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d { 1}:\d { 12}:function:[a-zA-Z0-9-_\.]+(:(\$LATEST(\.PUBLISHED)?|[a-zA-Z0-9-_]+))? FunctionName The name of the function. Type: String Length Constraints: Minimum length of 1. Maximum length of 256. Pattern: (arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z] { 2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d { 1}:)?(\d { 12}:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST(\.PUBLISHED)?|[a-zA-Z0-9-_]+))? Handler The function that Lambda calls to begin running your function. Type: String Length Constraints: Minimum length of 0. Maximum length of 128. Pattern: [^\s]+ ImageConfigResponse The function's image configuration values. Type: ImageConfigResponse object KMSKeyArn The ARN of the AWS Key Management Service (AWS KMS) customer managed key that's used to encrypt the following resources: The function's environment variables . The function's Lambda SnapStart snapshots. When used with SourceKMSKeyArn , the unzipped version of the .zip deployment package that's used for function invocations. For more information, see Specifying a customer managed key for Lambda . The optimized version of the container image that's used for function invocations. Note that this is not the same key that's used to protect your container image in the Amazon Elastic Container Registry (Amazon ECR). For more information, see Function lifecycle . If you don't provide a customer managed key, Lambda uses an AWS owned key or an AWS managed key . Type: String Pattern: (arn:(aws[a-zA-Z-]*)?:[a-z0-9-.]+:.*)|() LastModified The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD). Type: String LastUpdateStatus The status of the last update that was performed on the function. This is first set to Successful after function creation completes. Type: String Valid Values: Successful | Failed | InProgress LastUpdateStatusReason The reason for the last update that was performed on the function. Type: String LastUpdateStatusReasonCode The reason code for the last update that was performed on the function. Type: String Valid Values: EniLimitExceeded | InsufficientRolePermissions | InvalidConfiguration | InternalError | SubnetOutOfIPAddresses | InvalidSubnet | InvalidSecurityGroup | ImageDeleted | ImageAccessDenied | InvalidImage | KMSKeyAccessDenied | KMSKeyNotFound | InvalidStateKMSKey | DisabledKMSKey | EFSIOError | EFSMountConnectivityError | EFSMountFailure | EFSMountTimeout | InvalidRuntime | InvalidZipFileException | FunctionError | VcpuLimitExceeded | CapacityProviderScalingLimitExceeded | InsufficientCapacity | EC2RequestLimitExceeded | FunctionError.InitTimeout | FunctionError.RuntimeInitError | FunctionError.ExtensionInitError | FunctionError.InvalidEntryPoint | FunctionError.InvalidWorkingDirectory | FunctionError.PermissionDenied | FunctionError.TooManyExtensions | FunctionError.InitResourceExhausted Layers The function's layers . Type: Array of Layer objects LoggingConfig The function's Amazon CloudWatch Logs configuration settings. Type: LoggingConfig object MasterArn For Lambda@Edge functions, the ARN of the main function. Type: String Length Constraints: Minimum length of 0. Maximum length of 10000. Pattern: arn:(aws[a-zA-Z-]*)?:lambda:[a-z] { 2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d { 1}:\d { 12}:function:[a-zA-Z0-9-_]+(:(\$LATEST|[a-zA-Z0-9-_]+))? MemorySize The amount of memory available to the function at runtime. Type: Integer Valid Range: Minimum value of 128. Maximum value of 32768. PackageType The type of deployment package. Set to Image for container image and set Zip for .zip file archive. Type: String Valid Values: Zip | Image RevisionId The latest updated revision of the function or alias. Type: String Role The function's execution role. Type: String Pattern: arn:(aws[a-zA-Z-]*)?:iam::\d { 12}:role/?[a-zA-Z_0-9+=,.@\-_/]+ Runtime The identifier of the function's runtime . Runtime is required if the deployment package is a .zip file archive. Specifying a runtime results in an error if you're deploying a function using a container image. The following list includes deprecated runtimes. Lambda blocks creating new functions and updating existing functions shortly after each runtime is deprecated. For more information, see Runtime use after deprecation . For a list of all currently supported runtimes, see Supported runtimes . Type: String Valid Values: nodejs | nodejs4.3 | nodejs6.10 | nodejs8.9 | nodejs8.10 | nodejs8.x | nodejs10.x | nodejs12.x | nodejs14.x | nodejs16.x | nodejs18.x | nodejs20.x | nodejs22.x | nodejs24.x | java8 | java8.al2 | java11 | java17 | java21 | java25 | python2.7 | python3.4 | python3.6 | python3.7 | python3.8 | python3.9 | python3.10 | python3.11 | python3.12 | python3.13 | python3.14 | dotnetcore1.0 | dotnetcore2.0 | dotnetcore2.1 | dotnetcore3.1 | dotnet6 | dotnet8 | dotnet10 | nodejs4.3-edge | python2.7-greengrass | byol | go1.9 | go1.x | ruby2.5 | ruby2.6 | ruby2.7 | ruby3.2 | ruby3.3 | ruby3.4 | provided | provided.al2 | provided.al2023 | nasa | nodejs26.x | ruby3.5 | python3.15 RuntimeVersionConfig The ARN of the runtime and any errors that occured. Type: RuntimeVersionConfig object SigningJobArn The ARN of the signing job. Type: String Pattern: arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z] { 2}(-gov)?-[a-z]+-\d { 1})?:(\d { 12})?:(.*) SigningProfileVersionArn The ARN of the signing profile version. Type: String Pattern: arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z] { 2}(-gov)?-[a-z]+-\d { 1})?:(\d { 12})?:(.*) SnapStart Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Improving startup performance with Lambda SnapStart . Type: SnapStartResponse object State The current state of the function. When the state is Inactive , you can reactivate the function by invoking it. Type: String Valid Values: Pending | Active | Inactive | Failed | Deactivating | Deactivated | ActiveNonInvocable | Deleting StateReason The reason for the function's current state. Type: String StateReasonCode The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function. Type: String Valid Values: Idle | Creating | Restoring | EniLimitExceeded | InsufficientRolePermissions | InvalidConfiguration | InternalError | SubnetOutOfIPAddresses | InvalidSubnet | InvalidSecurityGroup | ImageDeleted | ImageAccessDenied | InvalidImage | KMSKeyAccessDenied | KMSKeyNotFound | InvalidStateKMSKey | DisabledKMSKey | EFSIOError | EFSMountConnectivityError | EFSMountFailure | EFSMountTimeout | InvalidRuntime | InvalidZipFileException | FunctionError | DrainingDurableExecutions | VcpuLimitExceeded | CapacityProviderScalingLimitExceeded | InsufficientCapacity | EC2RequestLimitExceeded | FunctionError.InitTimeout | FunctionError.RuntimeInitError | FunctionError.ExtensionInitError | FunctionError.InvalidEntryPoint | FunctionError.InvalidWorkingDirectory | FunctionError.PermissionDenied | FunctionError.TooManyExtensions | FunctionError.InitResourceExhausted TenancyConfig The function's tenant isolation configuration settings. Determines whether the Lambda function runs on a shared or dedicated infrastructure per unique tenant. Type: TenancyConfig object Timeout The amount of time in seconds that Lambda allows a function to run before stopping it. Type: Integer Valid Range: Minimum value of 1. TracingConfig The function's AWS X-Ray tracing configuration. Type: TracingConfigResponse object Version The version of the Lambda function. Type: String Length Constraints: Minimum length of 1. Maximum length of 1024. Pattern: (\$LATEST|[0-9]+) VpcConfig The function's networking configuration. Type: VpcConfigResponse object Errors For information about the errors that are common to all actions, see Common Errors . CodeStorageExceededException Your AWS account has exceeded its maximum total code size. For more information, see Lambda quotas . Type The exception type. HTTP Status Code: 400 FunctionVersionsPerCapacityProviderLimitExceededException The maximum number of function versions that can be associated with a single capacity provider has been exceeded. For more information, see Lambda quotas . Type The exception type. HTTP Status Code: 400 InvalidParameterValueException One of the parameters in the request is not valid. message The exception message. Type The exception type. HTTP Status Code: 400 PreconditionFailedException The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. For AddPermission and RemovePermission API operations: Call GetPolicy to retrieve the latest RevisionId for your resource. For all other API operations: Call GetFunction or GetAlias to retrieve the latest RevisionId for your resource. message The exception message. Type The exception type. HTTP Status Code: 412 ResourceConflictException The resource already exists, or another operation is in progress. message The exception message. Type The exception type. HTTP Status Code: 409 ResourceNotFoundException The resource specified in the request does not exist. HTTP Status Code: 404 ServiceException The AWS Lambda service encountered an internal error. HTTP Status Code: 500 TooManyRequestsException The request throughput limit was exceeded. For more information, see Lambda quotas . retryAfterSeconds The number of seconds the caller should wait before retrying. HTTP Status Code: 429 See Also For more information about using this API in one of the language-specific AWS SDKs, see the following: AWS Command Line Interface V2 AWS SDK for .NET AWS SDK for C++ AWS SDK for Go v2 AWS SDK for Java V2 AWS SDK for JavaScript V3 AWS SDK for Kotlin AWS SDK for PHP V3 AWS SDK for Python AWS SDK for Ruby V3 Javascript is disabled or is unavailable in your browser. To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions. Document Conventions PublishLayerVersion PutFunctionCodeSigningConfig Did this page help you? - Yes Thanks for letting us know we're doing a good job! If you've got a moment, please tell us what we did right so we can do more of it. Did this page help you? - No Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
2026-01-13T09:30:35
https://www.visma.com/voiceofvisma/ep-12-ai-in-the-accounting-sphere-with-joris-joppe
Ep 12: AI in the accounting sphere with Joris Joppe Who we are About us Connected by software – driven by people Become a Visma company Join our family of thriving SaaS companies Technology and AI at Visma Innovation with customer value at its heart Our sponsorship Team Visma | Lease a Bike Sustainability A better impact through software Contact us Find the right contact information What we offer Cloud software We create brilliant ways to work For medium businesses Lead your business with clarity For small businesses Start, run and grow with ease For public sector Empower efficient societies For accounting offices Build your dream accounting office For partners Help us keep customers ahead For investors For investors Latest results, news and strategy Financials Key figures, quarterly and annual results Events Financial calendar Governance Policies, management, board and owners Careers Careers at Visma Join the business software revolution Locations Find your nearest office Open positions Turn your passion into a career Resources News For small businesses Cloud accounting software built for small businesses Who we are About us Technology and AI at Visma Sustainability Become a Visma company Our sponsorship What we offer Cloud software For small businesses For accounting offices For enterprises Public sector For partners For investors Overview Financials Governance News and press  Events Careers Careers at Visma Open positions Hubs Resources Blog Visma Developer Trust Centre News Press releases Team Visma | Lease a Bike Podcast Ep 12: AI in the accounting sphere with Joris Joppe Voice of Visma February 5, 2025 Spotify Created with Sketch. YouTube Apple Podcasts Amazon Music <iframe style="border-radius:12px" src="https://www.youtube.com/embed/IdNWmLodFPc?si=sgmBPCJ64ABXBL8h" width="100%" height="500" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe> About the episode Artificial intelligence is changing industries across the board, and accounting is no exception. But in such a highly specialised field that serves as the backbone for global economies, what does change actually look like? Joris Joppe, Managing Director of Visionplanner, and host Petteri Rantamäki sit down to talk about the biggest opportunities and challenges ahead. Share More from Voice of Visma We're sitting down with leaders and colleagues from around Visma to share their stories, industry knowledge, and valuable career lessons. With the Voice of Visma podcast, we’re bringing our people and culture closer to you. Get to know the podcast Ep 22: Building, learning, and accelerating growth in the SaaS world with Maxin Schneider Entrepreneurial leadership often grows through experience, and Maxin Schneider has seen that up close. Read more Ep 21: How DEI fuels business success with Iveta Bukane Why DEI isn't just a moral imperative—it’s a business necessity. Read more Ep 20: Driving tangible sustainability outcomes with Freja Landewall Discover how ESG goes far beyond the environment, encompassing people, governance, and the long-term resilience of business. Read more Ep 19: Future-proofing public services in Sweden with Marie Ceder Between demographic changes, the rise in AI, and digitalisation, the public sector is at a pivotal moment. Read more Ep 18: Making inclusion part of our everyday work with Ida Algotsson What does inclusion truly mean at Visma – not just as values, but as everyday actions? Read more Ep 17: Sustainability at the heart of business with Robin Åkerberg Honouring our responsibility goes well beyond the numbers – it starts with a shared purpose and values. Read more Ep 16: Innovation for the public good with Kasper Lyhr Serving the public sector goes way beyond software – it’s about shaping the future of society as a whole. Read more Ep 15: Leading with transparency and vulnerability with Ellen Sano What does it mean to be a “firestarter” in business? Read more Ep 14: Women, innovation, and the future of Visma with Merete Hverven Our CEO, Merete, knows that great leadership takes more than just hard work – it takes vision. Read more Ep 13: Building partnerships beyond software with Daniel Ognøy Kaspersen What does it look like when an accounting software company delivers more than just great software? Read more Ep 12: AI in the accounting sphere with Joris Joppe Artificial intelligence is changing industries across the board, and accounting is no exception. But in such a highly specialised field, what does change actually look like? Read more Ep 11: From Founder to Segment Director with Ari-Pekka Salovaara Ari-Pekka is a serial entrepreneur who joined Visma when his company was acquired in 2010. He now leads the small business segment. Read more Ep 10: When brave choices can save a company with Charlotte von Sydow What’s it like stepping in as the Managing Director for a company in decline? Read more Ep 09: Revolutionising tax tech in Italy with Enrico Mattiazzi and Vito Lomele Take one look at their product, their customer reviews, or their workplace awards, and it’s clear why Fiscozen leads Italy’s tax tech scene. Read more Ep 08: Navigating the waters of entrepreneurship with Steffen Torp When it comes to being an entrepreneur, the journey is as personal as it is unpredictable. Read more Ep 07: The untold stories of Visma with Øystein Moan What did Visma look like in its early days? Are there any decisions our former CEO would have made differently? Read more Ep 06: Measure what matters: Employee engagement with Vibeke Müller Research shows that having engaged, happy employees is so important for building a great company culture and performing better financially. Read more Ep 05: Our Team Visma | Lease a Bike sponsorship with Anne-Grethe Thomle Karlsen It’s one thing to sponsor the world’s best cycling team; it’s a whole other thing to provide software and expertise that helps them do what they do best. Read more Ep 04: “How do you make people care about security?” with Joakim Tauren With over 700 applications across the Visma Group (and counting!), cybersecurity is make-or-break for us. Read more Ep 03: The human side of enterprise with Yvette Hoogewerf As a software company, our products are central to our business… but that’s only one part of the equation. Read more Ep 02: From Management Trainee to CFO with Stian Grindheim How does someone work their way up from Management Trainee to CFO by the age of 30? And balance fatherhood alongside it all? Read more Ep 01: An optimistic look at the future of AI with Jacob Nyman We’re all-too familiar with the fears surrounding artificial intelligence. So today, Jacob and Johan are flipping the script. Read more (Trailer) Introducing: Voice of Visma These are the stories that shape us... and the reason Visma is unlike anywhere else. Read more ‍ Visma Software International AS Organisation number: 980858073 MVA (Foretaksregisteret/The Register of Business Enterprises) ‍ Main office Karenslyst allé 56 0277 Oslo Norway ‍ ‍Postal address PO box 733, Skøyen 0214 Oslo Norway ‍ visma@visma.com Visma on LinkedIn ‍ Who we are About us Technology at Visma Sustainability Become a Visma company Our sponsorship Contact us What we offer For small businesses For accounting offices For medium businesses For public sector For partners e-invoicing Digital signature For investors Overview Financials Governance Events Careers Careers at Visma Open positions Hubs Resources Blog Trust Centre Community News Press ©️ 2026 Visma Privacy policy Cookie policy Whistleblowing Cookies settings Transparency Act Change country
2026-01-13T09:30:36
https://twitter.com/awscloud?nc1=f_so_tw
JavaScript is not available. We’ve detected that JavaScript is disabled in this browser. Please enable JavaScript or switch to a supported browser to continue using x.com. You can see a list of supported browsers in our Help Center. Help Center Terms of Service Privacy Policy Cookie Policy Imprint Ads info © 2026 X Corp. Something went wrong, but don’t fret — let’s give it another shot. Try again Some privacy related extensions may cause issues on x.com. Please disable them and try again.
2026-01-13T09:30:36
https://mydailyfashionblog.com/page/2/
My Daily Fashion blog and Lifestyle News | Mydailyfashionblog.com - Part 2 Skip to content blog Home Beauty Celebrities Clothing Fashion Food Gift Lifestyle Jewellery Shopping Contact Us blog Home Beauty Celebrities Clothing Fashion Food Gift Lifestyle Jewellery Shopping Contact Us Breaking News Leather Clutches for Women: The Perfect Companion for Seasonal Events Vacation-Ready Hair: Heatless Straight Hairstyles for Summer Getaways Choosing the Right Workout Leggings for Every Type of Exercise: 9 Helpful Tips Curl Confidence: Achieve Salon-Worthy Volume with Premium Curly Hair Enhancements Know The Importance Of Cleaning Your Makeup Brushes At Least Weekly Chic and Confident: Embracing IntimaLase for a Modern Lifestyle Manchester’s Most Iconic Royal Engagement Rings Through History Woven Beauty: Discovering the Elegance of Human Hair Wefts Fashion Leather Clutches for Women: The Perfect Companion for Seasonal Events admin November 24, 2025 Fashion Vacation-Ready Hair: Heatless Straight Hairstyles for Summer Getaways admin October 7, 2025 Lifestyle Choosing the Right Workout Leggings for Every Type of Exercise: 9 Helpful Tips admin August 7, 2025 Beauty Curl Confidence: Achieve Salon-Worthy Volume with Premium Curly Hair Enhancements admin April 21, 2025 Fashion Leather Clutches for Women: The Perfect Companion for Seasonal Events admin November 24, 2025 Fashion Vacation-Ready Hair: Heatless Straight Hairstyles for Summer Getaways admin October 7, 2025 Lifestyle Choosing the Right Workout Leggings for Every Type of Exercise: 9 Helpful Tips admin August 7, 2025 Beauty Curl Confidence: Achieve Salon-Worthy Volume with Premium Curly Hair Enhancements admin April 21, 2025 Featured Story Fashion Leather Clutches for Women: The Perfect Companion for Seasonal Events Fashion Vacation-Ready Hair: Heatless Straight Hairstyles for Summer Getaways Lifestyle Choosing the Right Workout Leggings for Every Type of Exercise: 9 Helpful Tips Beauty Curl Confidence: Achieve Salon-Worthy Volume with Premium Curly Hair Enhancements Beauty Know The Importance Of Cleaning Your Makeup Brushes At Least Weekly Lifestyle Chic and Confident: Embracing IntimaLase for a Modern Lifestyle Jewellery Manchester’s Most Iconic Royal Engagement Rings Through History Lifestyle Woven Beauty: Discovering the Elegance of Human Hair Wefts Jewellery Elegance in Orange: The Allure of Mandarin Garnet Rings Lifestyle The Unique World of Yacht Floristry in Monaco Latest post Food What You Should Know Before Ordering a Cake Online 1,826 ViewsHere are four essential guidelines for ordering a confection from an online store. In addition to saving time and money, these tips will help you locate the ideal cake online. You are searching for a distinctive cake. You have… Posted on August 14, 2023 admin Jewellery Engagement Ring Metals: Which is Right for You? 1,635 ViewsCongratulations! . And now it’s time to embark on the magical journey of choosing an engagement ring. Beyond the dazzling diamonds and stunning gemstones, the choice of metal for the band is a crucial decision that will influence the… Posted on August 5, 2023 admin Beauty 4 Best Lotion to Have in UAE 1,670 ViewsThe epidermis is the main layer of your body which is always in contact with the external environment. It keeps our internal organs safe from the harmful surroundings. Taking care of our skin is crucial for a healthy lifestyle…. Posted on August 3, 2023 admin Lifestyle Best 3 Hair Conditioners for Men in UAE 1,432 ViewsIt is most important for men to take great care of their hair so, they can stay and look younger for a long time and be safe from hair loss. If someone loses their hair at an early age,… Posted on August 3, 2023 admin Gift The Fascinating Personality Characteristics and Talents of 1,383 ViewsJanuary 29 Zodiac and birthday Individuals Are you curious about the unique personality traits and talents of individuals born on January 29? Look no further, as we delve into the fascinating world of January 29 zodiac and birthday individuals…. Posted on July 23, 2023 admin Lifestyle How Men Should Dress For The Summer Heat wave 1,483 ViewsAs you may be aware, Europe is going through a heatwave and most of the US is also going through the same. Due to the heatwave, people are finding it unbearable and struggling to find the right clothes to… Posted on July 20, 2023 admin Lifestyle Reasons why your feet hurt when wearing flat shoes 1,482 ViewsFlat shoes for women have been a staple in fashion for decades. They are comfortable, versatile, and easy to wear, making them an essential item in everyone’s wardrobe. However, even with all their benefits, flat shoes can sometimes cause… Posted on July 11, 2023 admin Beauty Top 10 Best Mattifying Powders 1,544 ViewsMattifying  powders are a must in our make-up bag, and for good reason… They can make your skin look magnificently beautiful, just as they can spoil a previously worked complexion. Indeed, the choice of a loose or compact powder… Posted on June 23, 2023 admin Fashion How to wear a cashmere sweater? 1,355 ViewsSince 1989, we have been working with cashmere for men  and women . Large v-neck, turtleneck, round neck, hoodies are available in a wide range of colors that changes with the seasons. So many styles that adapt to all… Posted on June 23, 2023 admin Fashion The cashmere sweater, a timeless fashion 1,373 ViewsClassified in the category of luxurious pieces, the cashmere sweater is a trendy classic. Very soft, insulating and isothermal, cashmere wool is a very popular material in the world of luxury fashion. It is used to create clothes that… Posted on June 23, 2023 admin Posts navigation Previous 1 2 3 Next Recent Posts Leather Clutches for Women: The Perfect Companion for Seasonal Events Vacation-Ready Hair: Heatless Straight Hairstyles for Summer Getaways Choosing the Right Workout Leggings for Every Type of Exercise: 9 Helpful Tips Curl Confidence: Achieve Salon-Worthy Volume with Premium Curly Hair Enhancements Know The Importance Of Cleaning Your Makeup Brushes At Least Weekly Categories Beauty Clothing Fashion Food Gift Jewellery Lifestyle Archives November 2025 October 2025 August 2025 April 2025 January 2025 May 2024 March 2024 January 2024 December 2023 October 2023 August 2023 July 2023 June 2023 Tag News Beauty (4) Clothing (1) Fashion (4) Food (2) Gift (3) Jewellery (5) Lifestyle (8) Random News Leather Clutches for Women: The Perfect Companion for Seasonal Events Vacation-Ready Hair: Heatless Straight Hairstyles for Summer Getaways Choosing the Right Workout Leggings for Every Type of Exercise: 9 Helpful Tips Curl Confidence: Achieve Salon-Worthy Volume with Premium Curly Hair Enhancements Know The Importance Of Cleaning Your Makeup Brushes At Least Weekly Recent News Leather Clutches for Women: The Perfect Companion for Seasonal Events Vacation-Ready Hair: Heatless Straight Hairstyles for Summer Getaways Choosing the Right Workout Leggings for Every Type of Exercise: 9 Helpful Tips Curl Confidence: Achieve Salon-Worthy Volume with Premium Curly Hair Enhancements Know The Importance Of Cleaning Your Makeup Brushes At Least Weekly Category News Beauty Clothing Fashion Food Gift Jewellery Lifestyle Contact Us Contact Us Theme by Silk Themes
2026-01-13T09:30:36
https://vml.visma.ai/prototypes
About us Who are we? Learn more about Visma Machine Learning What we do Learn more about the products we offer What our customers say Read our customers' testimonials Products Autosuggest Automate your workflow Smartscan Extract data from your documents Resources Blog Product news and showcases Showcase of prototypes Prototypes, ideas and experiments Support Get started Find out more about onboarding to Visma Machine Learning FAQ We have answers to your frequently asked questions. Privacy policy Learn how we handle your data and protect your privacy Cookie policy Learn about how we use cookies to enhance your experience API Documentation Contact Us About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Showcase of prototypes Support Get started FAQ Privacy policy Cookie policy API Documentation Loading... Gærtorvet 1-5 1799 Copenhagen Denmark E-mail: worksmarter@visma.com About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Prototypes Documentation Support Get started FAQ Privacy policy Cookie policy Security Information Operating Status © 2026 Visma Group. All rights reserved Log in You need a Visma account to continue Sign in with Google
2026-01-13T09:30:36
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#with-s3-tutorial-configure-s3-trigger
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:36
https://github.com/compiler-explorer/compiler-explorer/wiki
Home · compiler-explorer/compiler-explorer Wiki · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection Stop leaks before they start EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events & webinars Ebooks & reports Business insights GitHub Skills SUPPORT & SERVICES Documentation Customer support Community forum Trust center Partners Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} compiler-explorer / compiler-explorer Public Uh oh! There was an error while loading. Please reload this page . Notifications You must be signed in to change notification settings Fork 2k Star 18.4k Code Issues 857 Pull requests 30 Discussions Actions Projects 0 Wiki Security Uh oh! There was an error while loading. Please reload this page . Insights Additional navigation options Code Issues Pull requests Discussions Actions Projects Wiki Security Insights Home Jump to bottom Austin Morton edited this page Apr 13, 2022 · 9 revisions Compiler Explorer is an interactive tool that lets you type code in one window and see the results of its compilation in another window. Using the site should be pretty self-explanatory: by default the left hand pane is the source window and the right hand has the assembly output. We have an FAQ . Got questions? Try the Compiler Explorer Discord . If you notice the wiki is outdated, please let us know so we can fix it as soon as posible! Toggle table of contents Pages 8 Loading Home Loading FAQ Uh oh! There was an error while loading. Please reload this page . Loading How it works Uh oh! There was an error while loading. Please reload this page . Loading How to install a compiler Uh oh! There was an error while loading. Please reload this page . Loading How to install a library Uh oh! There was an error while loading. Please reload this page . Loading How to run on the Windows Subsystem for Linux Uh oh! There was an error while loading. Please reload this page . Loading Libraries for your code available on the site Uh oh! There was an error while loading. Please reload this page . Loading Possible targets for z88dk compiler Uh oh! There was an error while loading. Please reload this page . Clone this wiki locally Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time.
2026-01-13T09:30:36
https://docs.aws.amazon.com/id_id/lambda/latest/dg/with-s3-tutorial.html#with-s3-tutorial-prepare-create-buckets
Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail - AWS Lambda Dokumentasi AWS Lambda Panduan Developerr Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris. Tutorial: Menggunakan pemicu Amazon S3 untuk membuat gambar thumbnail Dalam tutorial ini, Anda membuat dan mengonfigurasi fungsi Lambda yang mengubah ukuran gambar yang ditambahkan ke bucket Amazon Simple Storage Service (Amazon S3). Saat Anda menambahkan file gambar ke bucket, Amazon S3 akan memanggil fungsi Lambda Anda. Fungsi tersebut kemudian membuat versi thumbnail gambar dan mengeluarkannya ke bucket Amazon S3 yang berbeda. Untuk menyelesaikan tutorial ini, Anda melakukan langkah-langkah berikut: Buat bucket Amazon S3 sumber dan tujuan dan unggah gambar sampel. Buat fungsi Lambda yang mengubah ukuran gambar dan mengeluarkan thumbnail ke bucket Amazon S3. Konfigurasikan pemicu Lambda yang memanggil fungsi Anda saat objek diunggah ke bucket sumber Anda. Uji fungsi Anda, pertama dengan acara dummy, lalu dengan mengunggah gambar ke bucket sumber Anda. Dengan menyelesaikan langkah-langkah ini, Anda akan mempelajari cara menggunakan Lambda untuk menjalankan tugas pemrosesan file pada objek yang ditambahkan ke bucket Amazon S3. Anda dapat menyelesaikan tutorial ini menggunakan AWS Command Line Interface (AWS CLI) atau Konsol Manajemen AWS. Jika Anda mencari contoh sederhana untuk mempelajari cara mengonfigurasi pemicu Amazon S3 untuk Lambda, Anda dapat mencoba Tutorial: Menggunakan pemicu Amazon S3 untuk menjalankan fungsi Lambda. Topik Prasyarat Buat dua ember Amazon S3 Unggah gambar uji ke bucket sumber Anda Membuat kebijakan izin Membuat peran eksekusi Buat paket penerapan fungsi Buat fungsi Lambda Konfigurasikan Amazon S3 untuk menjalankan fungsi Uji fungsi Lambda Anda dengan acara dummy Uji fungsi Anda menggunakan pemicu Amazon S3 Bersihkan sumber daya Anda Prasyarat Jika Anda ingin menggunakan AWS CLI untuk menyelesaikan tutorial, instal versi terbaru dari AWS Command Line Interface . Untuk kode fungsi Lambda Anda, Anda dapat menggunakan Python atau Node.js. Instal alat dukungan bahasa dan manajer paket untuk bahasa yang ingin Anda gunakan. Jika Anda belum menginstal AWS Command Line Interface, ikuti langkah-langkah di Menginstal atau memperbarui versi terbaru AWS CLI untuk menginstalnya . Tutorial ini membutuhkan terminal baris perintah atau shell untuk menjalankan perintah. Di Linux dan macOS, gunakan shell dan manajer paket pilihan Anda. catatan Di Windows, beberapa perintah Bash CLI yang biasa Anda gunakan dengan Lambda ( zip seperti) tidak didukung oleh terminal bawaan sistem operasi. Untuk mendapatkan versi terintegrasi Windows dari Ubuntu dan Bash, instal Windows Subsystem untuk Linux. Buat dua ember Amazon S3 Pertama buat dua ember Amazon S3. Bucket pertama adalah bucket sumber tempat Anda akan mengunggah gambar Anda. Bucket kedua digunakan oleh Lambda untuk menyimpan thumbnail yang diubah ukurannya saat Anda menjalankan fungsi. Konsol Manajemen AWS Untuk membuat bucket Amazon S3 (konsol) Buka konsol Amazon S3 dan pilih halaman Bucket tujuan umum . Pilih yang Wilayah AWS paling dekat dengan lokasi geografis Anda. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda di Wilayah yang sama. Pilih Buat bucket . Pada Konfigurasi umum , lakukan hal berikut: Untuk jenis Bucket , pastikan Tujuan umum dipilih. Untuk nama Bucket , masukkan nama unik global yang memenuhi aturan penamaan Amazon S3 Bucket . Nama bucket hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Biarkan semua opsi lain disetel ke nilai defaultnya dan pilih Buat bucket . Ulangi langkah 1 hingga 5 untuk membuat bucket tujuan Anda. Untuk nama Bucket amzn-s3-demo-source-bucket-resized , masukkan, di amzn-s3-demo-source-bucket mana nama bucket sumber yang baru saja Anda buat. AWS CLI Untuk membuat bucket Amazon S3 ()AWS CLI Jalankan perintah CLI berikut untuk membuat bucket sumber Anda. Nama yang Anda pilih untuk bucket Anda harus unik secara global dan ikuti aturan penamaan Amazon S3 Bucket . Nama hanya dapat berisi huruf kecil, angka, titik (.), dan tanda hubung (-). Untuk region dan LocationConstraint , pilih yang paling Wilayah AWS dekat dengan lokasi geografis Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Kemudian dalam tutorial, Anda harus membuat fungsi Lambda Anda Wilayah AWS sama dengan bucket sumber Anda, jadi catat wilayah yang Anda pilih. Jalankan perintah berikut untuk membuat bucket tujuan Anda. Untuk nama bucket, Anda harus menggunakan amzn-s3-demo-source-bucket-resized , di amzn-s3-demo-source-bucket mana nama bucket sumber yang Anda buat di langkah 1. Untuk region dan LocationConstraint , pilih yang sama dengan yang Wilayah AWS Anda gunakan untuk membuat bucket sumber Anda. aws s3api create-bucket --bucket amzn-s3-demo-source-bucket-resized --region us-east-1 \ --create-bucket-configuration LocationConstraint= us-east-1 Unggah gambar uji ke bucket sumber Anda Kemudian dalam tutorial, Anda akan menguji fungsi Lambda Anda dengan memanggilnya menggunakan atau konsol Lambda. AWS CLI Untuk mengonfirmasi bahwa fungsi Anda beroperasi dengan benar, bucket sumber Anda harus berisi gambar uji. Gambar ini dapat berupa file JPG atau PNG yang Anda pilih. Konsol Manajemen AWS Untuk mengunggah gambar uji ke bucket sumber Anda (konsol) Buka halaman Bucket konsol Amazon S3. Pilih bucket sumber yang Anda buat di langkah sebelumnya. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih objek yang ingin Anda unggah. Pilih Buka , lalu pilih Unggah . AWS CLI Untuk mengunggah gambar uji ke bucket sumber Anda (AWS CLI) Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key HappyFace.jpg --body ./HappyFace.jpg Membuat kebijakan izin Langkah pertama dalam membuat fungsi Lambda Anda adalah membuat kebijakan izin. Kebijakan ini memberi fungsi Anda izin yang diperlukan untuk mengakses AWS sumber daya lain. Untuk tutorial ini, kebijakan memberikan izin baca dan tulis Lambda untuk bucket Amazon S3 dan memungkinkannya untuk menulis ke Amazon Log. CloudWatch Konsol Manajemen AWS Untuk membuat kebijakan (konsol) Buka halaman Kebijakan konsol AWS Identity and Access Management (IAM). Pilih Buat kebijakan . Pilih tab JSON , lalu tempelkan kebijakan khusus berikut ke editor JSON. { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Pilih Berikutnya . Di bawah Detail kebijakan , untuk nama Kebijakan , masukkan LambdaS3Policy . Pilih Buat kebijakan . AWS CLI Untuk membuat kebijakan (AWS CLI) Simpan JSON berikut dalam file bernama policy.json . { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogGroup", "logs:CreateLogStream" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::*/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::*/*" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan JSON, jalankan perintah CLI berikut. aws iam create-policy --policy-name LambdaS3Policy --policy-document file://policy.json Membuat peran eksekusi Peran eksekusi adalah peran IAM yang memberikan izin fungsi Lambda untuk mengakses dan sumber daya. Layanan AWS Untuk memberikan akses baca dan tulis fungsi ke bucket Amazon S3, Anda melampirkan kebijakan izin yang Anda buat di langkah sebelumnya. Konsol Manajemen AWS Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda (konsol) Buka halaman Peran konsol (IAM). Pilih Buat peran . Untuk jenis entitas Tepercaya , pilih Layanan AWS , dan untuk kasus Penggunaan , pilih Lambda . Pilih Berikutnya . Tambahkan kebijakan izin yang Anda buat di langkah sebelumnya dengan melakukan hal berikut: Dalam kotak pencarian kebijakan, masukkan LambdaS3Policy . Dalam hasil pencarian, pilih kotak centang untuk LambdaS3Policy . Pilih Berikutnya . Di bawah Rincian peran , untuk nama Peran masuk LambdaS3Role . Pilih Buat peran . AWS CLI Untuk membuat peran eksekusi dan melampirkan kebijakan izin Anda ()AWS CLI Simpan JSON berikut dalam file bernama trust-policy.json . Kebijakan kepercayaan ini memungkinkan Lambda untuk menggunakan izin peran dengan memberikan lambda.amazonaws.com izin utama layanan untuk memanggil tindakan AWS Security Token Service ()AWS STS. AssumeRole { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } Dari direktori tempat Anda menyimpan dokumen kebijakan kepercayaan JSON, jalankan perintah CLI berikut untuk membuat peran eksekusi. aws iam create-role --role-name LambdaS3Role --assume-role-policy-document file://trust-policy.json Untuk melampirkan kebijakan izin yang Anda buat pada langkah sebelumnya, jalankan perintah CLI berikut. Ganti Akun AWS nomor di ARN polis dengan nomor akun Anda sendiri. aws iam attach-role-policy --role-name LambdaS3Role --policy-arn arn:aws:iam:: 123456789012 :policy/LambdaS3Policy Buat paket penerapan fungsi Untuk membuat fungsi Anda, Anda membuat paket deployment yang berisi kode fungsi dan dependensinya. Untuk CreateThumbnail fungsi ini, kode fungsi Anda menggunakan pustaka terpisah untuk mengubah ukuran gambar. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat paket penyebaran yang berisi pustaka yang diperlukan. Node.js Untuk membuat paket penyebaran (Node.js) Buat direktori bernama lambda-s3 untuk kode fungsi dan dependensi Anda dan navigasikan ke dalamnya. mkdir lambda-s3 cd lambda-s3 Buat proyek Node.js baru dengan npm . Untuk menerima opsi default yang disediakan dalam pengalaman interaktif, tekan Enter . npm init Simpan kode fungsi berikut dalam file bernama index.mjs . Pastikan untuk mengganti us-east-1 dengan Wilayah AWS di mana Anda membuat ember sumber dan tujuan Anda sendiri. // dependencies import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { Readable } from 'stream'; import sharp from 'sharp'; import util from 'util'; // create S3 client const s3 = new S3Client( { region: 'us-east-1' }); // define the handler function export const handler = async (event, context) => { // Read options from the event parameter and get the source bucket console.log("Reading options from event:\n", util.inspect(event, { depth: 5})); const srcBucket = event.Records[0].s3.bucket.name; // Object key may have spaces or unicode non-ASCII characters const srcKey = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket + "-resized"; const dstKey = "resized-" + srcKey; // Infer the image type from the file suffix const typeMatch = srcKey.match(/\.([^.]*)$/); if (!typeMatch) { console.log("Could not determine the image type."); return; } // Check that the image type is supported const imageType = typeMatch[1].toLowerCase(); if (imageType != "jpg" && imageType != "png") { console.log(`Unsupported image type: $ { imageType}`); return; } // Get the image from the source bucket. GetObjectCommand returns a stream. try { const params = { Bucket: srcBucket, Key: srcKey }; var response = await s3.send(new GetObjectCommand(params)); var stream = response.Body; // Convert stream to buffer to pass to sharp resize function. if (stream instanceof Readable) { var content_buffer = Buffer.concat(await stream.toArray()); } else { throw new Error('Unknown object stream type'); } } catch (error) { console.log(error); return; } // set thumbnail width. Resize will set the height automatically to maintain aspect ratio. const width = 200; // Use the sharp module to resize the image and save in a buffer. try { var output_buffer = await sharp(content_buffer).resize(width).toBuffer(); } catch (error) { console.log(error); return; } // Upload the thumbnail image to the destination bucket try { const destparams = { Bucket: dstBucket, Key: dstKey, Body: output_buffer, ContentType: "image" }; const putResult = await s3.send(new PutObjectCommand(destparams)); } catch (error) { console.log(error); return; } console.log('Successfully resized ' + srcBucket + '/' + srcKey + ' and uploaded to ' + dstBucket + '/' + dstKey); }; Di lambda-s3 direktori Anda, instal perpustakaan tajam menggunakan npm. Perhatikan bahwa versi terbaru dari sharp (0.33) tidak kompatibel dengan Lambda. Instal versi 0.32.6 untuk menyelesaikan tutorial ini. npm install sharp@0.32.6 install Perintah npm membuat node_modules direktori untuk modul Anda. Setelah langkah ini, struktur direktori Anda akan terlihat seperti berikut. lambda-s3 |- index.mjs |- node_modules | |- base64js | |- bl | |- buffer ... |- package-lock.json |- package.json Buat paket deployment .zip yang berisi kode fungsi Anda dan dependensinya. Di macOS dan Linux, jalankan perintah berikut. zip -r function.zip . Di Windows, gunakan utilitas zip pilihan Anda untuk membuat file.zip. Pastikan bahwa package-lock.json file index.mjs package.json ,, dan node_modules direktori Anda semuanya berada di root file.zip Anda. Python Untuk membuat paket penyebaran (Python) Simpan kode contoh sebagai file bernama lambda_function.py . import boto3 import os import sys import uuid from urllib.parse import unquote_plus from PIL import Image import PIL.Image s3_client = boto3.client('s3') def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 2 for x in image.size)) image.save(resized_path) def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = unquote_plus(record['s3']['object']['key']) tmpkey = key.replace('/', '') download_path = '/tmp/ { } { }'.format(uuid.uuid4(), tmpkey) upload_path = '/tmp/resized- { }'.format(tmpkey) s3_client.download_file(bucket, key, download_path) resize_image(download_path, upload_path) s3_client.upload_file(upload_path, ' { }-resized'.format(bucket), 'resized- { }'.format(key)) Di direktori yang sama di mana Anda membuat lambda_function.py file Anda, buat direktori baru bernama package dan instal pustaka Pillow (PIL) dan AWS SDK untuk Python (Boto3). Meskipun runtime Lambda Python menyertakan versi Boto3 SDK, kami menyarankan agar Anda menambahkan semua dependensi fungsi Anda ke paket penerapan Anda, meskipun mereka disertakan dalam runtime. Untuk informasi selengkapnya, lihat Dependensi runtime dengan Python. mkdir package pip install \ --platform manylinux2014_x86_64 \ --target=package \ --implementation cp \ --python-version 3.12 \ --only-binary=:all: --upgrade \ pillow boto3 Pustaka Pillow berisi kode C/C ++. Dengan menggunakan --only-binary=:all: opsi --platform manylinux_2014_x86_64 dan, pip akan mengunduh dan menginstal versi Pillow yang berisi binari pra-kompilasi yang kompatibel dengan sistem operasi Amazon Linux 2. Ini memastikan bahwa paket penerapan Anda akan berfungsi di lingkungan eksekusi Lambda, terlepas dari sistem operasi dan arsitektur mesin build lokal Anda. Buat file.zip yang berisi kode aplikasi Anda dan pustaka Pillow dan Boto3. Di Linux atau macOS, jalankan perintah berikut dari antarmuka baris perintah Anda. cd package zip -r ../lambda_function.zip . cd .. zip lambda_function.zip lambda_function.py Di Windows, gunakan alat zip pilihan Anda untuk membuat file lambda_function.zip . Pastikan bahwa lambda_function.py file Anda dan folder yang berisi dependensi Anda semuanya berada di root file.zip. Anda juga dapat membuat paket deployment menggunakan lingkungan virtual Python. Lihat Bekerja dengan arsip file.zip untuk fungsi Python Lambda Buat fungsi Lambda Anda dapat membuat fungsi Lambda menggunakan konsol Lambda AWS CLI atau Lambda. Ikuti instruksi untuk bahasa yang Anda pilih untuk membuat fungsi. Konsol Manajemen AWS Untuk membuat fungsi (konsol) Untuk membuat fungsi Lambda Anda menggunakan konsol, pertama-tama Anda membuat fungsi dasar yang berisi beberapa kode 'Hello world'. Anda kemudian mengganti kode ini dengan kode fungsi Anda sendiri dengan mengunggah file the.zip atau JAR yang Anda buat pada langkah sebelumnya. Buka halaman Fungsi di konsol Lambda. Pastikan Anda bekerja di tempat yang sama dengan saat Wilayah AWS Anda membuat bucket Amazon S3. Anda dapat mengubah wilayah Anda menggunakan daftar drop-down di bagian atas layar. Pilih Buat fungsi . Pilih Penulis dari scratch . Di bagian Informasi dasar , lakukan hal berikut: Untuk Nama fungsi , masukkan CreateThumbnail . Untuk Runtime , pilih Node.js 22.x atau Python 3.12 sesuai dengan bahasa yang Anda pilih untuk fungsi Anda. Untuk Arsitektur , pilih x86_64 . Di tab Ubah peran eksekusi default , lakukan hal berikut: Perluas tab, lalu pilih Gunakan peran yang ada . Pilih yang LambdaS3Role Anda buat sebelumnya. Pilih Buat fungsi . Untuk mengunggah kode fungsi (konsol) Di panel Sumber kode , pilih Unggah dari . Pilih file.zip . Pilih Unggah . Di pemilih file, pilih file.zip Anda dan pilih Buka. Pilih Simpan . AWS CLI Untuk membuat fungsi (AWS CLI) Jalankan perintah CLI untuk bahasa yang Anda pilih. Untuk role parameter, pastikan untuk mengganti 123456789012 dengan Akun AWS ID Anda sendiri. Untuk region parameternya, ganti us-east-1 dengan wilayah tempat Anda membuat bucket Amazon S3. Untuk Node.js , jalankan perintah berikut dari direktori yang berisi function.zip file Anda. aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs24.x \ --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Untuk Python , jalankan perintah berikut dari direktori yang berisi file Anda lambda_function.zip . aws lambda create-function --function-name CreateThumbnail \ --zip-file fileb://lambda_function.zip --handler lambda_function.lambda_handler \ --runtime python3.14 --timeout 10 --memory-size 1024 \ --role arn:aws:iam:: 123456789012 :role/LambdaS3Role --region us-east-1 Konfigurasikan Amazon S3 untuk menjalankan fungsi Agar fungsi Lambda dapat berjalan saat mengunggah gambar ke bucket sumber, Anda perlu mengonfigurasi pemicu untuk fungsi Anda. Anda dapat mengonfigurasi pemicu Amazon S3 menggunakan konsol atau. AWS CLI penting Prosedur ini mengonfigurasi bucket Amazon S3 untuk menjalankan fungsi Anda setiap kali objek dibuat di bucket. Pastikan untuk mengonfigurasi ini hanya di bucket sumber. Jika fungsi Lambda Anda membuat objek dalam bucket yang sama yang memanggilnya, fungsi Anda dapat dipanggil terus menerus dalam satu loop. Hal ini dapat mengakibatkan biaya yang tidak diharapkan ditagih ke Anda Akun AWS. Konsol Manajemen AWS Untuk mengonfigurasi pemicu Amazon S3 (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih Tambahkan pemicu . Pilih S3 . Di bawah Bucket , pilih bucket sumber Anda. Di bawah Jenis acara , pilih Semua objek membuat acara . Di bawah Pemanggilan rekursif , pilih kotak centang untuk mengetahui bahwa tidak disarankan menggunakan bucket Amazon S3 yang sama untuk input dan output. Anda dapat mempelajari lebih lanjut tentang pola pemanggilan rekursif di Lambda dengan membaca pola rekursif yang menyebabkan fungsi Lambda yang tidak terkendali di Tanah Tanpa Server. Pilih Tambahkan . Saat Anda membuat pemicu menggunakan konsol Lambda, Lambda secara otomatis membuat kebijakan berbasis sumber daya untuk memberikan layanan yang Anda pilih izin untuk menjalankan fungsi Anda. AWS CLI Untuk mengonfigurasi pemicu Amazon S3 ()AWS CLI Agar bucket sumber Amazon S3 menjalankan fungsi saat menambahkan file gambar, pertama-tama Anda harus mengonfigurasi izin untuk fungsi menggunakan kebijakan berbasis sumber daya. Pernyataan kebijakan berbasis sumber daya memberikan Layanan AWS izin lain untuk menjalankan fungsi Anda. Untuk memberikan izin Amazon S3 untuk menjalankan fungsi Anda, jalankan perintah CLI berikut. Pastikan untuk mengganti source-account parameter dengan Akun AWS ID Anda sendiri dan menggunakan nama bucket sumber Anda sendiri. aws lambda add-permission --function-name CreateThumbnail \ --principal s3.amazonaws.com --statement-id s3invoke --action "lambda:InvokeFunction" \ --source-arn arn:aws:s3::: amzn-s3-demo-source-bucket \ --source-account 123456789012 Kebijakan yang Anda tetapkan dengan perintah ini memungkinkan Amazon S3 untuk menjalankan fungsi Anda hanya ketika tindakan dilakukan di bucket sumber Anda. catatan Meskipun nama bucket Amazon S3 unik secara global, saat menggunakan kebijakan berbasis sumber daya, praktik terbaik adalah menentukan bahwa bucket harus menjadi milik akun Anda. Ini karena jika Anda menghapus bucket, Anda dapat membuat bucket dengan Amazon Resource Name (ARN) yang sama. Akun AWS Simpan JSON berikut dalam file bernama notification.json . Saat diterapkan ke bucket sumber Anda, JSON ini mengonfigurasi bucket untuk mengirim notifikasi ke fungsi Lambda Anda setiap kali objek baru ditambahkan. Ganti Akun AWS nomor dan Wilayah AWS dalam fungsi Lambda ARN dengan nomor akun dan wilayah Anda sendiri. { "LambdaFunctionConfigurations": [ { "Id": "CreateThumbnailEventConfiguration", "LambdaFunctionArn": "arn:aws:lambda: us-east-1:123456789012 :function:CreateThumbnail", "Events": [ "s3:ObjectCreated:Put" ] } ] } Jalankan perintah CLI berikut untuk menerapkan pengaturan notifikasi dalam file JSON yang Anda buat ke bucket sumber Anda. Ganti amzn-s3-demo-source-bucket dengan nama bucket sumber Anda sendiri. aws s3api put-bucket-notification-configuration --bucket amzn-s3-demo-source-bucket \ --notification-configuration file://notification.json Untuk mempelajari lebih lanjut tentang put-bucket-notification-configuration perintah dan notification-configuration opsi, lihat put-bucket-notification-configuration di Referensi Perintah AWS CLI . Uji fungsi Lambda Anda dengan acara dummy Sebelum menguji seluruh penyiapan dengan menambahkan file gambar ke bucket sumber Amazon S3, Anda menguji apakah fungsi Lambda berfungsi dengan benar dengan memanggilnya dengan acara dummy. Peristiwa di Lambda adalah dokumen berformat JSON yang berisi data untuk diproses fungsi Anda. Saat fungsi Anda dipanggil oleh Amazon S3, peristiwa yang dikirim ke fungsi berisi informasi seperti nama bucket, ARN bucket, dan kunci objek. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda dengan acara dummy (konsol) Buka halaman Fungsi konsol Lambda dan pilih fungsi Anda () CreateThumbnail . Pilih tab Uji . Untuk membuat acara pengujian, di panel acara Uji , lakukan hal berikut: Di bawah Uji tindakan peristiwa , pilih Buat acara baru . Untuk Nama peristiwa , masukkan myTestEvent . Untuk Template , pilih S3 Put . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri. Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Pilih Simpan . Di panel acara Uji , pilih Uji . Untuk memeriksa fungsi Anda telah membuat verison yang diubah ukurannya dari gambar Anda dan menyimpannya di bucket Amazon S3 target Anda, lakukan hal berikut: Buka halaman Bucket konsol Amazon S3. Pilih bucket target Anda dan konfirmasikan bahwa file yang diubah ukurannya tercantum di panel Objects . AWS CLI Untuk menguji fungsi Lambda Anda dengan acara dummy ()AWS CLI Simpan JSON berikut dalam file bernama dummyS3Event.json . Ganti nilai untuk parameter berikut dengan nilai Anda sendiri: Untuk awsRegion , ganti us-east-1 dengan bucket Amazon S3 yang Wilayah AWS Anda buat. Untuk name , ganti amzn-s3-demo-bucket dengan nama bucket sumber Amazon S3 Anda sendiri. Untuk key , ganti test%2Fkey dengan nama file objek pengujian yang Anda unggah ke bucket sumber di langkah tersebut. Unggah gambar uji ke bucket sumber Anda { "Records": [ { "eventVersion": "2.0", "eventSource": "aws:s3", "awsRegion": "us-east-1" , "eventTime": "1970-01-01T00:00:00.000Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "EXAMPLE" }, "requestParameters": { "sourceIPAddress": "127.0.0.1" }, "responseElements": { "x-amz-request-id": "EXAMPLE123456789", "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "testConfigRule", "bucket": { "name": "amzn-s3-demo-bucket" , "ownerIdentity": { "principalId": "EXAMPLE" }, "arn": "arn:aws:s3:::amzn-s3-demo-bucket" }, "object": { "key": "test%2Fkey" , "size": 1024, "eTag": "0123456789abcdef0123456789abcdef", "sequencer": "0A1B2C3D4E5F678901" } } } ] } Dari direktori tempat Anda menyimpan dummyS3Event.json file Anda, panggil fungsi dengan menjalankan perintah CLI berikut. Perintah ini memanggil fungsi Lambda Anda secara sinkron dengan RequestResponse menentukan sebagai nilai parameter tipe pemanggilan. Untuk mempelajari lebih lanjut tentang pemanggilan sinkron dan asinkron, lihat Memanggil fungsi Lambda. aws lambda invoke --function-name CreateThumbnail \ --invocation-type RequestResponse --cli-binary-format raw-in-base64-out \ --payload file://dummyS3Event.json outputfile.txt cli-binary-formatOpsi ini diperlukan jika Anda menggunakan versi 2 dari AWS CLI. Untuk menjadikan ini pengaturan default, jalankan aws configure set cli-binary-format raw-in-base64-out . Untuk informasi selengkapnya, lihat opsi baris perintah global yang AWS CLI didukung . Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Anda akan melihat output seperti yang berikut ini. Key Parameter menunjukkan nama file file gambar Anda yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-06T21:40:07+00:00", "ETag": "\"d8ca652ffe83ba6b721ffc20d9d7174a\"", "Size": 2633, "StorageClass": "STANDARD" } ] } Uji fungsi Anda menggunakan pemicu Amazon S3 Sekarang setelah Anda mengonfirmasi bahwa fungsi Lambda Anda beroperasi dengan benar, Anda siap untuk menguji penyiapan lengkap Anda dengan menambahkan file gambar ke bucket sumber Amazon S3 Anda. Saat Anda menambahkan gambar ke bucket sumber, fungsi Lambda Anda akan dipanggil secara otomatis. Fungsi Anda membuat versi file yang diubah ukurannya dan menyimpannya di bucket target Anda. Konsol Manajemen AWS Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 (konsol) Untuk mengunggah gambar ke bucket Amazon S3 Anda, lakukan hal berikut: Buka halaman Bucket di konsol Amazon S3 dan pilih bucket sumber Anda. Pilih Unggah . Pilih Tambahkan file dan gunakan pemilih file untuk memilih file gambar yang ingin Anda unggah. Objek gambar Anda dapat berupa file.jpg atau.png. Pilih Buka , lalu pilih Unggah . Verifikasi bahwa Lambda telah menyimpan versi file gambar yang diubah ukurannya di bucket target dengan melakukan hal berikut: Arahkan kembali ke halaman Bucket di konsol Amazon S3 dan pilih bucket tujuan Anda. Di panel Objects , Anda sekarang akan melihat dua file gambar yang diubah ukurannya, satu dari setiap pengujian fungsi Lambda Anda. Untuk mengunduh gambar yang diubah ukurannya, pilih file, lalu pilih Unduh . AWS CLI Untuk menguji fungsi Lambda Anda menggunakan pemicu Amazon S3 ()AWS CLI Dari direktori yang berisi gambar yang ingin Anda unggah, jalankan perintah CLI berikut. Ganti --bucket parameter dengan nama bucket sumber Anda. Untuk --body parameter --key dan, gunakan nama file gambar pengujian Anda. Gambar uji Anda dapat berupa file.jpg atau.png. aws s3api put-object --bucket amzn-s3-demo-source-bucket --key SmileyFace.jpg --body ./SmileyFace.jpg Verifikasi bahwa fungsi Anda telah membuat versi thumbnail gambar Anda dan menyimpannya ke bucket Amazon S3 target Anda. Jalankan perintah CLI berikut, ganti amzn-s3-demo-source-bucket-resized dengan nama bucket tujuan Anda sendiri. aws s3api list-objects-v2 --bucket amzn-s3-demo-source-bucket-resized Jika fungsi Anda berjalan dengan sukses, Anda akan melihat output yang mirip dengan berikut ini. Bucket target Anda sekarang harus berisi dua file yang diubah ukurannya. { "Contents": [ { "Key": "resized-HappyFace.jpg", "LastModified": "2023-06-07T00:15:50+00:00", "ETag": "\"7781a43e765a8301713f533d70968a1e\"", "Size": 2763, "StorageClass": "STANDARD" }, { "Key": "resized-SmileyFace.jpg", "LastModified": "2023-06-07T00:13:18+00:00", "ETag": "\"ca536e5a1b9e32b22cd549e18792cdbc\"", "Size": 1245, "StorageClass": "STANDARD" } ] } Bersihkan sumber daya Anda Sekarang Anda dapat menghapus sumber daya yang Anda buat untuk tutorial ini, kecuali Anda ingin mempertahankannya. Dengan menghapus AWS sumber daya yang tidak lagi Anda gunakan, Anda mencegah tagihan yang tidak perlu ke Anda Akun AWS. Untuk menghapus fungsi Lambda Buka halaman Fungsi di konsol Lambda. Pilih fungsi yang Anda buat. Pilih Tindakan , Hapus . Ketik confirm kolom input teks dan pilih Hapus . Untuk menghapus kebijakan yang Anda buat. Buka halaman Kebijakan konsol IAM. Pilih kebijakan yang Anda buat ( AWSLambdaS3Policy ). Pilih Tindakan kebijakan , Hapus . Pilih Hapus . Untuk menghapus peran eksekusi Buka halaman Peran dari konsol IAM. Pilih peran eksekusi yang Anda buat. Pilih Hapus . Masukkan nama peran di bidang input teks dan pilih Hapus . Untuk menghapus bucket S3 Buka konsol Amazon S3 . Pilih bucket yang Anda buat. Pilih Hapus . Masukkan nama ember di bidang input teks. Pilih Hapus bucket . Javascript dinonaktifkan atau tidak tersedia di browser Anda. Untuk menggunakan Dokumentasi AWS, Javascript harus diaktifkan. Lihat halaman Bantuan browser Anda untuk petunjuk. Konvensi Dokumen Tutorial: Menggunakan pemicu S3 Secrets Manager Apakah halaman ini membantu Anda? - Ya Terima kasih telah memberitahukan bahwa hasil pekerjaan kami sudah baik. Jika Anda memiliki waktu luang, beri tahu kami aspek apa saja yang sudah bagus, agar kami dapat menerapkannya secara lebih luas. Apakah halaman ini membantu Anda? - Tidak Terima kasih telah memberi tahu kami bahwa halaman ini perlu ditingkatkan. Maaf karena telah mengecewakan Anda. Jika Anda memiliki waktu luang, beri tahu kami bagaimana dokumentasi ini dapat ditingkatkan.
2026-01-13T09:30:36
https://vml.visma.ai/prototypes/purchase-lines
About us Who are we? Learn more about Visma Machine Learning What we do Learn more about the products we offer What our customers say Read our customers' testimonials Products Autosuggest Automate your workflow Smartscan Extract data from your documents Resources Blog Product news and showcases Showcase of prototypes Prototypes, ideas and experiments Support Get started Find out more about onboarding to Visma Machine Learning FAQ We have answers to your frequently asked questions. Privacy policy Learn how we handle your data and protect your privacy Cookie policy Learn about how we use cookies to enhance your experience API Documentation Contact Us About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Showcase of prototypes Support Get started FAQ Privacy policy Cookie policy API Documentation Loading... Gærtorvet 1-5 1799 Copenhagen Denmark E-mail: worksmarter@visma.com About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Prototypes Documentation Support Get started FAQ Privacy policy Cookie policy Security Information Operating Status © 2026 Visma Group. All rights reserved Log in You need a Visma account to continue Sign in with Google
2026-01-13T09:30:36
https://aws.amazon.com/interconnect/multicloud/
multicloud Skip to main content Filter: All English Contact us AWS Marketplace Support My account Search Filter: All Sign in to console Create account Interconnect Overview Resources Home › Interconnect › Multicloud AWS Interconnect - multicloud (Preview) Simple, resilient, high-speed private connections to other cloud service providers Read the documentation What is Interconnect - multicloud? AWS Interconnect - multicloud is a new capability that simplifies multicloud connectivity between AWS and other major cloud service providers, starting with Google Cloud. The first purpose-built product of its kind, Interconnect - multicloud is a managed connection that enables customers to establish private, resilient, high-speed network connections with dedicated bandwidth between their Amazon VPCs and other cloud environments. Interconnect - multicloud is easy to configure and enables customers to interconnect AWS networking services such as AWS Transit Gateway, AWS Cloud WAN, and Amazon VPC to other Cloud Service Providers (CSPs) with ease. Benefits Simplify operations Leverage a fully managed, private cloud-to-cloud experience, enabling connectivity with ease. With established prebuilt capacity pools between AWS and other cloud providers, customers can remove physical connections or virtual routing objects from their networks. Streamlined multicloud management Interconnect - multicloud streamlines everything from provisioning to support, improving security posture and increasing reliability for organizations wanting multicloud connectivity. Private connectivity Connections between AWS and cloud service providers are private and use encryption on the physical connections between the AWS router and the other CSP's router, delivering data confidentiality and integrity. How it works Customers no longer have to manually set up complex networks including physical connections and routing protocols. Now, in the AWS Console or Command Line Interface (CLI), customers can get multicloud connectivity in three simple steps: 1/ specify the target cloud service providers, 2/ select the destination region on the other side, and 3/ pick the required bandwidth. Once provisioning is completed, customers receive a single attachment that represents network capacity to their chosen provider. We created a new customer interface and standardized specifications/APIs that other cloud providers such as Google Cloud are adopting. All aspects of the physical infrastructure, capacity scaling ahead of time, and the support experience are now owned by the providers. The API specifications developed for this product are open for other providers and partners to adopt, and aim to standardize and simplify global connectivity for everyone. Google Cloud AWS and Google Cloud collaborated to transform how cloud service providers could connect with each other in a simplified manner. This collaboration introduces a new open specification for network interoperability, enabling customers to establish private, high-speed connectivity between AWS and Google Cloud with high levels of automation and speed. AWS had a vision for developing this capability as a unified specification that could be adopted by any cloud service provider, and collaborated with Google Cloud to bring it to market. Customers no longer need to wait weeks for circuit provisioning—they can now provision dedicated bandwidth on demand and establish connectivity in minutes through their preferred cloud console or API. This solution delivers the highest resiliency by leveraging quad-redundancy across physically redundant interconnect facilities and routers. Both providers engage in continuous monitoring to proactively detect and resolve issues. And this solution utilizes MACsec encryption between the Google Cloud and AWS edge routers.   Salesforce "Integrating Salesforce Data 360 with the broader IT landscape requires robust, private connectivity. AWS Interconnect - multicloud allows us to establish these critical bridges to Google Cloud with the same ease as deploying internal AWS resources, utilizing prebuilt capacity pools and the tools our teams already know and love. This native, streamlined experience—from provisioning through ongoing support—accelerates our customers' ability to ground their AI and analytics in trusted data, regardless of where it resides." Jim Ostrognai, SVP Software Engineering, Salesforce Did you find what you were looking for today? Let us know so we can improve the quality of the content on our pages Yes No Create an AWS account Learn What Is AWS? What Is Cloud Computing? What Is Agentic AI? Cloud Computing Concepts Hub AWS Cloud Security What's New Blogs Press Releases Resources Getting Started Training AWS Trust Center AWS Solutions Library Architecture Center Product and Technical FAQs Analyst Reports AWS Partners Developers Builder Center SDKs & Tools .NET on AWS Python on AWS Java on AWS PHP on AWS JavaScript on AWS Help Contact Us File a Support Ticket AWS re:Post Knowledge Center AWS Support Overview Get Expert Help AWS Accessibility Legal English Back to top Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. x facebook linkedin instagram twitch youtube podcasts email Privacy Site terms Cookie Preferences © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2026-01-13T09:30:36
https://bifromq.apache.org/docs/1.0.x/category/user-guide/
User Guide | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 1.0.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install & Deploy Configuration User Guide Connect to BifroMQ Data Integration API Usage Plugin Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 1.0.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). User Guide Version: 1.0.x User Guide BifroMQ User Guide. 🗃️ Connect to BifroMQ 3 items 🗃️ Data Integration 1 item 🗃️ API Usage 1 item Previous Performance Tuning (Linux) Next Connect to BifroMQ Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://bifromq.apache.org/docs/admin_guide/overview/#__docusaurus_skipToContent_fallback
Admin Guide Overview | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ Next (Incubating) Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation BifroMQ Cluster User Guide Plugin Administration Configuration Tuning Observability Security Benchmark Contribution Administration Version: Next (Incubating) Admin Guide Overview The administration of BifroMQ encompasses two levels: system-level management and tenant-level management. The former is mainly targeted at system administrators and operations personnel, while the requirements for tenant-level management are often intertwined with specific business needs, thereby manifesting more prominently in integrated capabilities. Edit this page Previous Plugin Practice and Notice Next Configuration Overview Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://bifromq.apache.org/docs/1.0.x/category/get-started/#__docusaurus_skipToContent_fallback
Get Started | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 1.0.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install BifroMQ Connect to BifroMQ Install & Deploy Configuration User Guide Plugin Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 1.0.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Get Started Version: 1.0.x Get Started BifroMQ overview introduction, features list, system limitations, release log, etc. 📄️ Install BifroMQ Docker 📄️ Connect to BifroMQ Simple Connection Verification using an MQTT Client Previous Features List Next Install BifroMQ Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://phproundtable.com/show/a-2015-laracon-us-special
PHPRoundtable PHPRoundtable The PHP podcast where everyone has a seat. Guests Library Sponsors About Us 27: A 2015 Laracon US Special Panelists: Taylor Otwell Jeffrey Way Jeremy Mikola Matt Stauffer Adam Wathan August 11 2015 A live recording from Laracon US in Louisville, Kentucky. Big thank you to Jeffrey for continuously sponsoring the "Developer Shout Out" on PHPRoundTable, gives PHPRoundTable the ability to give developers lots of money for being awesome! Technical difficulties begin happening almost immediately. And the show About Us Sponsors © 2026 PHPRoundtable Proud member of the php[architect] family
2026-01-13T09:30:36
https://bifromq.apache.org/docs/1.0.x/category/configuration/
Configuration | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 1.0.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install & Deploy Configuration Overview Configuration file Performance Tuning (Linux) User Guide Plugin Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 1.0.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Configuration Version: 1.0.x Configuration BifroMQ Configuration. 📄️ Overview BifroMQ's system parameters can be configured through configuration file. This section will introduce explain their meanings. 📄️ Configuration file Introduction 📄️ Performance Tuning (Linux) The following Kernel parameters can affect the maximum number of connections that the machine hosting BifroMQ can accept. Previous Deploy Cluster Next Overview Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://bifromq.apache.org/docs/2.1.x/category/operations/
Operations | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 2.1.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install & Deploy Configuration User Guide Plugin Operations TLS High Availability Logs and Observable Operations in API service Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 2.1.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Operations Version: 2.1.x Operations BifroMQ operations. 📄️ TLS Introduction 📄️ High Availability Overview 📄️ Logs and Observable Logging 📄️ Operations in API service If you need to perform proxy subscriptions, unsubscriptions, publish messages, disconnect online devices, or manually Previous BifroMQ Plugin Practice and Notice Next TLS Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://pastebin.com/tools#firefox
Pastebin.com - Tools & Applications Pastebin API tools faq paste Login Sign up Tools & Applications On this page you find tools, add-ons, extensions and applications created for Pastebin.com. If you are a developer and have built something using our API, we can feature your creation with your credits on this page. Be sure to contact us and tell us all about it. 1. Google Chrome Extension ** RECOMMENDED ** 2. Pastebin Manager for Windows 10 3. Pastebin Desktop for Windows 4. iPhone/iPad Application 5. Windows 8 & RT Application 6. Click.to Pastebin for Windows 7. Firefox Add-on 8. HP WebOS Application 9. BlackBerry Application 10. Android Application 11. Pastebin for Android Application 12. Pastebin for Android 13. Pastebin It! desktop tool for Mac OS X 14. Mac OS X Desktop Widget 15. Opera Extension 16. PastebinCL 17. Pastebin Ruby Gem 18. PastebinPython (Python Wrapper) 19. Brush (PHP Wrapper) 20. Pastebin.cs (C# Wrapper) 21. jPastebin (Java Wrapper) 22. Pastebin4Scala (Scala Wrapper) 23. PasteBin IntelliJ IDEA Plugin 24. Pastebin-JS 25. Pastebin Eclipse Plugin 26. Pastebin for Windows Phone 27. Pastebin Manager for Windows Phone 28. Another Pastebin for Windows Desktop 29. ShareX 30. Pastebin WordPress Embed Plugin 31. Share Code for Visual Studio Code 32. PasteToBin for Adobe Brackets Google Chrome Extension ** RECOMMENDED ** With this Google Chrome Extension you are able to create new pastes directly from your browser. A recommended extension for all Pastebin users who use Google Chrome. Version Download API Version Developer 3.0.1 DOWNLOAD 3.0 Joshua Luckers * Download Google Chrome Add-on iPhone/iPad Application ** NOT RECOMMENDED ** With this application you can create new pastes directly from your iOS devices suchs as the iPhone and iPad. Version Download API Version Developer 1.1 DOWNLOAD 3.1 Euphoric Panda (Adrian Hooper) * Download iPhone/iPad Application If you are looking for an iOS app, but didn't like the one above, please check out PasteMe an alternative app. * Download PasteMe (alternative iOS Application) Pastebin Manager for Windows 10 This is a great application for Windows 10. With this application installed you are able to take full advantage of your Pastebin.com account directly from your Windows 10 desktop. Version Download API Version Developer 2016.621 DOWNLOAD 3.0 deHoDev (Stefan Wexel) * Download Pastebin Manager for Window 10 Pastebin Desktop for Windows This is the official Pastebin Desktop application for Windows based computers. With this application installed you are able to take full advantage of your Pastebin.com account directly from your Windows desktop. You will get a small icon in your system tray which will be your access to the full application. You are able to set customized shortcuts which will automatically create a new paste of the text that is stored in your clipboard. This way you never have to lose a code snippet again. This application is totally free and will always remain free. Version Download API Version Developer 1.1 DOWNLOAD 3.0 Leke Dobruna * Download Pastebin Desktop 1.1 via Download.com * Download Pastebin Desktop 1.1 via Pastebin.com Windows 8 & RT Application With this application you can create new pastes directly from your Windows 8 & RT Metro interface. Version Download API Version Developer 1.0 DOWNLOAD 3.0 Victor Häggqvist * Download Windows 8 & RT Application Also for Windows 8 & RT is PasteWin another similar application. Worth checking out :) Click.to Pastebin for Windows Both Pastebin.com and Click.to rely on the copy and paste principle. Pastebin.com provides users with a platform where you can store and share source code. Click.to saves its users clicks between Copy and Paste commands by offering a variety of further uses for copied content. With this new application for Windows you can store all your ctrl+c's instantly online. Version Download API Version Developer 0.92 DOWNLOAD 3.0 Click.to * Download Click.to Pastebin for Windows via Pastebin.com * Download Click.to Pastebin for Mac Firefox Extension With this Firefox Add-on you are able to create new pastes directly from your browser. A recommended add-on for all Pastebin users who use Firefox. Version Download API Version Developer 3.0 DOWNLOAD 3.0 Prafulla Kiran * Download Firefox Extension HP WebOS Application With this application you can create new pastes directly from your HP WebOS devices. Version Download API Version Developer 2.1 DOWNLOAD 3.0 Ben Fysh * Download HP WebOS Application BlackBerry Pastebin Application With this application you can create new pastes directly from your BlackBerry devices. Version Download API Version Developer 1.0.0.2 DOWNLOAD 3.0 Derek Konigsberg * Download BlackBerry Application Android Application With this application you can create new pastes directly from your Android devices. Version Download API Version Developer 2.1 DOWNLOAD 3.0 Jamie Countryman * Download Android Application Pastebin for Android Application With this application you can create new pastes directly from your Android devices. Version Download API Version Developer 2.1 DOWNLOAD 3.0 Jobin Johnson * Download Android Application Pastebin for Android With this application you can create new pastes directly from your Android devices. Version Download API Version Developer 3.0 DOWNLOAD 3.0 Pzy64 * Download Android Application Pastebin It! desktop tool for Mac OS X With this application you can create new pastes directly from your Mac OS X interface. Version Download API Version Developer 1.0 DOWNLOAD 3.1 PrismTechnologyWales * Pastebin It! desktop tool for Mac OS X Mac OS X Desktop Widget You can place this widget on your Mac OS X desktop and create new pastes. Version Download API Version Developer 1.0 DOWNLOAD 3.0 Radek Slupik * Download Mac OS X Desktop Widget Opera Extension With this Opera Extension on you are able to create new pastes directly from your browser. A recommended extension for all Pastebin users who use Opera. Version Download API Version Developer 1.0 DOWNLOAD 3.0 CycaHuH * Download Opera Extension PastebinCL for UNIX (Pastebin command-line) PastebinCL is a small program designed for UNIX based systems to quickly paste any piece of text to Pastebin.com. A manual for PastebinCL can be found here . Version Download API Version Developer 1.0 DOWNLOAD 3.0 Theophile BASTIAN * Download PastebinCL Pastebin Ruby Gem (Pastebin command-line) This is a nifty little tool written in Ruby to quickly paste any piece of text to Pastebin.com. Version Download API Version Developer 2.2 DOWNLOAD 3.0 dougsko * Download Pastebin Ruby Gem jPastebin (Pastebin API wrapper for Java) A complete pastebin.com API wrapper for Java. More information can be found here . Version Download API Version Developer 1.0 DOWNLOAD 3.0 BrianBB * Download jPastebin Pastebin4Scala (Pastebin API wrapper for Scala) A complete pastebin.com API wrapper for Scala. More information can be found here . Version Download API Version Developer 1.0 DOWNLOAD 3.0 lare96 * Download Pastebin4Scala Pastebin IntelliJ IDEA Plugin A great plugin for Pastebin in IntelliJ IDEA. More information can be found here . Version Download API Version Developer 1.0 DOWNLOAD 3.0 Kennedy Oliveira * Download Pastebin IntelliJ Plugin PastebinPython (Pastebin API wrapper for Python) A complete pastebin.com API wrapper for Python. More information can be found here . Version Download API Version Developer 1.0 DOWNLOAD 3.0 Ferdinand E. Silva * Download PastebinPython * Download another Python class for Pastebin API Brush (Pastebin API wrapper for PHP) A complete pastebin.com API wrapper for PHP. More information can be found here . Version Download API Version Developer 1.0 DOWNLOAD 3.0 George Brighton * Download Brush Pastebin.cs (Pastebin API wrapper for C#) A complete pastebin.com API wrapper for C#. More information can be found here . Version Download API Version Developer 1.0 DOWNLOAD 3.0 Tony J. Montana * Download Pastebin.cs Pastebin-JS (NodeJS module for Pastebin) A NodeJS module for the Pastebin API. More information can be found here . Version Download API Version Developer 0.0.1 DOWNLOAD 3.0 Jelte Lagendijk * Download Pastebin-JS Pastebin Eclipse Plugin Make and manage your pastebin code from Eclipse without restrictions. Version Download API Version Developer 1.0 DOWNLOAD 3.0 Miclen * Download Pastebin Eclipse Plugin Pastebin for Windows Phone With this application you can create new pastes directly from your Windows Phone devices. Version Download API Version Developer 1.0 DOWNLOAD 3.0 Alexander Schuc * Download Pastebin for Windows Phone Pastebin Manager for Windows Phone With this application you can create new pastes directly from your Windows Phone devices. Version Download API Version Developer 1.0.0.1 DOWNLOAD 3.0 deHoDev (Stefan Wexel) * Download Pastebin Manager for Windows Phone Also for Windows Phone is Paste It! another similar application. Worth checking out :) Another Pastebin for Windows Desktop With this application installed you are able to take full advantage of your Pastebin.com account directly from your Windows desktop. Version Download API Version Developer 1.6 DOWNLOAD 3.1 SoftwareSpot * Download Another Pastebin for Windows Desktop ShareX With this application installed you are able to instantly upload your clipboard's content to Pastebin. This program can also be used for many other things, such as image uploading. Version Download API Version Developer 9.4.2 DOWNLOAD 3.1 ShareX * Download ShareX Pastebin WordPress Embed Plugin Using this plugin you can embed content from Pastebin to your WordPress post/page using nothing but a URL. Just copy the paste URL from pastebin.com and paste it to your post. Version Download API Version Developer 1.0 DOWNLOAD 3.1 Rami Yushuvaev * Download Pastebin WordPress Embed Plugin Share Code for Visual Studio Code Quickly upload your code to Pastebin with this handy Share Code extension for Visual Studio Code. Version Download API Version Developer 1.0 DOWNLOAD 3.1 Roland Greim * Download Share Code for Visual Studio Code PasteToBin for Adobe Brackets Adobe Brackets extension that allows upload snippets to pastebin quickly. Version Download API Version Developer 1.0 DOWNLOAD 3.1 Wojciech Połowniak * Download PasteToBin for Adobe Brackets Public Pastes Untitled 8 min ago | 0.94 KB Untitled 18 min ago | 0.94 KB Untitled 29 min ago | 0.94 KB Untitled 39 min ago | 0.94 KB Untitled 49 min ago | 0.94 KB Untitled 59 min ago | 0.94 KB Untitled 1 hour ago | 10.19 KB Untitled 3 hours ago | 13.48 KB create new paste  /  syntax languages  /  archive  /  faq  /  tools  /  night mode  /  api  /  scraping api  /  news  /  pro privacy statement  /  cookies policy  /  terms of service  /  security disclosure  /  dmca  /  report abuse  /  contact By using Pastebin.com you agree to our cookies policy to enhance your experience. Site design & logo © 2026 Pastebin We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy .   OK, I Understand Not a member of Pastebin yet? Sign Up , it unlocks many cool features!  
2026-01-13T09:30:36
https://aws.amazon.com/privatelink/
VPC Networking – AWS PrivateLink – Amazon Web Services Skip to main content Filter: All English Contact us AWS Marketplace Support My account Search Filter: All Sign in to console Create account AWS PrivateLink Overview Features Pricing Customers Partners More Products › Networking and Content Delivery › AWS PrivateLink AWS PrivateLink Establish connectivity between VPCs and AWS services without exposing data to the internet Get started with PrivateLink Benefits Secure your traffic Secure your traffic by using private IP addresses when exchanging data with services and resources outside your VPC. Connect with simplified management rules Connect with simplified network and firewall management rules and reduced data output and NAT costs. Accelerate cloud migrations Accelerate cloud migrations by combining PrivateLink with AWS Direct Connect or a VPN. Stay compliant with regulations Deliver SaaS services while staying compliant with HIPAA, EU-US Privacy Shield, PCI, and other regulations. Why AWS PrivateLink? Learn how PrivateLink makes it easier to connect services and resources across different AWS accounts and VPCs to simplify your network architecture. AWS PrivateLink provides private connectivity between virtual private clouds (VPCs), supported services and resources, and your on-premises networks, without exposing your traffic to the public internet. Interface VPC endpoints, powered by PrivateLink, connect you to services hosted by AWS and AWS Partners and supported solutions available in AWS Marketplace. Gateway Load Balancer VPC endpoints connect you to appliances. Resource VPC endpoints powered by PrivateLink connect you to VPC resources such as Amazon Relational Database Service (Amazon RDS) databases, and domain names and IP addresses in other VPCs and accounts. Service network VPC endpoints connect you to Amazon VPC Lattice service networks. Play Use cases Securely access AWS services Connect to AWS services from your VPC and on premises, and transfer critical data in a private, secure, scalable manner. Maintain regulatory compliance Prevent sensitive data, such as customer records, from traversing the internet to maintain compliance with regulations such as HIPAA, EU-US Privacy Shield, and PCI. Migrate to a hybrid cloud Connect on-premises applications and data to SaaS applications hosted on AWS securely and realize a hybrid cloud architecture. Deliver SaaS services on APN AWS Partners offer services hosted directly on a private network, yet are securely accessible from the cloud and on premises. Securely access VPC resources Connect to VPC resources privately, securely, and at scale from your VPCs and on premises. Get started Features page Check out PrivateLink features Learn more Getting started Find services available over PrivateLink Visit AWS Marketplace Console Ready to build? Start building Create an AWS account Learn What Is AWS? What Is Cloud Computing? What Is Agentic AI? Cloud Computing Concepts Hub AWS Cloud Security What's New Blogs Press Releases Resources Getting Started Training AWS Trust Center AWS Solutions Library Architecture Center Product and Technical FAQs Analyst Reports AWS Partners Developers Builder Center SDKs & Tools .NET on AWS Python on AWS Java on AWS PHP on AWS JavaScript on AWS Help Contact Us File a Support Ticket AWS re:Post Knowledge Center AWS Support Overview Get Expert Help AWS Accessibility Legal English Back to top Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. x facebook linkedin instagram twitch youtube podcasts email Privacy Site terms Cookie Preferences © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2026-01-13T09:30:36
https://aws.amazon.com/?nc2=h_lg
Cloud Computing Services - Amazon Web Services (AWS) Skip to main content Filter: All English Contact us AWS Marketplace Support My account Search Filter: All Sign in to console Create account What's new Catch up on the most talked-about launches, updates, and success stories across AWS. Loading Loading Loading Loading Loading From startups to enterprises—AWS is how leaders power innovation Join the largest global community of innovators who trust AWS to accelerate transformation and redefine industries. View more stories 1 / 5 Software & Internet Adobe delivers marketing ROI using AWS View the story Artificial Intelligence WRITER is the end-to-end platform for enterprises to build, activate, and supervise AI agents View the story Media & Entertainment Condé Nast modernizes century-old publishing with new data and AI strategy on AWS View the story Advertising & Marketing Pinterest drives visual discovery for 600 million monthly users with AI on AWS View the story Aerospace & Satellite Blue Origin advances space exploration with agentic AI on AWS View the story I want to see new customer stories in healthcare Powering what’s next in every industry Discover how AWS helps organizations in every sector build, scale, and transform. Explore AWS for your industry Loading Loading Loading Loading Loading AWS Global Infrastructure The AWS Cloud spans 120 Availability Zones within 38 Geographic Regions, with announced plans for 10 more Availability Zones and 3 more AWS Regions in the Kingdom of Saudi Arabia, Chile, and the AWS European Sovereign Cloud. North America South America Europe Middle East Africa Asia Pacific Australia and New Zealand AWS Coverage Regions North America Geographic Regions 9 AWS GovCloud (US-East) AWS GovCloud (US-West) Canada (Central) Canada West (Calgary) Mexico (Central) US West (Northern California) US East (Northern Virginia) US East (Ohio) US West (Oregon) Available Coming soon Edge Locations 31 The AWS Cloud in North America has 31 Availability Zones within 9 Geographic Regions, with 31 Edge Network Locations and 3 Edge Cache Locations. Ashburn, VA Atlanta GA Boston, MA Chicago, IL Columbus, OH Dallas/Fort Worth, TX Denver, CO Hayward, CA Houston, TX Jacksonville, FL Kansas City, MO Los Angeles, CA Miami, FL Minneapolis, MN Montreal, QC Nashville, TN New York, NY Newark, NJ Palo Alto, CA Phoenix, AZ Philadelphia, PA Portland, OR Queretaro, MX Salt Lake City, UT San Jose, CA Seattle, WA South Bend, IN St. Louis, MO Tampa Bay, FL Toronto, ON Washington D.C. I want to try AWS for free Did you find what you were looking for today? Let us know so we can improve the quality of the content on our pages Yes No Create an AWS account Learn What Is AWS? What Is Cloud Computing? What Is Agentic AI? Cloud Computing Concepts Hub AWS Cloud Security What's New Blogs Press Releases Resources Getting Started Training AWS Trust Center AWS Solutions Library Architecture Center Product and Technical FAQs Analyst Reports AWS Partners Developers Builder Center SDKs & Tools .NET on AWS Python on AWS Java on AWS PHP on AWS JavaScript on AWS Help Contact Us File a Support Ticket AWS re:Post Knowledge Center AWS Support Overview Get Expert Help AWS Accessibility Legal English Back to top Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. x facebook linkedin instagram twitch youtube podcasts email Privacy Site terms Cookie Preferences © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2026-01-13T09:30:36
https://github.com/geekcom/felicio
GitHub - geekcom/felicio: A simple AWS SQS Messages with PHP Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection Stop leaks before they start EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events & webinars Ebooks & reports Business insights GitHub Skills SUPPORT & SERVICES Documentation Customer support Community forum Trust center Partners Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} geekcom / felicio Public Notifications You must be signed in to change notification settings Fork 3 Star 10 A simple AWS SQS Messages with PHP License MIT license 10 stars 3 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings Code Issues 0 Pull requests 3 Actions Projects 0 Security Uh oh! There was an error while loading. Please reload this page . Insights Additional navigation options Code Issues Pull requests Actions Projects Security Insights geekcom/felicio   master Branches Tags Go to file Code Open more actions menu Folders and files Name Name Last commit message Last commit date Latest commit   History 44 Commits .docker .docker     src src     tests tests     .felicio.example .felicio.example     .gitignore .gitignore     CHANGELOG.md CHANGELOG.md     LICENSE.md LICENSE.md     README.md README.md     composer.json composer.json     composer.lock composer.lock     docker-compose.yml docker-compose.yml     phpcs.xml phpcs.xml     phpunit.xml.dist phpunit.xml.dist     View all files Repository files navigation README MIT license Felicio A simple AWS SQS Messages with PHP About Felicio and SQS Felicio is a simple library to manipulate AWS SQS Messages . Simple; Configurable; Testable; Open source. Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. Installation Install Composer if you don't have it. composer require geekcom/felicio Or in your file'composer.json' add: { "require" : { "geekcom/felicio" : " ^2.5.0 " } } And the just run: composer install and thats it. Configure Rename .felicio.example to .felicio and fill in the correct information about your AWS SQS account. AWS_SQS_ACCESS_KEY= AWS_SQS_SECRET_KEY= AWS_SQS_REGION= AWS_SQS_API_VERSION=latest Send a message require __DIR__ . ' /vendor/autoload.php ' ; use Felicio \ Felicio ; $ felicioDotFile = __DIR__ . ' /.felicio ' ; $ felicio = new Felicio ( $ felicioDotFile ); $ params = [ ' QueueUrl ' => ' https://sqs.us-west-2.amazonaws.com/999999999/my_queue ' , ' MessageBody ' => ' test message ' ]; $ felicio -> sendMessage ( $ params ); Receive a message require __DIR__ . ' /vendor/autoload.php ' ; use Felicio \ Felicio ; $ felicioDotFile = __DIR__ . ' /.felicio ' ; $ felicio = new Felicio ( $ felicioDotFile ); $ params = [ ' AttributeNames ' => [ ' SentTimestamp ' ], ' MaxNumberOfMessages ' => 1 , ' MessageAttributeNames ' => [ ' All ' ], ' QueueUrl ' => ' https://sqs.us-west-2.amazonaws.com/999999999/my_queue ' , ' WaitTimeSeconds ' => 0 , ]; $ message = $ felicio -> receiveMessage ( $ params ); var_dump ( $ message ); Delete a message require __DIR__ . ' /vendor/autoload.php ' ; use Felicio \ Felicio ; $ felicioDotFile = __DIR__ . ' /.felicio ' ; $ felicio = new Felicio ( $ felicioDotFile ); $ params = [ ' QueueUrl ' => ' https://sqs.us-west-2.amazonaws.com/999999999/my_queue ' , ' ReceiptHandle ' => '' , // required ]; $ felicio -> deleteMessage ( $ params ); Count messages require __DIR__ . ' /vendor/autoload.php ' ; use Felicio \ Felicio ; $ felicioDotFile = __DIR__ . ' /.felicio ' ; $ felicio = new Felicio ( $ felicioDotFile ); $ queueUrl = ' https://sqs.us-west-2.amazonaws.com/999999999/my_queue ' ; $ messages = $ felicio -> countMessages ( $ queueUrl ); var_dump ( $ messages ); Contributing Feel free to contribute, make a fork! License The Felicio library is open-source software licensed under the MIT license . Questions? Open a new Issue or look for a closed issue Author Daniel Rodrigues ( @geekcom ) About A simple AWS SQS Messages with PHP Topics php sqs message-queue queues Resources Readme License MIT license Uh oh! There was an error while loading. Please reload this page . Activity Stars 10 stars Watchers 2 watching Forks 3 forks Report repository Releases 10 2.5.2 Latest Sep 9, 2020 + 9 releases Packages 0 No packages published Uh oh! There was an error while loading. Please reload this page . Languages PHP 87.4% Dockerfile 12.6% Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time.
2026-01-13T09:30:36
https://aws.amazon.com/vpc/lattice/
Simplified Application Networking – Amazon VPC Lattice – Amazon Web Services Skip to main content Filter: All English Contact us AWS Marketplace Support My account Search Filter: All Sign in to console Create account Amazon VPC Lattice Overview Features Pricing FAQs Getting started Networking and Content Delivery › Amazon VPC › Amazon VPC Lattice Amazon VPC Lattice Simplify service-to-service connectivity, security, and monitoring Get started with VPC Lattice Read the analyst spotlight Benefits of VPC Lattice Simplify connectivity Simplify and automate service and resource connectivity using Amazon VPC Lattice to discover and securely connect services and resources across VPCs and accounts. Improve security Create an improved and more consistent security posture with reliable authentication and context-specific authorization. Scale automatically Scale compute and network resources automatically to support high-bandwidth HTTP, HTTPS, gRPC, and TCP workloads. Deploy flexibly Improve productivity and deployment flexibility with support for instances, containers, and serverless compute. Connect to TCP resources Connect to TCP resources such as RDS databases, domain names, and IP addresses across multiple VPCs and accounts. How it works Amazon VPC Lattice is an application networking service that consistently connects, monitors, and secures communications between your services and resources, helping to improve productivity so that your developers can focus on building features that matter to your business. You can define policies for network traffic management, access, and monitoring to connect compute services and resources in a simplified and consistent way across instances, containers, and serverless applications. Use cases Simplify service-to-service connectivity at scale Connect thousands of services across VPCs and accounts without increasing network complexity. Enhance application-layer security Improve service-to-service security and support Zero Trust architectures with centralized access controls, authentication, and context-specific authorization. Implement advanced traffic management Apply granular traffic controls, such as request-level routing and weighted targets, for blue/green and canary deployments. Gain visibility into service-to-service interactions Monitor and troubleshoot service-to-service communication for request type, traffic volume, errors, response time, and more. Connect to TCP resources Connect to TCP resources such as RDS databases, domain names, and IP addresses across multiple VPCs and accounts. IDC Analyst Spotlight on VPC Lattice Solve application connectivity challenges with a fully managed service that simplifies connectivity across VPCs and accounts while reducing operational overhead. Read the IDC Spotlight Adways Inc. "At Adways Inc, a leading mobile marketing company based in Tokyo, Japan, we are working to improve our efficiency and productivity by developing an API platform that is commonly used by multiple teams across our organization. VPC Lattice, which abstracts network connectivity across AWS Accounts and VPCs, enabled our developers to focus on platform and application development without worrying about the underlying infrastructure and networking. We are excited about improvements in productivity and efficiency with VPC Lattice!" Shimpei Okamura, Vice General Manager at Adways Inc. seek.com.au "We have been in search for a solution to share services across VPCs easily and without much overhead. With VPC Lattice, engineers across teams were able to share their services with our main analytics engine in a matter of minutes, which was exactly what we needed!" Thet Ko, engineering manager at seek.com.au Altusgroup.com "Connecting applications to data sources across multiple accounts was extremely difficult and time consuming for us at AltusGroup as we acquired and integrated multiple businesses. VPC Lattice enabled our developers to easily and securely connect our applications and data sources across accounts without introducing network complexity. As we continue to grow through acquisitions, VPC Lattice simplifies cross-account connectivity and security and helps us accelerate development and innovation in analytics across the organization." Suman Sriram, DevOps Team Lead at Altusgroup.com Unique Vision Company "Unique Vision uses Amazon VPC Lattice to easily connect and secure our services across accounts and with overlapping CIDRs. We build new social media campaign capabilities, such as our Beluga series, which use AWS Lambda functions. Connecting and securing these new services with existing services that are distributed across multiple accounts was complex, and limited our pace of innovation. Since we started using VPC Lattice, we have seen our platform and developer teams accelerate the rate of building and deploying new campaign capabilities!" Kouhei Aoyagi, Director CTO at Unique Vision Company, Japan Get started Features page Explore VPC Lattice features Learn more FAQs Find out how Amazon VPC Lattice works Explore more Contact us Connect with an expert Contact us Create an AWS account Learn What Is AWS? What Is Cloud Computing? What Is Agentic AI? Cloud Computing Concepts Hub AWS Cloud Security What's New Blogs Press Releases Resources Getting Started Training AWS Trust Center AWS Solutions Library Architecture Center Product and Technical FAQs Analyst Reports AWS Partners Developers Builder Center SDKs & Tools .NET on AWS Python on AWS Java on AWS PHP on AWS JavaScript on AWS Help Contact Us File a Support Ticket AWS re:Post Knowledge Center AWS Support Overview Get Expert Help AWS Accessibility Legal English Back to top Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. x facebook linkedin instagram twitch youtube podcasts email Privacy Site terms Cookie Preferences © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2026-01-13T09:30:36
https://bifromq.apache.org/docs/3.1.x/installation/intro/
Installation Overview | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 3.1.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation Docker Linux Windows Install from Source Configuration Convention & Migration Notes on Kubernetes Deployment BifroMQ Cluster User Guide Plugin Administration MQTT Best Practices Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 3.1.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Installation Version: 3.1.x On this page Installation Overview Prerequisites ​ BifroMQ requires Java 17 or higher for its operation. Ensure your Java runtime environment is updated to meet these requirements before proceeding with the BifroMQ installation. Installation Directory Structure ​ Upon installation, BifroMQ organizes its files within the following directory structure: Directory Description bin Executable scripts for starting and managing BifroMQ. conf Configuration files necessary for customizing BifroMQ operations. lib Program libs for running BifroMQ. plugins BifroMQ plugins in pf4j compatible format. data User's persistent data. logs Log files. Running BifroMQ ​ The startup script for BifroMQ recognizes several environment variables that allow for customization and optimization of its runtime environment: Environment Variable Description LOG_DIR Specifies the directory where BifroMQ should store its log files. Defaults to ./logs if unset. DATA_DIR Determines the directory for storing BifroMQ data. Defaults to ./data if unset. JAVA_HOME Specifies the path to the Java Runtime Environment (JRE) that BifroMQ should use. MEM_LIMIT Limits the maximum amount of memory that BifroMQ can use. JVM_PERF_OPTS Custom JVM performance options for tuning the JVM instance running BifroMQ. JVM_GC_OPTS Garbage Collection (GC) options to optimize memory management for BifroMQ. JVM_HEAP_OPTS Specifies JVM heap size and other memory settings directly impacting BifroMQ's performance. EXTRA_JVM_OPTS Additional JVM options that users may want to pass to customize the BifroMQ runtime environment. JVM_DEBUG Enables debugging options for the JVM, useful for development and troubleshooting. JAVA_DEBUG_PORT When JVM_DEBUG is enabled, sets the port for the JVM debugger to attach to. Edit this page Previous Frequently Asked Questions Next Docker Prerequisites Installation Directory Structure Running BifroMQ Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://aws.amazon.com/cn/products/networking/
AWS 联网和内容分发 – Amazon Web Services 跳至主要内容 Filter: 全部 English 联系我们 AWS Marketplace 支持 我的账户 搜索 Filter: 全部 登录控制台 创建账户 联网和内容分发 概述 解决方案领域 合作伙伴 产品 › AWS 网络连接和内容分发 AWS 网络连接和内容分发 在安全可靠的全球网络上运行每种工作负载 概述 在 AWS 的世界中获得最广泛、最深入的全套网络和内容交付服务。在云端以最高等级的可靠性、安全性和性能运行应用程序。 播放 优势 最安全 通过 AWS 联网功能满足世界上最严苛的安全要求。通过全天候监控确保数据的保密性、完整性和可用性。 最高的网络可用性 利用 AWS 区域/可用区 (AZ) 模型使您的任务关键型工作负载保持最高的可用性级别。行业分析师已将 AZ 模型视为值得推荐运行方式,适用于要求高可用性的企业应用程序。 始终如一的高性能 使用最高吞吐量和最低延迟的云网络运行您的工作负载。使用 AWS 网络为客户提供更快、反应更灵敏的应用程序。 最广泛的全球覆盖 在世界上任何地点通过专用的网络交付应用程序和内容。AWS 可为任何供应商提供最大的全球基础设施占用空间。 通过迁移到 AWS 最大限度地提高效率并降低成本 分析公司 Enterprise Strategy Group 证实,通过迁移到 AWS,各组织将网络、计算和存储成本降低了多达 66%。 阅读报告 AWS 联网和内容分发服务 网络基础 通过 Amazon Virtual Private Cloud(VPC)自定义和控制您的联网环境 了解详情 AWS Transit Gateway 利用 VPC 和连接到单个网关的本地网络简化您的网络 了解详情 AWS PrivateLink 在 VPC 与 AWS 服务或本地服务之间建立专用连接 了解详情 应用程序联网 Amazon VPC Lattice 简化服务到服务的连接、安全性和监控 了解详情 AWS AppMesh 通过应用程序级联网功能连接容器和微服务 了解详情 AWS API Gateway 创建、维护和保护任意规模的 API 了解详情 AWS Cloud Map 发现和访问最新的服务资源 了解详情 Elastic Load Balancing 分配网络流量以便提高应用程序可扩展性 了解详情 边缘联网 Amazon CloudFront 以高传输速度和低延迟交付数据、视频、应用程序和 API 了解详情 Amazon Route 53 使用低成本的托管式域名系统(DNS)将最终用户连接到互联网应用程序 了解详情 AWS Global Accelerator 针对您的应用程序优化用户流量 了解详情 连接 AWS Direct Connect 与您的数据中心、办公室或主机托管环境建立私有专用 AWS 连接 了解详情 AWS Site-to-Site VPN 与您的 Amazon VPC 或 AWS Transit Gateway 建立加密网络连接 了解详情 AWS Client VPN 通过虚拟专用网络(VPN)将远程工作人员连接到 AWS 或本地 了解详情 AWS 云 WAN 轻松构建、管理和监控全球广域网 了解详情 AWS 互连 – 多云(预览版) 与其他云服务提供商建立简单、弹性、高速的私有连接 了解详情 AWS 互连 – 最后一英里(封闭预览版) 只需点击几下即可将您的远程位置连接到 AWS 了解详情 网络安全 AWS Shield 保护 AWS 应用程序免遭分布式阻断服务(DDoS)攻击 了解详情 AWS WAF 保护您的 Web 应用程序免遭常见 Web 漏洞的攻击 了解详情 AWS Network Firewall 跨 Amazon VPC 部署网络安全措施 了解详情 AWS Firewall Manager 集中配置并管理防火墙规则 了解详情 解决方案领域 构建强大的网络基础 通过 AWS 网络基础在复杂的网络流量上保留标签。利用包括 Amazon VPC、AWS Transit Gateway、AWS PrivateLink、Amazon VPC Flow Logs 和 VPC 流量镜像在内的服务,简化资源启动、网络管理、连接和流量监控。 了解详情 连接混合基础设施 通过安全且高效的网络通信链接在 AWS 中与本地运行的服务。AWS 混合连接解决方案提供一系列连接类型和服务,用于构建可从云端到本地再到网络边缘无缝地工作的混合网络。 了解详情 通过边缘联网提供更快速、更安全的应用程序 利用边缘联网向用户提供应用程序和数据,同时提高安全性并减小延迟。将流量从互联网转移到世界上最安全、性能最佳的云网络。Amazon CloudFront、AWS Global Accelerator 和 Amazon Route 53 可安全地交付数据,延迟低,吞吐量高。 了解详情 简化应用程序联网 通过 AWS 应用程序联网,简化并改善应用程序的联网架构。弹性负载均衡(ELB)、AWS Global Accelerator(AGA)和 AWS App Mesh 共同带来更高的安全性、可用性、性能和简化的监控功能。 了解详情 AWS 上的特色解决方案 探索专门构建的服务、AWS 解决方案、合作伙伴解决方案和指南,以快速应对您的业务和技术应用场景。 适用于 AWS Transit Gateway 的网络编排 在分布式 AWS 环境中自动执行设置和管理传输网络流程。通过 AWS 管理控制台中的单个控制面板可视化和监控您的全球网络,以便控制、审计和批准(传输)网络变更。 开始使用 Firewall Automation for Network Traffic on AWS 部署一个解决方案,将预置集中式 AWS Network Firewall 以检查 Amazon VPC 之间流量的过程自动化。 开始使用 2025 年汉堡 AWS Summit:立即体验未来的云环境 与行业先驱和云专家一起参加为期一天的实践学习和交流活动,这将改变贵企业的云之旅。 立即注册 创建 AWS 账户 了解 什么是 AWS? 什么是云计算? 什么是代理式人工智能? 云计算概念中心 AWS 云安全性 最新资讯 博客 新闻稿 资源 入门 训练 AWS 信任中心 AWS 解决方案库 架构中心 产品和技术常见问题 分析报告 AWS 合作伙伴 开发人员 构建者中心 软件开发工具包与工具 运行于 AWS 上的 .NET 运行于 AWS 上的 Python 运行于 AWS 上的 Java 运行于 AWS 上的 PHP 运行于 AWS 上的 JavaScript 帮助 联系我们 提交支持工单 AWS re:Post Knowledge Center AWS Support 概述 获取专家帮助 AWS 可访问性 法律 English 回到顶部 Amazon 是一个倡导机会均等的雇主:反对少数族裔、妇女、残疾人士、退伍军人、性别认同、性取向和年龄歧视。 x facebook linkedin instagram twitch youtube podcasts email 隐私 网站条款 Cookie 首选项 © 2025, Amazon Web Services, Inc. 或其联属公司。保留所有权利。
2026-01-13T09:30:36
https://aws.amazon.com/interconnect/lastmile/
lastmile Skip to main content Filter: All English Contact us AWS Marketplace Support My account Search Filter: All Sign in to console Create account Interconnect Overview Resources Home › Interconnect › Lastmile AWS Interconnect – last mile (Gated Preview) A managed connectivity capability enabling customers to easily connect their remote locations to AWS in just a few clicks Sign up now What is Interconnect – last mile? AWS Interconnect - last mile simplifies on-premises last mile connectivity to AWS. Customers can either use their current network provider or find a new partner through AWS to instantly create high-speed private connections to the AWS network. It makes it easier for customers to onboard to AWS from their on-premises locations and removes the operational burden by automating network configuration. Benefits Turnkey operations With Interconnect – last mile, customers can now set up a private, reliable connection in minutes using their current last-mile network provider. For locations their provider cannot serve, this auto-discovers eligible partners based on the address and provides a guided experience to quickly sign up and request a connection. This saves customers weeks of back-and-forth for partner identification and network setup. Simplified network setup Interconnect - last mile abstracts away the complexity of network plumbing such as ordering cross-connects, configuring VLANs, ASNs, and BGP peering by automating these steps and enforcing AWS best practices. This lowers the risk of misconfiguration errors. Flexible scaling Interconnect – last mile enables the ability to adjust bandwidth speeds as workloads fluctuate, supporting scaling natively, from 1 Gbps to 100 Gbps with increments at 1, 2, 5, 10, 25, 50, and 100 Gbps. Scale up or down through the AWS Console, without needing to reprovision connections or open a support case. How it works AWS Interconnect – last mile automates the end-to-end process of establishing private, resilient connectivity between customer on-premises locations and AWS. In the AWS Console, customers only have to select their location, preferred AWS Region, and bandwidth speed. Everything else is taken care of behind the scenes. Partner Did you find what you were looking for today? Let us know so we can improve the quality of the content on our pages Yes No Create an AWS account Learn What Is AWS? What Is Cloud Computing? What Is Agentic AI? Cloud Computing Concepts Hub AWS Cloud Security What's New Blogs Press Releases Resources Getting Started Training AWS Trust Center AWS Solutions Library Architecture Center Product and Technical FAQs Analyst Reports AWS Partners Developers Builder Center SDKs & Tools .NET on AWS Python on AWS Java on AWS PHP on AWS JavaScript on AWS Help Contact Us File a Support Ticket AWS re:Post Knowledge Center AWS Support Overview Get Expert Help AWS Accessibility Legal English Back to top Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. x facebook linkedin instagram twitch youtube podcasts email Privacy Site terms Cookie Preferences © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2026-01-13T09:30:36
https://vml.visma.ai/support#faq
Interested in Autosuggest or Smartscan? About us Who are we? Learn more about Visma Machine Learning What we do Learn more about the products we offer What our customers say Read our customers' testimonials Products Autosuggest Automate your workflow Smartscan Extract data from your documents Resources Blog Product news and showcases Showcase of prototypes Prototypes, ideas and experiments Support Get started Find out more about onboarding to Visma Machine Learning FAQ We have answers to your frequently asked questions. Privacy policy Learn how we handle your data and protect your privacy Cookie policy Learn about how we use cookies to enhance your experience API Documentation Contact Us About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Showcase of prototypes Support Get started FAQ Privacy policy Cookie policy API Documentation Loading... Gærtorvet 1-5 1799 Copenhagen Denmark E-mail: worksmarter@visma.com About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Prototypes Documentation Support Get started FAQ Privacy policy Cookie policy Security Information Operating Status © 2026 Visma Group. All rights reserved Start your journey to intelligent automation now Come join us at the forefront of automation. If you're new to Machine Learning Assets, check out our API documentation for key guidelines on how to make the most of our products. View our FAQ section and onboarding steps below and let us know if you have any questions. Contact us See documentation How to onboard? If you work for Visma, and have access to Visma's Slack, we are available for questions or support regarding Autosuggest or Smartscan, on our support slack channel #smb-vml-support . If you have questions that our documentation does not have answers for, or if you run into what could be a bug in our systems, you can reach out to us at worksmarter@visma.com . Onboarding process differs for external and internal Visma customers: For Visma companies We offer self sign up with your visma e-mail, where you can set up a project from the Development Portal, staging and production : Get a project token from the portal Add team members who need access to the project Implement and call the API in your software For External (non-Visma) companies Self sign up and access to the portal requires a Visma e-mail. To get access to the API contact us on our support email . We can provide you with a token, which you can use to access our API. Frequently asked questions General What does it cost to get started? We provide free API access in staging to all Visma companies. To ensure the best onboarding and a strong partnership, contact us for more information. How are your solutions priced? Smartscan is competitively priced. For Visma companies, it's very competitively priced. contact us for more information. Feel free to test both Smartscan and Autosuggest and get a sense for what to expect. Do you provide any end-user products? Or is it purely developer/API-focused? Our solutions are strictly API-based. Build it into your software, so that you can offer your end-users a fluent experience. We offer guidance on UI and best practices, along with use cases from our other integrations. Get in touch with worksmarter@visma.com and we can help you out with this. On what platform do your APIs work? Can your solutions be implemented on-premise? Our APIs can be integrated into any software that you may be using and can be implemented into any web or mobile application of choice. The main source of communication is standardized JSON, so it is independent of specific programming languages. The APIs are made in a developer-friendly way, so that you can easily integrate our solutions into existing software - into any web or mobile application of choice. The API is well documented , so that your developers will have all the information they need to successfully implement the API. How long does it take to implement Smartscan/Autosuggest? How much workload is to be expected for the integrations? The implementation of our APIs and the direct integration can be done in a single day - integration into your application - data flow as well as user workflow is impossible for us to guess at. This will depend on the use case and your business, but in general it is expected that you can implement the actual integration of our Smartscan product in less than 1 day with our simple APIs. Do you have SDKs in your documentation? Yes, you can find our SDK solutions in our documentation to easily implement them in mobile and web applications. The SDK is being generated for various languages (C#, Go, Java, Python), each language has its own standalone SDK that performs the same function as the others. We support mainly four languages and have provided examples on how to use the SDKs for each of them. All data types are defined in the library so no JSON required Examples of current SDKs can be found in our API definitions Using the SDK means that your IDE of choice will help you create requests by utilising intelliSense which makes it much more convenient. Are the machine learning models customer-specific or global? Smartscan provides standard answers for common document types and is pre-trained to do so. Autosuggest is a platform for learning customer-specific behaviour and as such needs to be integrated with training data from customers to operate. Depending on your use case, the model can be trained per individual customer, but can also perform as one global prediction model across your customer base. Who develops and maintains the machine learning models? Smartscan is developed by the Visma ML Assets team. Autosuggest automatically updates ML models - the platform and built-in QA loop are developed by the Visma ML Assets team. Is the data hosted in the EU? Yes, Visma ML Assets is fully hosted in EU data centres on Google Cloud Platform. You can find more information on our privacy page and Visma's Trust Centre page . How about GDPR & Security? Are you GDPR compliant? All data is saved within the EU and our processes are GDPR compliant. For GDPR concerns: We enforce processing in the EU to support GDPR. Read more about where your data is saved on our privacy page . What kind of customer and technical support does your team offer? API documentation Technical support: We have a Slack community where you can ask your questions and chat with our team. We don't do the integration in your software, but we can offer support and guidance with implementation if needed. QA analysis + progress reports If you require a custom feature or have a specific use case that doesn't quite fit the current offering please get in touch with us at worksmarter@visma.com and we'll see what we can do to help! Smartscan How can I test the Smartscan API? Follow the instructions in the onboarding section above and our API documentation . To test our APIs, you can use our staging environment . You only have to sign in with your visma-email and set up a project on our Staging Portal. Then you'll be able to start using and calling the API - and receive the corresponding json output. We also have a demo page available in our Portal, so you can see it in action. Does Smartscan make use of OCR? Yes, we do! We apply text recognition with the highest recognition rate possible. Google's OCR technology converts any type of image (containing typed, handwritten, or printed text) into a machine-readable format (for example CSV, JSON, or XML). How quickly does the AI learn new data? We pre-train the model every couple of months, so Smartscan is updated approx. 2-6 times per year. How do you ensure high quality output? What quality can I expect? The quality of the scanned documents depends on your documents and cannot be guaranteed. Smartscan outputs up to 90% of the answers requested. Certain fields have the potential to reach an error rate as low as 1%. Confidence levels? Threshold values? Smartscan is tuned to provide an assessment on the likely correctness of all answers we provide. Consult our documentation for details. Are Smartscan's answers verified by humans? No. Man in loop or “human-in-the-loop” refers to systems that allow humans to directly interact with the AI systems to account for any uncertainty and offer 100% automation. Therefore, human-in-the-loop means integrating human employees into the machine learning pipeline, so that they can continuously validate e.g. documents and AI models. This can often result in longer processing times. What are the supported countries? We currently provide support for most European countries, and our software is already being used by end-users across all Europe, but most activity in the Nordics, Romania, Netherlands, and Belgium. Smartscan was trained with documents from over 50 countries, ensuring that you can extract data from your document and get instant results. Current supported countries are listed in our here: see API docs . We're continuously working together with our integrators to expand our document and language support. Please contact us if you would like us to look into new geographical areas. Which document formats are supported? Currently supported image types: PDF containing text PDF containing images (most often from scanners) JPG / JPEG PNG BMP HEIF WEBP GIF TIFF Which document types are supported? The following list gives you an idea of the type of documents we process. It works most seamlessly with receipts, invoices, and bank statements. In case you wonder if we support a certain document that is not on the list, feel free to contact us . Smartscan is currently set up to handle multiple document types, namely: Invoices Receipts Purchase Orders Credit Notes Debit notes What is the max request size can I send to Smartscan? Smartscan accepts only requests up to 10Mb in size, so the max request size is 10485760 Bytes (10Mb). Requests bigger than the max request size will result in a 413 response. Do you support local characters, as in Æ Ø Å Á Ö ? Yes, we generally support Unicode, i.e. local characters to the extent the OCR is able to output them. Does the OCR work on low-quality images? Smartscan processes all text the OCR is able to scan, and is trained to process documents from a large number of different layouts. This can include handwritten receipts on standard pads. Smartscan never rejects images, unless they are digitally damaged or above our size limit (or in an unsupported document format). Google's OCR is astoundingly good even in very bad conditions, bad light skews even handwritten documents, and documents with light and focus issues can work. What is the average API response time? The average processing time is around 1 second, and 95% of the requests are below 2.5 seconds. Our goal is to make sure you can get real-time results in your application. Autosuggest Which document types are supported? Autosuggest can ingest different types of input data, i.e. bank transactions, scanned invoices (i.e. document text), electronic invoice lines. What is the max request size can I send to Autosuggest? Autosuggest accepts only requests up to 10Mb in size, so the max request size is 10485760 Bytes (10Mb). Requests bigger than the max request size will result in a 413 response. How quickly does the AI learn new data? How many samples do you need in order to get results? Will the model be trained automatically with enough samples? Autosuggest models are retrained daily if new data is available. The model will try to train every time you add some data to your dataset, usually a few hours after the addition. With respect to how much data is required, the answer to this question varies a lot with data quality and the complexity of the task we're trying to learn. In optimal cases, Autosuggest starts providing useful answers with as few as 50-100 examples. We recommend having at least 20 samples. If the model does not have enough samples, it will end up with an unsuccessful training. Then you can add more samples and Autosuggest will try to train the model, ending up either in failure if it's not enough, or successfully when it's enough samples. What is a confidence score? All predictions from Autosuggest are accompanied by a quality score, namely the confidence score . Generally speaking, when the confidence is higher, the answer is more likely to be correct. To present your users with reliable predictions, you should filter out (i.e. simply ignore) answers below an acceptable confidence. Read more in our documentation . You might find the following explainer useful: Understanding ML Quality
2026-01-13T09:30:36
https://bifromq.apache.org/docs/installation/config_migration_between_versions/
Configuration Convention & Migration | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ Next (Incubating) Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation Docker Linux Windows Install from Source Configuration Convention & Migration Notes on Kubernetes Deployment BifroMQ Cluster User Guide Plugin Administration Benchmark Contribution Installation Configuration Convention & Migration Version: Next (Incubating) Configuration Convention & Migration Configurations may vary between different versions. When deploying BifroMQ, you can use previous configuration files, and it won't prevent BifroMQ from starting. However, please be aware that these older configurations might not take effect. To simplify the configuration process of BifroMQ, the configuration file standalone.yml includes only common configuration items. For unspecified configurations, default values will be used, and BifroMQ will output the complete content of the configuration file at the beginning of info.log after starting. Users can utilize the full configuration output in the log to compare and update their standalone.yml configuration. Edit this page Previous Install from Source Next Notes on Kubernetes Deployment Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://aws.amazon.com/tr/products/networking/#aws-page-content-main
Networking and Content Delivery on AWS – Amazon Web Services Skip to main content Filter: All English Contact us AWS Marketplace Support My account Search Filter: All Sign in to console Create account Networking & Content Delivery Overview Solution Areas Partners Products › AWS Networking and Content Delivery AWS Networking and Content Delivery Run every workload on a secure and reliable global network Overview Get the broadest and deepest set of networking and content delivery services in the world with AWS. Run applications with the highest level of reliability, security, and performance in the cloud. Play Benefits Most secure Meet the most stringent security requirements in the world with AWS networking capabilities. Ensure the confidentiality, integrity, and availability of your data through 24/7 infrastructure monitoring. Highest network availability Maintain the highest availability levels for your mission-critical workloads using the AWS Region/Availability Zone (AZ) model. Industry analysts recognize the AZ model as the recommended approach for running enterprise applications requiring high availability. Consistent high performance Run your workloads using the highest throughput and lowest latency cloud network. Use the AWS network to provide your customers with faster, more responsive applications. Broadest global coverage Deliver applications and content anywhere in the world over a purpose-built network. AWS offers the largest global infrastructure footprint of any provider. Maximize efficiency and lower costs by migrating to AWS Analyst firm, Enterprise Strategy Group, validated that organizations reduced networking, compute, and storage costs by up to 66% by migrating to AWS. Read the report AWS networking and content delivery services Network foundations Customize and control your networking environment with Amazon Virtual Private Cloud (VPC) Learn more AWS Transit Gateway Simplify your network with VPCs and on-premises networks connected to a single gateway Learn more AWS PrivateLink Establish private connectivity between VPCs and AWS or on- premises services Learn more Application networking Amazon VPC Lattice Simplify service-to-service connectivity, security, and monitoring Learn more AWS AppMesh Connect containers and microservices with application-level networking Learn more AWS API Gateway Create, maintain, and secure APIs at any scale Learn more AWS Cloud Map Discover and access the most up-to-date service resources Learn more Elastic Load Balancing Distribute network traffic to improve application scalability Learn more Edge networking Amazon CloudFront Deliver data, videos, applications, and APIs at high transfer speeds with low latency Learn more Amazon Route 53 Drive end users to internet applications with a low-cost managed Domain Name System (DNS) Learn more AWS Global Accelerator Optimize user traffic to your application Learn more Connectivity AWS Direct Connect Establish a private, dedicated AWS connection to your data center, office, or colocation environment Learn more AWS Site-to-Site VPN Create an encrypted network connection to your Amazon VPCs or AWS Transit Gateways Learn more AWS Client VPN Connect your remote workforce to AWS or on-premises with a Virtual Private Network (VPN) Learn more AWS Cloud WAN Easily build, manage, and monitor global wide area networks Learn more AWS Interconnect – multicloud (Preview) Simple, resilient, high-speed private connections to other cloud service providers Learn more AWS Interconnect - last mile (Gated Preview) Connect your remote locations to AWS with just a few clicks Learn more Network security AWS Shield Safeguard AWS applications against distributed denial of service (DDoS) attacks Learn more AWS WAF Protect your web applications from common web exploits Learn more AWS Network Firewall Deploy network security across your Amazon VPCs Learn more AWS Firewall Manager Centrally configure and manage firewall rules Learn more Solution areas Build strong network foundations Keep tabs on your complex network traffic with AWS network foundations. Simplify resource launch, network management, connectivity, and traffic monitoring with services including Amazon VPC, AWS Transit Gateway, AWS PrivateLink, Amazon VPC Flow Logs, and VPC Traffic Mirroring. Learn more Connect hybrid infrastructure Link your services running in AWS and your premises with secure and efficient network communication. AWS hybrid connectivity solutions provide an array of connection types and services for building hybrid networks that work seamlessly from cloud to on-premises to the network edge. Learn more Deliver faster, more secure applications with edge networking Deliver user applications and data with increased security and low-latency using edge networking. Move traffic off the internet and on to the world’s most secure, best performing cloud network. Amazon CloudFront, AWS Global Accelerator, and Amazon Route 53 securely deliver your data with low latency and high throughput. Learn more Streamline application networking Simplify and improve your application’s network architecture with AWS application networking. Elastic Load Balancing (ELB), AWS Global Accelerator (AGA), and AWS App Mesh work together to provide improved security, availability, performance, and streamlined monitoring capabilities. Learn more Featured Solutions on AWS Discover Purpose-Built Services, AWS Solutions, Partner Solutions, and Guidance to rapidly address your business and technical use cases. Network Orchestration for AWS Transit Gateway Automate the process of setting up and managing transit networks in distributed AWS environments. Visualize and monitor your global network from a single dashboard in the AWS Console so that you can control, audit, and approve (transit) network changes. Get Started Firewall Automation for Network Traffic on AWS Deploy a solution that automates the process of provisioning a centralized AWS Network Firewall to inspect traffic between your Amazon VPCs. Get Started AWS Summit Hamburg 2025: Experience tomorrow's cloud today Join industry pioneers and cloud experts for a day of hands-on learning and networking opportunities that will transform your business's cloud journey. Register now Create an AWS account Learn What Is AWS? What Is Cloud Computing? What Is Agentic AI? Cloud Computing Concepts Hub AWS Cloud Security What's New Blogs Press Releases Resources Getting Started Training AWS Trust Center AWS Solutions Library Architecture Center Product and Technical FAQs Analyst Reports AWS Partners Developers Builder Center SDKs & Tools .NET on AWS Python on AWS Java on AWS PHP on AWS JavaScript on AWS Help Contact Us File a Support Ticket AWS re:Post Knowledge Center AWS Support Overview Get Expert Help AWS Accessibility Legal English Back to top Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. x facebook linkedin instagram twitch youtube podcasts email Privacy Site terms Cookie Preferences © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2026-01-13T09:30:36
http://anh.cs.luc.edu/handsonPythonTutorial/ifstatements.html#id16
3.1. If Statements — Hands-on Python Tutorial for Python 3 Navigation index next | previous | Hands-on Python Tutorial » 3. More On Flow of Control » 3.1. If Statements ¶ 3.1.1. Simple Conditions ¶ The statements introduced in this chapter will involve tests or conditions . More syntax for conditions will be introduced later, but for now consider simple arithmetic comparisons that directly translate from math into Python. Try each line separately in the Shell 2 < 5 3 > 7 x = 11 x > 10 2 * x < x type ( True ) You see that conditions are either True or False . These are the only possible Boolean values (named after 19th century mathematician George Boole). In Python the name Boolean is shortened to the type bool . It is the type of the results of true-false conditions or tests. Note The Boolean values True and False have no quotes around them! Just as '123' is a string and 123 without the quotes is not, 'True' is a string, not of type bool. 3.1.2. Simple if Statements ¶ Run this example program, suitcase.py. Try it at least twice, with inputs: 30 and then 55. As you an see, you get an extra result, depending on the input. The main code is: weight = float ( input ( "How many pounds does your suitcase weigh? " )) if weight > 50 : print ( "There is a $25 charge for luggage that heavy." ) print ( "Thank you for your business." ) The middle two line are an if statement. It reads pretty much like English. If it is true that the weight is greater than 50, then print the statement about an extra charge. If it is not true that the weight is greater than 50, then don’t do the indented part: skip printing the extra luggage charge. In any event, when you have finished with the if statement (whether it actually does anything or not), go on to the next statement that is not indented under the if . In this case that is the statement printing “Thank you”. The general Python syntax for a simple if statement is if condition : indentedStatementBlock If the condition is true, then do the indented statements. If the condition is not true, then skip the indented statements. Another fragment as an example: if balance < 0 : transfer = - balance # transfer enough from the backup account: backupAccount = backupAccount - transfer balance = balance + transfer As with other kinds of statements with a heading and an indented block, the block can have more than one statement. The assumption in the example above is that if an account goes negative, it is brought back to 0 by transferring money from a backup account in several steps. In the examples above the choice is between doing something (if the condition is True ) or nothing (if the condition is False ). Often there is a choice of two possibilities, only one of which will be done, depending on the truth of a condition. 3.1.3. if - else Statements ¶ Run the example program, clothes.py . Try it at least twice, with inputs 50 and then 80. As you can see, you get different results, depending on the input. The main code of clothes.py is: temperature = float ( input ( 'What is the temperature? ' )) if temperature > 70 : print ( 'Wear shorts.' ) else : print ( 'Wear long pants.' ) print ( 'Get some exercise outside.' ) The middle four lines are an if-else statement. Again it is close to English, though you might say “otherwise” instead of “else” (but else is shorter!). There are two indented blocks: One, like in the simple if statement, comes right after the if heading and is executed when the condition in the if heading is true. In the if - else form this is followed by an else: line, followed by another indented block that is only executed when the original condition is false . In an if - else statement exactly one of two possible indented blocks is executed. A line is also shown de dented next, removing indentation, about getting exercise. Since it is dedented, it is not a part of the if-else statement: Since its amount of indentation matches the if heading, it is always executed in the normal forward flow of statements, after the if - else statement (whichever block is selected). The general Python if - else syntax is if condition : indentedStatementBlockForTrueCondition else: indentedStatementBlockForFalseCondition These statement blocks can have any number of statements, and can include about any kind of statement. See Graduate Exercise 3.1.4. More Conditional Expressions ¶ All the usual arithmetic comparisons may be made, but many do not use standard mathematical symbolism, mostly for lack of proper keys on a standard keyboard. Meaning Math Symbol Python Symbols Less than < < Greater than > > Less than or equal ≤ <= Greater than or equal ≥ >= Equals = == Not equal ≠ != There should not be space between the two-symbol Python substitutes. Notice that the obvious choice for equals , a single equal sign, is not used to check for equality. An annoying second equal sign is required. This is because the single equal sign is already used for assignment in Python, so it is not available for tests. Warning It is a common error to use only one equal sign when you mean to test for equality, and not make an assignment! Tests for equality do not make an assignment, and they do not require a variable on the left. Any expressions can be tested for equality or inequality ( != ). They do not need to be numbers! Predict the results and try each line in the Shell : x = 5 x x == 5 x == 6 x x != 6 x = 6 6 == x 6 != x 'hi' == 'h' + 'i' 'HI' != 'hi' [ 1 , 2 ] != [ 2 , 1 ] An equality check does not make an assignment. Strings are case sensitive. Order matters in a list. Try in the Shell : 'a' > 5 When the comparison does not make sense, an Exception is caused. [1] Following up on the discussion of the inexactness of float arithmetic in String Formats for Float Precision , confirm that Python does not consider .1 + .2 to be equal to .3: Write a simple condition into the Shell to test. Here is another example: Pay with Overtime. Given a person’s work hours for the week and regular hourly wage, calculate the total pay for the week, taking into account overtime. Hours worked over 40 are overtime, paid at 1.5 times the normal rate. This is a natural place for a function enclosing the calculation. Read the setup for the function: def calcWeeklyWages ( totalHours , hourlyWage ): '''Return the total weekly wages for a worker working totalHours, with a given regular hourlyWage. Include overtime for hours over 40. ''' The problem clearly indicates two cases: when no more than 40 hours are worked or when more than 40 hours are worked. In case more than 40 hours are worked, it is convenient to introduce a variable overtimeHours. You are encouraged to think about a solution before going on and examining mine. You can try running my complete example program, wages.py, also shown below. The format operation at the end of the main function uses the floating point format ( String Formats for Float Precision ) to show two decimal places for the cents in the answer: def calcWeeklyWages ( totalHours , hourlyWage ): '''Return the total weekly wages for a worker working totalHours, with a given regular hourlyWage. Include overtime for hours over 40. ''' if totalHours <= 40 : totalWages = hourlyWage * totalHours else : overtime = totalHours - 40 totalWages = hourlyWage * 40 + ( 1.5 * hourlyWage ) * overtime return totalWages def main (): hours = float ( input ( 'Enter hours worked: ' )) wage = float ( input ( 'Enter dollars paid per hour: ' )) total = calcWeeklyWages ( hours , wage ) print ( 'Wages for {hours} hours at ${wage:.2f} per hour are ${total:.2f}.' . format ( ** locals ())) main () Here the input was intended to be numeric, but it could be decimal so the conversion from string was via float , not int . Below is an equivalent alternative version of the body of calcWeeklyWages , used in wages1.py . It uses just one general calculation formula and sets the parameters for the formula in the if statement. There are generally a number of ways you might solve the same problem! if totalHours <= 40 : regularHours = totalHours overtime = 0 else : overtime = totalHours - 40 regularHours = 40 return hourlyWage * regularHours + ( 1.5 * hourlyWage ) * overtime The in boolean operator : There are also Boolean operators that are applied to types others than numbers. A useful Boolean operator is in , checking membership in a sequence: >>> vals = [ 'this' , 'is' , 'it] >>> 'is' in vals True >>> 'was' in vals False It can also be used with not , as not in , to mean the opposite: >>> vals = [ 'this' , 'is' , 'it] >>> 'is' not in vals False >>> 'was' not in vals True In general the two versions are: item in sequence item not in sequence Detecting the need for if statements : Like with planning programs needing``for`` statements, you want to be able to translate English descriptions of problems that would naturally include if or if - else statements. What are some words or phrases or ideas that suggest the use of these statements? Think of your own and then compare to a few I gave: [2] 3.1.4.1. Graduate Exercise ¶ Write a program, graduate.py , that prompts students for how many credits they have. Print whether of not they have enough credits for graduation. (At Loyola University Chicago 120 credits are needed for graduation.) 3.1.4.2. Head or Tails Exercise ¶ Write a program headstails.py . It should include a function flip() , that simulates a single flip of a coin: It randomly prints either Heads or Tails . Accomplish this by choosing 0 or 1 arbitrarily with random.randrange(2) , and use an if - else statement to print Heads when the result is 0, and Tails otherwise. In your main program have a simple repeat loop that calls flip() 10 times to test it, so you generate a random sequence of 10 Heads and Tails . 3.1.4.3. Strange Function Exercise ¶ Save the example program jumpFuncStub.py as jumpFunc.py , and complete the definitions of functions jump and main as described in the function documentation strings in the program. In the jump function definition use an if - else statement (hint [3] ). In the main function definition use a for -each loop, the range function, and the jump function. The jump function is introduced for use in Strange Sequence Exercise , and others after that. 3.1.5. Multiple Tests and if - elif Statements ¶ Often you want to distinguish between more than two distinct cases, but conditions only have two possible results, True or False , so the only direct choice is between two options. As anyone who has played “20 Questions” knows, you can distinguish more cases by further questions. If there are more than two choices, a single test may only reduce the possibilities, but further tests can reduce the possibilities further and further. Since most any kind of statement can be placed in an indented statement block, one choice is a further if statement. For instance consider a function to convert a numerical grade to a letter grade, ‘A’, ‘B’, ‘C’, ‘D’ or ‘F’, where the cutoffs for ‘A’, ‘B’, ‘C’, and ‘D’ are 90, 80, 70, and 60 respectively. One way to write the function would be test for one grade at a time, and resolve all the remaining possibilities inside the next else clause: def letterGrade ( score ): if score >= 90 : letter = 'A' else : # grade must be B, C, D or F if score >= 80 : letter = 'B' else : # grade must be C, D or F if score >= 70 : letter = 'C' else : # grade must D or F if score >= 60 : letter = 'D' else : letter = 'F' return letter This repeatedly increasing indentation with an if statement as the else block can be annoying and distracting. A preferred alternative in this situation, that avoids all this indentation, is to combine each else and if block into an elif block: def letterGrade ( score ): if score >= 90 : letter = 'A' elif score >= 80 : letter = 'B' elif score >= 70 : letter = 'C' elif score >= 60 : letter = 'D' else : letter = 'F' return letter The most elaborate syntax for an if - elif - else statement is indicated in general below: if condition1 : indentedStatementBlockForTrueCondition1 elif condition2 : indentedStatementBlockForFirstTrueCondition2 elif condition3 : indentedStatementBlockForFirstTrueCondition3 elif condition4 : indentedStatementBlockForFirstTrueCondition4 else: indentedStatementBlockForEachConditionFalse The if , each elif , and the final else lines are all aligned. There can be any number of elif lines, each followed by an indented block. (Three happen to be illustrated above.) With this construction exactly one of the indented blocks is executed. It is the one corresponding to the first True condition, or, if all conditions are False , it is the block after the final else line. Be careful of the strange Python contraction. It is elif , not elseif . A program testing the letterGrade function is in example program grade1.py . See Grade Exercise . A final alternative for if statements: if - elif -.... with no else . This would mean changing the syntax for if - elif - else above so the final else: and the block after it would be omitted. It is similar to the basic if statement without an else , in that it is possible for no indented block to be executed. This happens if none of the conditions in the tests are true. With an else included, exactly one of the indented blocks is executed. Without an else , at most one of the indented blocks is executed. if weight > 120 : print ( 'Sorry, we can not take a suitcase that heavy.' ) elif weight > 50 : print ( 'There is a $25 charge for luggage that heavy.' ) This if - elif statement only prints a line if there is a problem with the weight of the suitcase. 3.1.5.1. Sign Exercise ¶ Write a program sign.py to ask the user for a number. Print out which category the number is in: 'positive' , 'negative' , or 'zero' . 3.1.5.2. Grade Exercise ¶ In Idle, load grade1.py and save it as grade2.py Modify grade2.py so it has an equivalent version of the letterGrade function that tests in the opposite order, first for F, then D, C, .... Hint: How many tests do you need to do? [4] Be sure to run your new version and test with different inputs that test all the different paths through the program. Be careful to test around cut-off points. What does a grade of 79.6 imply? What about exactly 80? 3.1.5.3. Wages Exercise ¶ * Modify the wages.py or the wages1.py example to create a program wages2.py that assumes people are paid double time for hours over 60. Hence they get paid for at most 20 hours overtime at 1.5 times the normal rate. For example, a person working 65 hours with a regular wage of $10 per hour would work at $10 per hour for 40 hours, at 1.5 * $10 for 20 hours of overtime, and 2 * $10 for 5 hours of double time, for a total of 10*40 + 1.5*10*20 + 2*10*5 = $800. You may find wages1.py easier to adapt than wages.py . Be sure to test all paths through the program! Your program is likely to be a modification of a program where some choices worked before, but once you change things, retest for all the cases! Changes can mess up things that worked before. 3.1.6. Nesting Control-Flow Statements ¶ The power of a language like Python comes largely from the variety of ways basic statements can be combined . In particular, for and if statements can be nested inside each other’s indented blocks. For example, suppose you want to print only the positive numbers from an arbitrary list of numbers in a function with the following heading. Read the pieces for now. def printAllPositive ( numberList ): '''Print only the positive numbers in numberList.''' For example, suppose numberList is [3, -5, 2, -1, 0, 7] . You want to process a list, so that suggests a for -each loop, for num in numberList : but a for -each loop runs the same code body for each element of the list, and we only want print ( num ) for some of them. That seems like a major obstacle, but think closer at what needs to happen concretely. As a human, who has eyes of amazing capacity, you are drawn immediately to the actual correct numbers, 3, 2, and 7, but clearly a computer doing this systematically will have to check every number. In fact, there is a consistent action required: Every number must be tested to see if it should be printed. This suggests an if statement, with the condition num > 0 . Try loading into Idle and running the example program onlyPositive.py , whose code is shown below. It ends with a line testing the function: def printAllPositive ( numberList ): '''Print only the positive numbers in numberList.''' for num in numberList : if num > 0 : print ( num ) printAllPositive ([ 3 , - 5 , 2 , - 1 , 0 , 7 ]) This idea of nesting if statements enormously expands the possibilities with loops. Now different things can be done at different times in loops, as long as there is a consistent test to allow a choice between the alternatives. Shortly, while loops will also be introduced, and you will see if statements nested inside of them, too. The rest of this section deals with graphical examples. Run example program bounce1.py . It has a red ball moving and bouncing obliquely off the edges. If you watch several times, you should see that it starts from random locations. Also you can repeat the program from the Shell prompt after you have run the script. For instance, right after running the program, try in the Shell bounceBall ( - 3 , 1 ) The parameters give the amount the shape moves in each animation step. You can try other values in the Shell , preferably with magnitudes less than 10. For the remainder of the description of this example, read the extracted text pieces. The animations before this were totally scripted, saying exactly how many moves in which direction, but in this case the direction of motion changes with every bounce. The program has a graphic object shape and the central animation step is shape . move ( dx , dy ) but in this case, dx and dy have to change when the ball gets to a boundary. For instance, imagine the ball getting to the left side as it is moving to the left and up. The bounce obviously alters the horizontal part of the motion, in fact reversing it, but the ball would still continue up. The reversal of the horizontal part of the motion means that the horizontal shift changes direction and therefore its sign: dx = - dx but dy does not need to change. This switch does not happen at each animation step, but only when the ball reaches the edge of the window. It happens only some of the time - suggesting an if statement. Still the condition must be determined. Suppose the center of the ball has coordinates (x, y). When x reaches some particular x coordinate, call it xLow, the ball should bounce. The edge of the window is at coordinate 0, but xLow should not be 0, or the ball would be half way off the screen before bouncing! For the edge of the ball to hit the edge of the screen, the x coordinate of the center must be the length of the radius away, so actually xLow is the radius of the ball. Animation goes quickly in small steps, so I cheat. I allow the ball to take one (small, quick) step past where it really should go ( xLow ), and then we reverse it so it comes back to where it belongs. In particular if x < xLow : dx = - dx There are similar bounding variables xHigh , yLow and yHigh , all the radius away from the actual edge coordinates, and similar conditions to test for a bounce off each possible edge. Note that whichever edge is hit, one coordinate, either dx or dy, reverses. One way the collection of tests could be written is if x < xLow : dx = - dx if x > xHigh : dx = - dx if y < yLow : dy = - dy if y > yHigh : dy = - dy This approach would cause there to be some extra testing: If it is true that x < xLow , then it is impossible for it to be true that x > xHigh , so we do not need both tests together. We avoid unnecessary tests with an elif clause (for both x and y): if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy Note that the middle if is not changed to an elif , because it is possible for the ball to reach a corner , and need both dx and dy reversed. The program also uses several methods to read part of the state of graphics objects that we have not used in examples yet. Various graphics objects, like the circle we are using as the shape, know their center point, and it can be accessed with the getCenter() method. (Actually a clone of the point is returned.) Also each coordinate of a Point can be accessed with the getX() and getY() methods. This explains the new features in the central function defined for bouncing around in a box, bounceInBox . The animation arbitrarily goes on in a simple repeat loop for 600 steps. (A later example will improve this behavior.) def bounceInBox ( shape , dx , dy , xLow , xHigh , yLow , yHigh ): ''' Animate a shape moving in jumps (dx, dy), bouncing when its center reaches the low and high x and y coordinates. ''' delay = . 005 for i in range ( 600 ): shape . move ( dx , dy ) center = shape . getCenter () x = center . getX () y = center . getY () if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy time . sleep ( delay ) The program starts the ball from an arbitrary point inside the allowable rectangular bounds. This is encapsulated in a utility function included in the program, getRandomPoint . The getRandomPoint function uses the randrange function from the module random . Note that in parameters for both the functions range and randrange , the end stated is past the last value actually desired: def getRandomPoint ( xLow , xHigh , yLow , yHigh ): '''Return a random Point with coordinates in the range specified.''' x = random . randrange ( xLow , xHigh + 1 ) y = random . randrange ( yLow , yHigh + 1 ) return Point ( x , y ) The full program is listed below, repeating bounceInBox and getRandomPoint for completeness. Several parts that may be useful later, or are easiest to follow as a unit, are separated out as functions. Make sure you see how it all hangs together or ask questions! ''' Show a ball bouncing off the sides of the window. ''' from graphics import * import time , random def bounceInBox ( shape , dx , dy , xLow , xHigh , yLow , yHigh ): ''' Animate a shape moving in jumps (dx, dy), bouncing when its center reaches the low and high x and y coordinates. ''' delay = . 005 for i in range ( 600 ): shape . move ( dx , dy ) center = shape . getCenter () x = center . getX () y = center . getY () if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy time . sleep ( delay ) def getRandomPoint ( xLow , xHigh , yLow , yHigh ): '''Return a random Point with coordinates in the range specified.''' x = random . randrange ( xLow , xHigh + 1 ) y = random . randrange ( yLow , yHigh + 1 ) return Point ( x , y ) def makeDisk ( center , radius , win ): '''return a red disk that is drawn in win with given center and radius.''' disk = Circle ( center , radius ) disk . setOutline ( "red" ) disk . setFill ( "red" ) disk . draw ( win ) return disk def bounceBall ( dx , dy ): '''Make a ball bounce around the screen, initially moving by (dx, dy) at each jump.''' win = GraphWin ( 'Ball Bounce' , 290 , 290 ) win . yUp () radius = 10 xLow = radius # center is separated from the wall by the radius at a bounce xHigh = win . getWidth () - radius yLow = radius yHigh = win . getHeight () - radius center = getRandomPoint ( xLow , xHigh , yLow , yHigh ) ball = makeDisk ( center , radius , win ) bounceInBox ( ball , dx , dy , xLow , xHigh , yLow , yHigh ) win . close () bounceBall ( 3 , 5 ) 3.1.6.1. Short String Exercise ¶ Write a program short.py with a function printShort with heading: def printShort ( strings ): '''Given a list of strings, print the ones with at most three characters. >>> printShort(['a', 'long', one']) a one ''' In your main program, test the function, calling it several times with different lists of strings. Hint: Find the length of each string with the len function. The function documentation here models a common approach: illustrating the behavior of the function with a Python Shell interaction. This part begins with a line starting with >>> . Other exercises and examples will also document behavior in the Shell. 3.1.6.2. Even Print Exercise ¶ Write a program even1.py with a function printEven with heading: def printEven ( nums ): '''Given a list of integers nums, print the even ones. >>> printEven([4, 1, 3, 2, 7]) 4 2 ''' In your main program, test the function, calling it several times with different lists of integers. Hint: A number is even if its remainder, when dividing by 2, is 0. 3.1.6.3. Even List Exercise ¶ Write a program even2.py with a function chooseEven with heading: def chooseEven ( nums ): '''Given a list of integers, nums, return a list containing only the even ones. >>> chooseEven([4, 1, 3, 2, 7]) [4, 2] ''' In your main program, test the function, calling it several times with different lists of integers and printing the results in the main program. (The documentation string illustrates the function call in the Python shell, where the return value is automatically printed. Remember, that in a program, you only print what you explicitly say to print.) Hint: In the function, create a new list, and append the appropriate numbers to it, before returning the result. 3.1.6.4. Unique List Exercise ¶ * The madlib2.py program has its getKeys function, which first generates a list of each occurrence of a cue in the story format. This gives the cues in order, but likely includes repetitions. The original version of getKeys uses a quick method to remove duplicates, forming a set from the list. There is a disadvantage in the conversion, though: Sets are not ordered, so when you iterate through the resulting set, the order of the cues will likely bear no resemblance to the order they first appeared in the list. That issue motivates this problem: Copy madlib2.py to madlib2a.py , and add a function with this heading: def uniqueList ( aList ): ''' Return a new list that includes the first occurrence of each value in aList, and omits later repeats. The returned list should include the first occurrences of values in aList in their original order. >>> vals = ['cat', 'dog', 'cat', 'bug', 'dog', 'ant', 'dog', 'bug'] >>> uniqueList(vals) ['cat', 'dog', 'bug', 'ant'] ''' Hint: Process aList in order. Use the in syntax to only append elements to a new list that are not already in the new list. After perfecting the uniqueList function, replace the last line of getKeys , so it uses uniqueList to remove duplicates in keyList . Check that your madlib2a.py prompts you for cue values in the order that the cues first appear in the madlib format string. 3.1.7. Compound Boolean Expressions ¶ To be eligible to graduate from Loyola University Chicago, you must have 120 credits and a GPA of at least 2.0. This translates directly into Python as a compound condition : credits >= 120 and GPA >= 2.0 This is true if both credits >= 120 is true and GPA >= 2.0 is true. A short example program using this would be: credits = float ( input ( 'How many units of credit do you have? ' )) GPA = float ( input ( 'What is your GPA? ' )) if credits >= 120 and GPA >= 2.0 : print ( 'You are eligible to graduate!' ) else : print ( 'You are not eligible to graduate.' ) The new Python syntax is for the operator and : condition1 and condition2 The compound condition is true if both of the component conditions are true. It is false if at least one of the conditions is false. See Congress Exercise . In the last example in the previous section, there was an if - elif statement where both tests had the same block to be done if the condition was true: if x < xLow : dx = - dx elif x > xHigh : dx = - dx There is a simpler way to state this in a sentence: If x < xLow or x > xHigh, switch the sign of dx. That translates directly into Python: if x < xLow or x > xHigh : dx = - dx The word or makes another compound condition: condition1 or condition2 is true if at least one of the conditions is true. It is false if both conditions are false. This corresponds to one way the word “or” is used in English. Other times in English “or” is used to mean exactly one alternative is true. Warning When translating a problem stated in English using “or”, be careful to determine whether the meaning matches Python’s or . It is often convenient to encapsulate complicated tests inside a function. Think how to complete the function starting: def isInside ( rect , point ): '''Return True if the point is inside the Rectangle rect.''' pt1 = rect . getP1 () pt2 = rect . getP2 () Recall that a Rectangle is specified in its constructor by two diagonally oppose Point s. This example gives the first use in the tutorials of the Rectangle methods that recover those two corner points, getP1 and getP2 . The program calls the points obtained this way pt1 and pt2 . The x and y coordinates of pt1 , pt2 , and point can be recovered with the methods of the Point type, getX() and getY() . Suppose that I introduce variables for the x coordinates of pt1 , point , and pt2 , calling these x-coordinates end1 , val , and end2 , respectively. On first try you might decide that the needed mathematical relationship to test is end1 <= val <= end2 Unfortunately, this is not enough: The only requirement for the two corner points is that they be diagonally opposite, not that the coordinates of the second point are higher than the corresponding coordinates of the first point. It could be that end1 is 200; end2 is 100, and val is 120. In this latter case val is between end1 and end2 , but substituting into the expression above 200 <= 120 <= 100 is False. The 100 and 200 need to be reversed in this case. This makes a complicated situation. Also this is an issue which must be revisited for both the x and y coordinates. I introduce an auxiliary function isBetween to deal with one coordinate at a time. It starts: def isBetween ( val , end1 , end2 ): '''Return True if val is between the ends. The ends do not need to be in increasing order.''' Clearly this is true if the original expression, end1 <= val <= end2 , is true. You must also consider the possible case when the order of the ends is reversed: end2 <= val <= end1 . How do we combine these two possibilities? The Boolean connectives to consider are and and or . Which applies? You only need one to be true, so or is the proper connective: A correct but redundant function body would be: if end1 <= val <= end2 or end2 <= val <= end1 : return True else : return False Check the meaning: if the compound expression is True , return True . If the condition is False , return False – in either case return the same value as the test condition. See that a much simpler and neater version is to just return the value of the condition itself! return end1 <= val <= end2 or end2 <= val <= end1 Note In general you should not need an if - else statement to choose between true and false values! Operate directly on the boolean expression. A side comment on expressions like end1 <= val <= end2 Other than the two-character operators, this is like standard math syntax, chaining comparisons. In Python any number of comparisons can be chained in this way, closely approximating mathematical notation. Though this is good Python, be aware that if you try other high-level languages like Java and C++, such an expression is gibberish. Another way the expression can be expressed (and which translates directly to other languages) is: end1 <= val and val <= end2 So much for the auxiliary function isBetween . Back to the isInside function. You can use the isBetween function to check the x coordinates, isBetween ( point . getX (), p1 . getX (), p2 . getX ()) and to check the y coordinates, isBetween ( point . getY (), p1 . getY (), p2 . getY ()) Again the question arises: how do you combine the two tests? In this case we need the point to be both between the sides and between the top and bottom, so the proper connector is and . Think how to finish the isInside method. Hint: [5] Sometimes you want to test the opposite of a condition. As in English you can use the word not . For instance, to test if a Point was not inside Rectangle Rect, you could use the condition not isInside ( rect , point ) In general, not condition is True when condition is False , and False when condition is True . The example program chooseButton1.py , shown below, is a complete program using the isInside function in a simple application, choosing colors. Pardon the length. Do check it out. It will be the starting point for a number of improvements that shorten it and make it more powerful in the next section. First a brief overview: The program includes the functions isBetween and isInside that have already been discussed. The program creates a number of colored rectangles to use as buttons and also as picture components. Aside from specific data values, the code to create each rectangle is the same, so the action is encapsulated in a function, makeColoredRect . All of this is fine, and will be preserved in later versions. The present main function is long, though. It has the usual graphics starting code, draws buttons and picture elements, and then has a number of code sections prompting the user to choose a color for a picture element. Each code section has a long if - elif - else test to see which button was clicked, and sets the color of the picture element appropriately. '''Make a choice of colors via mouse clicks in Rectangles -- A demonstration of Boolean operators and Boolean functions.''' from graphics import * def isBetween ( x , end1 , end2 ): '''Return True if x is between the ends or equal to either. The ends do not need to be in increasing order.''' return end1 <= x <= end2 or end2 <= x <= end1 def isInside ( point , rect ): '''Return True if the point is inside the Rectangle rect.''' pt1 = rect . getP1 () pt2 = rect . getP2 () return isBetween ( point . getX (), pt1 . getX (), pt2 . getX ()) and \ isBetween ( point . getY (), pt1 . getY (), pt2 . getY ()) def makeColoredRect ( corner , width , height , color , win ): ''' Return a Rectangle drawn in win with the upper left corner and color specified.''' corner2 = corner . clone () corner2 . move ( width , - height ) rect = Rectangle ( corner , corner2 ) rect . setFill ( color ) rect . draw ( win ) return rect def main (): win = GraphWin ( 'pick Colors' , 400 , 400 ) win . yUp () # right side up coordinates redButton = makeColoredRect ( Point ( 310 , 350 ), 80 , 30 , 'red' , win ) yellowButton = makeColoredRect ( Point ( 310 , 310 ), 80 , 30 , 'yellow' , win ) blueButton = makeColoredRect ( Point ( 310 , 270 ), 80 , 30 , 'blue' , win ) house = makeColoredRect ( Point ( 60 , 200 ), 180 , 150 , 'gray' , win ) door = makeColoredRect ( Point ( 90 , 150 ), 40 , 100 , 'white' , win ) roof = Polygon ( Point ( 50 , 200 ), Point ( 250 , 200 ), Point ( 150 , 300 )) roof . setFill ( 'black' ) roof . draw ( win ) msg = Text ( Point ( win . getWidth () / 2 , 375 ), 'Click to choose a house color.' ) msg . draw ( win ) pt = win . getMouse () if isInside ( pt , redButton ): color = 'red' elif isInside ( pt , yellowButton ): color = 'yellow' elif isInside ( pt , blueButton ): color = 'blue' else : color = 'white' house . setFill ( color ) msg . setText ( 'Click to choose a door color.' ) pt = win . getMouse () if isInside ( pt , redButton ): color = 'red' elif isInside ( pt , yellowButton ): color = 'yellow' elif isInside ( pt , blueButton ): color = 'blue' else : color = 'white' door . setFill ( color ) win . promptClose ( msg ) main () The only further new feature used is in the long return statement in isInside . return isBetween ( point . getX (), pt1 . getX (), pt2 . getX ()) and \ isBetween ( point . getY (), pt1 . getY (), pt2 . getY ()) Recall that Python is smart enough to realize that a statement continues to the next line if there is an unmatched pair of parentheses or brackets. Above is another situation with a long statement, but there are no unmatched parentheses on a line. For readability it is best not to make an enormous long line that would run off your screen or paper. Continuing to the next line is recommended. You can make the final character on a line be a backslash ( '\\' ) to indicate the statement continues on the next line. This is not particularly neat, but it is a rather rare situation. Most statements fit neatly on one line, and the creator of Python decided it was best to make the syntax simple in the most common situation. (Many other languages require a special statement terminator symbol like ‘;’ and pay no attention to newlines). Extra parentheses here would not hurt, so an alternative would be return ( isBetween ( point . getX (), pt1 . getX (), pt2 . getX ()) and isBetween ( point . getY (), pt1 . getY (), pt2 . getY ()) ) The chooseButton1.py program is long partly because of repeated code. The next section gives another version involving lists. 3.1.7.1. Congress Exercise ¶ A person is eligible to be a US Senator who is at least 30 years old and has been a US citizen for at least 9 years. Write an initial version of a program congress.py to obtain age and length of citizenship from the user and print out if a person is eligible to be a Senator or not. A person is eligible to be a US Representative who is at least 25 years old and has been a US citizen for at least 7 years. Elaborate your program congress.py so it obtains age and length of citizenship and prints out just the one of the following three statements that is accurate: You are eligible for both the House and Senate. You eligible only for the House. You are ineligible for Congress. 3.1.8. More String Methods ¶ Here are a few more string methods useful in the next exercises, assuming the methods are applied to a string s : s .startswith( pre ) returns True if string s starts with string pre : Both '-123'.startswith('-') and 'downstairs'.startswith('down') are True , but '1 - 2 - 3'.startswith('-') is False . s .endswith( suffix ) returns True if string s ends with string suffix : Both 'whoever'.endswith('ever') and 'downstairs'.endswith('airs') are True , but '1 - 2 - 3'.endswith('-') is False . s .replace( sub , replacement , count ) returns a new string with up to the first count occurrences of string sub replaced by replacement . The replacement can be the empty string to delete sub . For example: s = '-123' t = s . replace ( '-' , '' , 1 ) # t equals '123' t = t . replace ( '-' , '' , 1 ) # t is still equal to '123' u = '.2.3.4.' v = u . replace ( '.' , '' , 2 ) # v equals '23.4.' w = u . replace ( '.' , ' dot ' , 5 ) # w equals '2 dot 3 dot 4 dot ' 3.1.8.1. Article Start Exercise ¶ In library alphabetizing, if the initial word is an article (“The”, “A”, “An”), then it is ignored when ordering entries. Write a program completing this function, and then testing it: def startsWithArticle ( title ): '''Return True if the first word of title is "The", "A" or "An".''' Be careful, if the title starts with “There”, it does not start with an article. What should you be testing for? 3.1.8.2. Is Number String Exercise ¶ ** In the later Safe Number Input Exercise , it will be important to know if a string can be converted to the desired type of number. Explore that here. Save example isNumberStringStub.py as isNumberString.py and complete it. It contains headings and documentation strings for the functions in both parts of this exercise. A legal whole number string consists entirely of digits. Luckily strings have an isdigit method, which is true when a nonempty string consists entirely of digits, so '2397'.isdigit() returns True , and '23a'.isdigit() returns False , exactly corresponding to the situations when the string represents a whole number! In both parts be sure to test carefully. Not only confirm that all appropriate strings return True . Also be sure to test that you return False for all sorts of bad strings. Recognizing an integer string is more involved, since it can start with a minus sign (or not). Hence the isdigit method is not enough by itself. This part is the most straightforward if you have worked on the sections String Indices and String Slices . An alternate approach works if you use the count method from Object Orientation , and some methods from this section. Complete the function isIntStr . Complete the function isDecimalStr , which introduces the possibility of a decimal point (though a decimal point is not required). The string methods mentioned in the previous part remain useful. [1] This is an improvement that is new in Python 3. [2] “In this case do ___; otherwise”, “if ___, then”, “when ___ is true, then”, “___ depends on whether”, [3] If you divide an even number by 2, what is the remainder? Use this idea in your if condition. [4] 4 tests to distinguish the 5 cases, as in the previous version [5] Once again, you are calculating and returning a Boolean result. You do not need an if - else statement. Table Of Contents 3.1. If Statements 3.1.1. Simple Conditions 3.1.2. Simple if Statements 3.1.3. if - else Statements 3.1.4. More Conditional Expressions 3.1.4.1. Graduate Exercise 3.1.4.2. Head or Tails Exercise 3.1.4.3. Strange Function Exercise 3.1.5. Multiple Tests and if - elif Statements 3.1.5.1. Sign Exercise 3.1.5.2. Grade Exercise 3.1.5.3. Wages Exercise 3.1.6. Nesting Control-Flow Statements 3.1.6.1. Short String Exercise 3.1.6.2. Even Print Exercise 3.1.6.3. Even List Exercise 3.1.6.4. Unique List Exercise 3.1.7. Compound Boolean Expressions 3.1.7.1. Congress Exercise 3.1.8. More String Methods 3.1.8.1. Article Start Exercise 3.1.8.2. Is Number String Exercise Previous topic 3. More On Flow of Control Next topic 3.2. Loops and Tuples This Page Show Source Quick search Enter search terms or a module, class or function name. Navigation index next | previous | Hands-on Python Tutorial » 3. More On Flow of Control » © Copyright 2019, Dr. Andrew N. Harrington. Last updated on Jan 05, 2020. Created using Sphinx 1.3.1+.
2026-01-13T09:30:36
https://twitter.com/pastebin
JavaScript is not available. We’ve detected that JavaScript is disabled in this browser. Please enable JavaScript or switch to a supported browser to continue using x.com. You can see a list of supported browsers in our Help Center. Help Center Terms of Service Privacy Policy Cookie Policy Imprint Ads info © 2026 X Corp. Something went wrong, but don’t fret — let’s give it another shot. Try again Some privacy related extensions may cause issues on x.com. Please disable them and try again.
2026-01-13T09:30:36
https://bifromq.apache.org/docs/2.0.0/category/plugin/
Plugin | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 2.0.0 Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install & Deploy Configuration User Guide Plugin Overview Auth Provider Event Collector Setting Provider BifroMQ Plugin Practice and Notice Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 2.0.0 , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Plugin Version: 2.0.0 Plugin BifroMQ Plugin. 📄️ Overview BifroMQ's plugin mechanism allows users to integrate custom business logic with BifroMQ at runtime. Currently, BifroMQ defines 3 types of Plugin interfaces, catering to different use cases: 📄️ Auth Provider The Auth Provider plugin is designed to provide BifroMQ runtime with the capability to authenticate MQTT client connections and authorize Pub/Sub message topics. The interface for the plugin is defined in the following Maven module: 📄️ Event Collector The Event Collector Plugin is designed to gather various events generated during the execution of BifroMQ. By filtering through event types, you can focus on the events that matter to you, enabling the implementation of various business logic such as usage statistics, monitoring, alerts, etc. The Plugin's interface is defined in the following Maven module: 📄️ Setting Provider BifroMQ defines a category of settings (Setting) that can be modified at runtime, allowing for dynamic adjustment of BifroMQ's service behavior per tenant. The purpose of the Setting Provider Plugin is to supply custom values for these settings at runtime. The Plugin's interface is defined in the following Maven module: 📄️ BifroMQ Plugin Practice and Notice BifroMQ is a powerful messaging system that allows seamless communication between itself and customized services. Previous API Service Next Overview Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://www.frontendinterviewhandbook.com/ja-JP/front-end-system-design/applications
Front End System Design Interview - Applications | The Official Front End Interview Handbook 2025 メインコンテンツまでスキップ We are now part of GreatFrontEnd , a front end interview preparation platform created by ex-Meta and Google Engineers. Get 20% off today ! Front End Interview Handbook Start reading Practice Coding Questions System Design Quiz Questions System design Blog 日本語 English 简体中文 Español 日本語 한국어 Polski Português Русский Tagalog বাংলা 検索 Introduction Coding interview JavaScript coding User interface coding Algorithms coding Quiz/trivia interview System design interview Overview User interface components Applications Behavorial interviews Resume preparation Interview questions 🔥 Amazon interview questions Google interview questions Microsoft interview questions Meta interview questions Airbnb interview questions ByteDance/TikTok interview questions Atlassian interview questions Uber interview questions Apple interview questions Canva interview questions Dropbox interview questions LinkedIn interview questions Lyft interview questions Twitter interview questions Shopify interview questions Pinterest interview questions Reddit interview questions Adobe interview questions Palantir interview questions Salesforce interview questions Oracle interview questions System design interview Applications このページの見出し Front End System Design Interview - Applications Latest version on GreatFrontEnd Find the latest version of this page on GreatFrontEnd's Front End System Design Questions . Examples ​ News feed (e.g. Facebook) (Free) E-commerce marketplace (e.g. Amazon) (Paid) Chat application (e.g. Messenger) (Paid) Photo sharing application (e.g. Instagram) (Paid) Pinterest (Paid) Collaborative editor (e.g. Google docs) (Paid) Travel booking website (e.g. Airbnb) (Paid) Video streaming (e.g. Netflix) (Paid) Email client (e.g. Microsoft Outlook) (Paid) Framework ​ In system design interviews, candidates are supposed to lead the conversation. Here's a framework you can use to give an outline to the interviewer as to what you are going to cover (not necessarily in that order). The framework is called RADIO and it is made up of the first character of each aspect. Requirements exploration Architecture Data model Interface definition (API) Optimizations and deep dive User experience (UX) Performance Accessibility (a11y) Internationalization (i18n) Multi-device support Security Requirements exploration ​ Every system design interview should start with clarifying requirements about the question, which is usually left vague intentionally. Some considerations: What devices should the system support? Desktop web, mobile web, etc What's the primary device that users will access the system on? Which browsers should we support? Do we need to support internationalization? Does the app need to work offline? Architecture / High-level design ​ Architecture for front end interviews are typically focused on the client-side architecture, and not on large scale distributed systems where databases, load balancers and servers are involved. For applications, common architectures include Model-View-Controller, Model-View-ViewModel, Flux, N-tier (where data tier is on the client) etc. Data model ​ Client app state, which is a combination of server state (database) and true client state (non-persisted to the server). Interface definition (API) ​ API design for applications will refer to the HTTP/network API parameters and the shape of the responses. Optimization and deep dives ​ With the architectural basics of the application covered, we can dive into specific areas which the application might need special attention to. Note that there almost definitely won't be enough time to cover every area, and not every area will be very relevant to the component at hand. Showing knowledge about these areas and being able to dive deep into them are traits of senior developers. User experience (UX) Performance Accessibility (a11y) Internationalization (i18n) Multi-device support Security Helpful articles ​ Many companies blog about their technical challenges in the front end domain and these are great content to learn more about designing front end systems. Building the Google Photos Web UI Twitter Lite and High Performance React Progressive Web Apps at Scale A Netflix Web Performance Case Study A Tinder Progressive Web App Performance Case Study A Pinterest Progressive Web App Performance Case Study A React And Preact Progressive Web App Performance Case Study: Treebo Rebuilding our tech stack for the new Facebook.com GreatFrontEnd shows you how to approach front end system design interviews with their Front End System Design Playbook and case studies. You can also do hands-on practice through their huge question bank of 500+ questions , each with solutions written by ex-FAANG senior engineers to learn more about system design. このページを編集 2025年11月30日 に Danielle Ford が 最終更新 前へ User interface components 次へ Behavorial interviews Table of Contents Examples Framework Requirements exploration Architecture / High-level design Data model Interface definition (API) Optimization and deep dives Helpful articles General Get started Trivia questions Company questions Blog Coding Algorithms JavaScript utility functions User interfaces System design System design overview User interface components Applications More GreatFrontEnd GitHub X Discord Contact us Tech Interview Handbook Copyright © 2025 Yangshun Tay and GreatFrontEnd
2026-01-13T09:30:36
https://github.com/geekcom/validator-docs
GitHub - geekcom/validator-docs: Validação de CPF, CNPJ, CNH, NIS, DDD, Título Eleitoral e Cartão Nacional de Saúde com Laravel. Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection Stop leaks before they start EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events & webinars Ebooks & reports Business insights GitHub Skills SUPPORT & SERVICES Documentation Customer support Community forum Trust center Partners Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} geekcom / validator-docs Public Uh oh! There was an error while loading. Please reload this page . Notifications You must be signed in to change notification settings Fork 98 Star 578 Validação de CPF, CNPJ, CNH, NIS, DDD, Título Eleitoral e Cartão Nacional de Saúde com Laravel. License MIT license 578 stars 98 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings Code Issues 5 Pull requests 0 Actions Projects 0 Security Uh oh! There was an error while loading. Please reload this page . Insights Additional navigation options Code Issues Pull requests Actions Projects Security Insights geekcom/validator-docs   master Branches Tags Go to file Code Open more actions menu Folders and files Name Name Last commit message Last commit date Latest commit   History 250 Commits .github .github     src/ validator-docs src/ validator-docs     tests tests     .gitignore .gitignore     CHANGELOG.md CHANGELOG.md     LICENSE LICENSE     README.md README.md     composer.json composer.json     composer.lock composer.lock     phpcs.xml phpcs.xml     phpunit.xml.dist phpunit.xml.dist     View all files Repository files navigation README MIT license Validator Docs - Brasil Biblioteca PHP para validação de documentos do Brasil usando Laravel Por favor, considere fazer uma doação , apoie nossas atividades Para a versão legada compatível com Laravel 5 consulte o branch https://github.com/geekcom/validator-docs/tree/5.x.x Recursos Validar qualquer documento do Brasil; Código testado e confiável; Open Source; Usado por milhares de sistemas; Aprovado pela comunidade Laravel. Instalação No arquivo composer.json , adicione validator-docs como dependência do seu projeto: "require": { "geekcom/validator-docs" : "^3.9" }, Depois execute: composer install Ou simplesmente execute o comando: composer require geekcom/validator-docs Testes Para executar os testes, basta fazer o seguinte: Instale as dependências do projeto; composer install Execute os testes. composer test Como usar a biblioteca Agora que os métodos de validação validator-docs Brasil estão disponíveis, será possível usar da seguinte forma: cpf - Verifica se um CPF é valido; $ this -> validate ( $ request , [ ' cpf ' => ' required|cpf ' , ]); cnpj - Verifica se um CNPJ é valido; $ this -> validate ( $ request , [ ' cnpj ' => ' required|cnpj ' , ]); cnh - Verifica se uma CNH (Carteira Nacional de Habilitação) é válida; $ this -> validate ( $ request , [ ' cnh ' => ' required|cnh ' , ]); passaporte - Verifica se uma Passaporte Brasileiro é válido; $ this -> validate ( $ request , [ ' passaporte ' => ' required|passaporte ' , ]); titulo_eleitor - Verifica se um Título Eleitoral é válido; $ this -> validate ( $ request , [ ' titulo_eleitor ' => ' required|titulo_eleitor ' , ]); cpf_cnpj - Verifica se um CPF ou CNPJ é válido; $ this -> validate ( $ request , [ ' cpf_cnpj ' => ' required|cpf_cnpj ' , ]); inscricao_estadual - Verifica se uma Inscrição Estadual é valida para uma Unidade Federativa(UF)/Estado; $ this -> validate ( $ request , [ ' inscricao_estadual ' => ' required|inscricao_estadual:UF ' , ]); nis - Verifica se um PIS/PASEP/NIT/NIS é válido; $ this -> validate ( $ request , [ ' nis ' => ' required|nis ' , ]); cns - Verifica se um Cartão Nacional de Saúde (CNS) é válido; $ this -> validate ( $ request , [ ' cns ' => ' required|cns ' , ]); certidao - Verifica se uma certidão de nascimento/casamento/óbito é válida; $ this -> validate ( $ request , [ ' certidao ' => ' required|certidao ' , ]); renavam - Verifica se um Registro Nacional de Veículos Automotores (RENAVAM) é válido; $ this -> validate ( $ request , [ ' renavam ' => ' required|renavam ' , ]); placa - Verifica se a PLACA de um veículo é válida; $ this -> validate ( $ request , [ ' placa ' => ' required|placa ' , ]); ddd - Verifica se um número de DDD é válido; $ this -> validate ( $ request , [ ' ddd ' => ' required|ddd ' , ]); formato_cnpj - Verifica se o formato (99.999.999/9999-99) de um CNPJ é válido; $ this -> validate ( $ request , [ ' formato_cnpj ' => ' required|formato_cnpj ' , ]); formato_cpf - Verifica se o formato( 999.999.999-99 ) de um CPF é válido; $ this -> validate ( $ request , [ ' formato_cpf ' => ' required|formato_cpf ' , ]); formato_cpf_cnpj - Verifica se o formato de um CPF ou de um CNPJ é válido; $ this -> validate ( $ request , [ ' formato_cpf_cnpj ' => ' required|formato_cpf_cnpj ' , ]); formato_nis - Verifica se o formato( 999.99999-99.9 ) de um PIS/PASEP/NIT/NIS é válido; $ this -> validate ( $ request , [ ' formato_nis ' => ' required|formato_nis ' , ]); formato_certidao - Verifica se o formato( 99999.99.99.9999.9.99999.999.9999999-99 ou 99999 99 99 9999 9 99999 999 9999999 99 ), de uma certidão é válida. $ this -> validate ( $ request , [ ' formato_certidao ' => ' required|formato_certidao ' , ]); Combinando validação e formato No exemplo abaixo, fazemos um teste onde verificamos a formatação e a validade de um CPF ou CNPJ, para os casos onde a informação deve ser salva em um mesmo atributo: $ this -> validate ( $ request , [ ' cpf_or_cnpj ' => ' formato_cpf_cnpj|cpf_cnpj ' , ]); Exemplo de uso em um controller Método de validação de exemplo em um controller com todas as possibilidades de validação public function store ( Request $ request ) { $ data = $ request -> all (); $ this -> validate ( $ request , [ ' cpf ' => ' required|cpf ' , ' cnpj ' => ' required|cnpj ' , ' cnh ' => ' required|cnh ' , ' titulo_eleitor ' => ' required|titulo_eleitor ' , ' nis ' => ' required|nis ' , ' cns ' => ' required|cns ' , ' ddd ' => ' required|ddd ' , ' renavam ' => ' required|renavam ' , ' placa ' => ' required|placa ' , ' certidao ' => ' required|certidao ' , ' inscricao_estadual ' => ' required|inscricao_estadual:SP ' , ' passaporte ' => ' required|passaporte ' , ]); dd ( $ data ); } Observe que para validar uma inscrição estadual é necessário informar a UF Geradores de documentos para testes CNH - http://4devs.com.br/gerador_de_cnh TÍTULO ELEITORAL - http://4devs.com.br/gerador_de_titulo_de_eleitor CNPJ - https://geradornv.com.br/gerador-cnpj/ CPF - https://geradornv.com.br/gerador-cpf/ NIS - https://www.4devs.com.br/gerador_de_pis_pasep CNS - https://geradornv.com.br/gerador-cns/ CERTIDÕES - https://www.4devs.com.br/gerador_numero_certidoes INSCRIÇÃO ESTADUAL - https://www.4devs.com.br/gerador_de_inscricao_estadual RENAVAM - https://www.4devs.com.br/gerador_de_renavam PLACA - https://www.4devs.com.br/gerador_de_placa_automoveis Passaporte Brasileiro - https://geradornv.com.br/gerador-passaporte/ Fique a vontade para contribuir de qualquer forma. Caso tenha alguma dúvida ou encontre algum bug, abra uma issue ou pesquise por issues antigas. Contribuidores Contribuições de qualquer tipo são bem-vindas! About Validação de CPF, CNPJ, CNH, NIS, DDD, Título Eleitoral e Cartão Nacional de Saúde com Laravel. Topics laravel validation cpf cnpj laravel-package hacktoberfest tituloeleitor cnh cns laravel-validation nis validation-library cpf-cnpj laravel10 passaporte Resources Readme License MIT license Uh oh! There was an error while loading. Please reload this page . Activity Stars 578 stars Watchers 26 watching Forks 98 forks Report repository Releases 32 3.11.1 Latest May 13, 2025 + 31 releases Sponsor this project Uh oh! There was an error while loading. Please reload this page . https://nubank.com.br/pagar/518o5/zVBzxd00Sb Packages 0 No packages published Uh oh! There was an error while loading. Please reload this page . Contributors 16 Uh oh! There was an error while loading. Please reload this page . + 2 contributors Languages PHP 100.0% Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time.
2026-01-13T09:30:36
https://aws.amazon.com/transit-gateway/
Network Gateway – AWS Transit Gateway – Amazon Web Services Skip to main content Filter: All English Contact us AWS Marketplace Support My account Search Filter: All Sign in to console Create account AWS Transit Gateway Overview Features Pricing Resources Customers Products › Networking and Content Delivery › AWS Transit Gateway AWS Transit Gateway Connect Amazon VPCs, AWS accounts, and on-premises networks to a single gateway Get started with Transit Gateway Benefits Streamline your architecture Streamline your architecture to manage it as it grows in complexity. Better visibility and control Get better visibility and control over your virtual private clouds and edge connections. Improve security Improve security with inter-Region peering encryption on the AWS global private network. Lift and shift Lift and shift your on-premises finance and video multicast applications to the cloud. How it works AWS Transit Gateway connects your Amazon Virtual Private Clouds (VPCs) and on-premises networks through a central hub. This connection simplifies your network and puts an end to complex peering relationships. Transit Gateway acts as a highly scalable cloud router—each new connection is made only once. Why Transit Gateway? AWS Transit Gateway helps you design and implement networks at scale by acting as a cloud router. As your network grows, the complexity of managing incremental connections can slow you down. AWS Transit Gateway connects VPCs and on-premises networks through a central hub. Play Use cases Deliver applications around the world Build, deploy, and manage applications across thousands of Amazon VPCs without having to manage peering connections or update routing tables. Rapidly move to global scale Share VPCs, Domain Name System (DNS), Microsoft Active Directory, and IPS/IDS across Regions with inter-Region peering. Smoothly respond to spikes in demand Quickly add Amazon VPCs, AWS accounts, virtual private networking (VPN) capacity, or AWS Direct Connect gateways to meet unexpected demand. Host multicast applications on AWS Host multicast applications that scale based on demand, without the need to buy and maintain custom hardware. Get started Features page Check out the product features Learn more Getting started Sign up for a free account Sign up Console Start building in the console Sign up Create an AWS account Learn What Is AWS? What Is Cloud Computing? What Is Agentic AI? Cloud Computing Concepts Hub AWS Cloud Security What's New Blogs Press Releases Resources Getting Started Training AWS Trust Center AWS Solutions Library Architecture Center Product and Technical FAQs Analyst Reports AWS Partners Developers Builder Center SDKs & Tools .NET on AWS Python on AWS Java on AWS PHP on AWS JavaScript on AWS Help Contact Us File a Support Ticket AWS re:Post Knowledge Center AWS Support Overview Get Expert Help AWS Accessibility Legal English Back to top Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. x facebook linkedin instagram twitch youtube podcasts email Privacy Site terms Cookie Preferences © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2026-01-13T09:30:36
https://ko-kr.facebook.com/login/?next=https%3A%2F%2Fwww.facebook.com%2Fshare_channel%2F%3Ftype%3Dreshare%26amp%253Bamp%253Blink%3Dhttps%253A%252F%252Fdev.to%252Flaoshanxi%252Frunning-native-non-container-workloads-on-kubernetes-a-practical-experiment-12%26amp%253Bamp%253Bapp_id%3D966242223397117%26amp%253Bamp%253Bsource_surface%3Dexternal_reshare%26amp%253Bamp%253Bdisplay%26amp%253Bamp%253Bhashtag
Facebook Facebook 이메일 또는 휴대폰 비밀번호 계정을 잊으셨나요? 새 계정 만들기 일시적으로 차단됨 일시적으로 차단됨 회원님의 이 기능 사용 속도가 너무 빠른 것 같습니다. 이 기능 사용에서 일시적으로 차단되었습니다. Back 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) 日本語 Português (Brasil) Français (France) Deutsch 가입하기 로그인 Messenger Facebook Lite 동영상 Meta Pay Meta 스토어 Meta Quest Ray-Ban Meta Meta AI Meta AI 콘텐츠 더 보기 Instagram Threads 투표 정보 센터 개인정보처리방침 개인정보 보호 센터 정보 광고 만들기 페이지 만들기 개발자 채용 정보 쿠키 AdChoices 이용 약관 고객 센터 연락처 업로드 및 비사용자 설정 활동 로그 Meta © 2026
2026-01-13T09:30:36
https://bifromq.apache.org/docs/installation/install_from_source/
Install from Source | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ Next (Incubating) Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation Docker Linux Windows Install from Source Configuration Convention & Migration Notes on Kubernetes Deployment BifroMQ Cluster User Guide Plugin Administration Benchmark Contribution Installation Install from Source Version: Next (Incubating) On this page Install from Source Prerequisites ​ JDK 17+ Maven 3.5.0+ Build ​ Clone the repository to local workspace cd <YOUR_WORKSPACE> git clone https://github.com/apache/bifromq bifromq Change directory to project root folder and execute following commands to build the whole project cd bifromq mvn wrapper:wrapper ./mvnw -U clean package The build output are two tar.gz and one zip files under /target/output bifromq-xxx-standalone.tar.gz // standalone deployment tar.gz for linux and mac os bifromq-xxx-windows-standalone.zip // standalone deployment zip for windows Edit this page Previous Windows Next Configuration Convention & Migration Prerequisites Build Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://phproundtable.com/show/why-im-afraid-to-admit-im-a-php-programmer
PHPRoundtable PHPRoundtable The PHP podcast where everyone has a seat. Guests Library Sponsors About Us 53: Why I'm Afraid To Admit I'm A PHP Programmer Panelists: Evert Pot Davey Shafik September 2 2016 So you spend most of your time programming in PHP. You meet another programmer out in the wild. You begin explaining what you do. Do you find yourself using vague terms and actively trying to avoid the word "PHP?" Do you dread the question, "What language Are negative opinions about PHP always valid? A lot of negative stereotypes of PHP are base on negative traits of the language that are no longer a problem: PHP has matured a lot over the last few years [PHP: a fractal of bad design]( https://eev . About Us Sponsors © 2026 PHPRoundtable Proud member of the php[architect] family
2026-01-13T09:30:36
https://bifromq.apache.org/docs/2.1.x/category/get-started/
Get Started | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 2.1.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install BifroMQ Connect to BifroMQ Install & Deploy Configuration User Guide Plugin Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 2.1.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Get Started Version: 2.1.x Get Started BifroMQ overview introduction, features list, system limitations, release log, etc. 📄️ Install BifroMQ Docker 📄️ Connect to BifroMQ Simple Connection Verification using an MQTT Client Previous Features List Next Install BifroMQ Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://phproundtable.com/show/a-2014-wurstcon-special
PHPRoundtable PHPRoundtable The PHP podcast where everyone has a seat. Guests Library Sponsors About Us 3: A 2014 WurstCon Special Panelists: Phil Sturgeon Jeremy Mikola Chris Tankersley Daniel Cousineau David Buchmann Chuck Reeves Heather Fronczak September 20 2014 Drunken chatter from #WurstCon Chicago 2014 . About Us Sponsors © 2026 PHPRoundtable Proud member of the php[architect] family
2026-01-13T09:30:36
https://vml.visma.ai/support#getstarted
Interested in Autosuggest or Smartscan? About us Who are we? Learn more about Visma Machine Learning What we do Learn more about the products we offer What our customers say Read our customers' testimonials Products Autosuggest Automate your workflow Smartscan Extract data from your documents Resources Blog Product news and showcases Showcase of prototypes Prototypes, ideas and experiments Support Get started Find out more about onboarding to Visma Machine Learning FAQ We have answers to your frequently asked questions. Privacy policy Learn how we handle your data and protect your privacy Cookie policy Learn about how we use cookies to enhance your experience API Documentation Contact Us About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Showcase of prototypes Support Get started FAQ Privacy policy Cookie policy API Documentation Loading... Gærtorvet 1-5 1799 Copenhagen Denmark E-mail: worksmarter@visma.com About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Prototypes Documentation Support Get started FAQ Privacy policy Cookie policy Security Information Operating Status © 2026 Visma Group. All rights reserved Start your journey to intelligent automation now Come join us at the forefront of automation. If you're new to Machine Learning Assets, check out our API documentation for key guidelines on how to make the most of our products. View our FAQ section and onboarding steps below and let us know if you have any questions. Contact us See documentation How to onboard? If you work for Visma, and have access to Visma's Slack, we are available for questions or support regarding Autosuggest or Smartscan, on our support slack channel #smb-vml-support . If you have questions that our documentation does not have answers for, or if you run into what could be a bug in our systems, you can reach out to us at worksmarter@visma.com . Onboarding process differs for external and internal Visma customers: For Visma companies We offer self sign up with your visma e-mail, where you can set up a project from the Development Portal, staging and production : Get a project token from the portal Add team members who need access to the project Implement and call the API in your software For External (non-Visma) companies Self sign up and access to the portal requires a Visma e-mail. To get access to the API contact us on our support email . We can provide you with a token, which you can use to access our API. Frequently asked questions General What does it cost to get started? We provide free API access in staging to all Visma companies. To ensure the best onboarding and a strong partnership, contact us for more information. How are your solutions priced? Smartscan is competitively priced. For Visma companies, it's very competitively priced. contact us for more information. Feel free to test both Smartscan and Autosuggest and get a sense for what to expect. Do you provide any end-user products? Or is it purely developer/API-focused? Our solutions are strictly API-based. Build it into your software, so that you can offer your end-users a fluent experience. We offer guidance on UI and best practices, along with use cases from our other integrations. Get in touch with worksmarter@visma.com and we can help you out with this. On what platform do your APIs work? Can your solutions be implemented on-premise? Our APIs can be integrated into any software that you may be using and can be implemented into any web or mobile application of choice. The main source of communication is standardized JSON, so it is independent of specific programming languages. The APIs are made in a developer-friendly way, so that you can easily integrate our solutions into existing software - into any web or mobile application of choice. The API is well documented , so that your developers will have all the information they need to successfully implement the API. How long does it take to implement Smartscan/Autosuggest? How much workload is to be expected for the integrations? The implementation of our APIs and the direct integration can be done in a single day - integration into your application - data flow as well as user workflow is impossible for us to guess at. This will depend on the use case and your business, but in general it is expected that you can implement the actual integration of our Smartscan product in less than 1 day with our simple APIs. Do you have SDKs in your documentation? Yes, you can find our SDK solutions in our documentation to easily implement them in mobile and web applications. The SDK is being generated for various languages (C#, Go, Java, Python), each language has its own standalone SDK that performs the same function as the others. We support mainly four languages and have provided examples on how to use the SDKs for each of them. All data types are defined in the library so no JSON required Examples of current SDKs can be found in our API definitions Using the SDK means that your IDE of choice will help you create requests by utilising intelliSense which makes it much more convenient. Are the machine learning models customer-specific or global? Smartscan provides standard answers for common document types and is pre-trained to do so. Autosuggest is a platform for learning customer-specific behaviour and as such needs to be integrated with training data from customers to operate. Depending on your use case, the model can be trained per individual customer, but can also perform as one global prediction model across your customer base. Who develops and maintains the machine learning models? Smartscan is developed by the Visma ML Assets team. Autosuggest automatically updates ML models - the platform and built-in QA loop are developed by the Visma ML Assets team. Is the data hosted in the EU? Yes, Visma ML Assets is fully hosted in EU data centres on Google Cloud Platform. You can find more information on our privacy page and Visma's Trust Centre page . How about GDPR & Security? Are you GDPR compliant? All data is saved within the EU and our processes are GDPR compliant. For GDPR concerns: We enforce processing in the EU to support GDPR. Read more about where your data is saved on our privacy page . What kind of customer and technical support does your team offer? API documentation Technical support: We have a Slack community where you can ask your questions and chat with our team. We don't do the integration in your software, but we can offer support and guidance with implementation if needed. QA analysis + progress reports If you require a custom feature or have a specific use case that doesn't quite fit the current offering please get in touch with us at worksmarter@visma.com and we'll see what we can do to help! Smartscan How can I test the Smartscan API? Follow the instructions in the onboarding section above and our API documentation . To test our APIs, you can use our staging environment . You only have to sign in with your visma-email and set up a project on our Staging Portal. Then you'll be able to start using and calling the API - and receive the corresponding json output. We also have a demo page available in our Portal, so you can see it in action. Does Smartscan make use of OCR? Yes, we do! We apply text recognition with the highest recognition rate possible. Google's OCR technology converts any type of image (containing typed, handwritten, or printed text) into a machine-readable format (for example CSV, JSON, or XML). How quickly does the AI learn new data? We pre-train the model every couple of months, so Smartscan is updated approx. 2-6 times per year. How do you ensure high quality output? What quality can I expect? The quality of the scanned documents depends on your documents and cannot be guaranteed. Smartscan outputs up to 90% of the answers requested. Certain fields have the potential to reach an error rate as low as 1%. Confidence levels? Threshold values? Smartscan is tuned to provide an assessment on the likely correctness of all answers we provide. Consult our documentation for details. Are Smartscan's answers verified by humans? No. Man in loop or “human-in-the-loop” refers to systems that allow humans to directly interact with the AI systems to account for any uncertainty and offer 100% automation. Therefore, human-in-the-loop means integrating human employees into the machine learning pipeline, so that they can continuously validate e.g. documents and AI models. This can often result in longer processing times. What are the supported countries? We currently provide support for most European countries, and our software is already being used by end-users across all Europe, but most activity in the Nordics, Romania, Netherlands, and Belgium. Smartscan was trained with documents from over 50 countries, ensuring that you can extract data from your document and get instant results. Current supported countries are listed in our here: see API docs . We're continuously working together with our integrators to expand our document and language support. Please contact us if you would like us to look into new geographical areas. Which document formats are supported? Currently supported image types: PDF containing text PDF containing images (most often from scanners) JPG / JPEG PNG BMP HEIF WEBP GIF TIFF Which document types are supported? The following list gives you an idea of the type of documents we process. It works most seamlessly with receipts, invoices, and bank statements. In case you wonder if we support a certain document that is not on the list, feel free to contact us . Smartscan is currently set up to handle multiple document types, namely: Invoices Receipts Purchase Orders Credit Notes Debit notes What is the max request size can I send to Smartscan? Smartscan accepts only requests up to 10Mb in size, so the max request size is 10485760 Bytes (10Mb). Requests bigger than the max request size will result in a 413 response. Do you support local characters, as in Æ Ø Å Á Ö ? Yes, we generally support Unicode, i.e. local characters to the extent the OCR is able to output them. Does the OCR work on low-quality images? Smartscan processes all text the OCR is able to scan, and is trained to process documents from a large number of different layouts. This can include handwritten receipts on standard pads. Smartscan never rejects images, unless they are digitally damaged or above our size limit (or in an unsupported document format). Google's OCR is astoundingly good even in very bad conditions, bad light skews even handwritten documents, and documents with light and focus issues can work. What is the average API response time? The average processing time is around 1 second, and 95% of the requests are below 2.5 seconds. Our goal is to make sure you can get real-time results in your application. Autosuggest Which document types are supported? Autosuggest can ingest different types of input data, i.e. bank transactions, scanned invoices (i.e. document text), electronic invoice lines. What is the max request size can I send to Autosuggest? Autosuggest accepts only requests up to 10Mb in size, so the max request size is 10485760 Bytes (10Mb). Requests bigger than the max request size will result in a 413 response. How quickly does the AI learn new data? How many samples do you need in order to get results? Will the model be trained automatically with enough samples? Autosuggest models are retrained daily if new data is available. The model will try to train every time you add some data to your dataset, usually a few hours after the addition. With respect to how much data is required, the answer to this question varies a lot with data quality and the complexity of the task we're trying to learn. In optimal cases, Autosuggest starts providing useful answers with as few as 50-100 examples. We recommend having at least 20 samples. If the model does not have enough samples, it will end up with an unsuccessful training. Then you can add more samples and Autosuggest will try to train the model, ending up either in failure if it's not enough, or successfully when it's enough samples. What is a confidence score? All predictions from Autosuggest are accompanied by a quality score, namely the confidence score . Generally speaking, when the confidence is higher, the answer is more likely to be correct. To present your users with reliable predictions, you should filter out (i.e. simply ignore) answers below an acceptable confidence. Read more in our documentation . You might find the following explainer useful: Understanding ML Quality
2026-01-13T09:30:36
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/QueryStringParameters.html
Cache content based on query string parameters - Amazon CloudFront Cache content based on query string parameters - Amazon CloudFront Documentation Amazon CloudFront Developer Guide Console and API settings for query string forwarding and caching Optimize caching Query string parameters and CloudFront standard logs (access logs) Cache content based on query string parameters Some web applications use query strings to send information to the origin. A query string is the part of a web request that appears after a ? character; the string can contain one or more parameters, separated by & characters. In the following example, the query string includes two parameters, color=red and size=large : https://d111111abcdef8.cloudfront.net/images/image.jpg? color=red&size=large For distributions, you can choose if you want CloudFront to forward query strings to your origin and whether to cache your content based on all parameters or on selected parameters. Why might this be useful? Consider the following example. Suppose that your website is available in five languages. The directory structure and file names for all five versions of the website are identical. As a user views your website, requests that are forwarded to CloudFront include a language query string parameter based on the language that the user chose. You can configure CloudFront to forward query strings to the origin and to cache based on the language parameter. If you configure your web server to return the version of a given page that corresponds with the selected language, CloudFront caches each language version separately, based on the value of the language query string parameter. In this example, if the main page for your website is main.html , the following five requests cause CloudFront to cache main.html five times, once for each value of the language query string parameter: https://d111111abcdef8.cloudfront.net/main.html? language=de https://d111111abcdef8.cloudfront.net/main.html? language=en https://d111111abcdef8.cloudfront.net/main.html? language=es https://d111111abcdef8.cloudfront.net/main.html? language=fr https://d111111abcdef8.cloudfront.net/main.html? language=jp Note the following: Some HTTP servers don't process query string parameters and, therefore, don't return different versions of an object based on parameter values. For these origins, if you configure CloudFront to forward query string parameters to the origin, CloudFront still caches based on the parameter values even though the origin returns identical versions of the object to CloudFront for every parameter value. For query string parameters to work as described in the example above with the languages, you must use the & character as the delimiter between query string parameters. If you use a different delimiter, you may get unexpected results, depending on which parameters you specify for CloudFront to use as a basis for caching, and the order in which the parameters appear in the query string. The following examples show what happens if you use a different delimiter and you configure CloudFront to cache based only on the color parameter: In the following request, CloudFront caches your content based on the value of the color parameter, but CloudFront interprets the value as red;size=large : https://d111111abcdef8.cloudfront.net/images/image.jpg? color=red;size=large In the following request, CloudFront caches your content but doesn't base caching on the query string parameters. This is because you configured CloudFront to cache based on the color parameter, but CloudFront interprets the following string as containing only a size parameter that has a value of large;color=red : https://d111111abcdef8.cloudfront.net/images/image.jpg? size=large;color=red You can configure CloudFront to do one of the following: Don't forward query strings to the origin at all. If you don't forward query strings, CloudFront doesn't cache based on query string parameters. Forward query strings to the origin, and cache based on all parameters in the query string. Forward query strings to the origin, and cache based on specified parameters in the query string. For more information, see Optimize caching . Topics Console and API settings for query string forwarding and caching Optimize caching Query string parameters and CloudFront standard logs (access logs) Console and API settings for query string forwarding and caching When you create a distribution in the CloudFront console, CloudFront configures query string forwarding and caching for you based on your origin type. Optionally, you can manually edit these settings. For more information, see the following settings in the All distribution settings reference : Query string forwarding and caching Query string allowlist To configure query string forwarding and caching with the CloudFront API, see CachePolicy and OriginRequestPolicy in the Amazon CloudFront API Reference . Optimize caching When you configure CloudFront to cache based on query string parameters, you can take the following steps to reduce the number of requests that CloudFront forwards to your origin. When CloudFront edge locations serve objects, you reduce the load on your origin server and reduce latency because objects are served from locations that are closer to your users. Cache based only on parameters for which your origin returns different versions of an object For each query string parameter that your web application forwards to CloudFront, CloudFront forwards requests to your origin for every parameter value and caches a separate version of the object for every parameter value. This is true even if your origin always returns the same object regardless of the parameter value. For multiple parameters, the number of requests and the number of objects multiply. We recommend that you configure CloudFront to cache based only on the query string parameters for which your origin returns different versions, and that you carefully consider the merits of caching based on each parameter. For example, suppose you have a retail website. You have pictures of a jacket in six different colors, and the jacket comes in 10 different sizes. The pictures that you have of the jacket show the different colors but not the different sizes. To optimize caching, you should configure CloudFront to cache based only on the color parameter, not on the size parameter. This increases the likelihood that CloudFront can serve a request from the cache, which improves performance and reduces the load on your origin. Always list parameters in the same order The order of parameters matters in query strings. In the following example, the query strings are identical except that the parameters are in a different order. This causes CloudFront to forward two separate requests for image.jpg to your origin and to cache two separate versions of the object: https://d111111abcdef8.cloudfront.net/images/image.jpg? color=red&size=large https://d111111abcdef8.cloudfront.net/images/image.jpg? size=large&color=red We recommend that you always list parameter names in the same order, such as alphabetical order. Always use the same case for parameter names and values CloudFront considers the case of parameter names and values when caching based on query string parameters. In the following example, the query strings are identical except for the case of parameter names and values. This causes CloudFront to forward four separate requests for image.jpg to your origin and to cache four separate versions of the object: https://d111111abcdef8.cloudfront.net/images/image.jpg? color=red https://d111111abcdef8.cloudfront.net/images/image.jpg? color=Red https://d111111abcdef8.cloudfront.net/images/image.jpg? Color=red https://d111111abcdef8.cloudfront.net/images/image.jpg? Color=Red We recommend that you use case consistently for parameter names and values, such as all lowercase. Don’t use parameter names that conflict with signed URLs If you're using signed URLs to restrict access to your content (if you added trusted signers to your distribution), CloudFront removes the following query string parameters before forwarding the rest of the URL to your origin: Expires Key-Pair-Id Policy Signature If you're using signed URLs and you want to configure CloudFront to forward query strings to your origin, your own query string parameters cannot be named Expires , Key-Pair-Id , Policy , or Signature . Query string parameters and CloudFront standard logs (access logs) If you enable logging, CloudFront logs the full URL, including query string parameters. This is true regardless of whether you have configured CloudFront to forward query strings to the origin. For more information about CloudFront logging, see Access logs (standard logs) . Javascript is disabled or is unavailable in your browser. To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions. Document Conventions Manage cache expiration Cache content based on cookies Did this page help you? - Yes Thanks for letting us know we're doing a good job! If you've got a moment, please tell us what we did right so we can do more of it. Did this page help you? - No Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
2026-01-13T09:30:36
https://phproundtable.com/show/coding-securely-in-php
PHPRoundtable PHPRoundtable The PHP podcast where everyone has a seat. Guests Library Sponsors About Us 9: Coding Securely In PHP Panelists: Anthony Ferrara Daniel Lowrey Chris Cornutt January 12 2015 With big security breaches becoming the norm these days, security is something we simply cannot ignore. In this discussion we'll ask the experts how we can become more responsible developers by learning about specific security threats we should be most co About Us Sponsors © 2026 PHPRoundtable Proud member of the php[architect] family
2026-01-13T09:30:36
https://www.hcaptcha.com/user-journeys.html
User Journeys Pricing Pro Enterprise MFA User Journeys Docs Blog Sign Up Log In From the blog: Preparing for AI Agents → Switch to English Accessibility Pricing Pro Enterprise MFA User Journeys Docs Blog Contact Sales Sign Up Log In USER JOURNEYS Understand Intent. Stop Abuse. Find threats across the full user journey: agents, bots, or people Get Started Fraud and abuse take many forms, but actions signal intent. User Journeys finds malicious intent across sessions, devices, and apps. Give your systems and analysts new signals to distinguish real users from threats, while preserving privacy with our Zero PII design. Get Started User Journeys Signal Intent at Every Step hCaptcha User Journeys builds a privacy-preserving analysis indicating what threat actors are trying to do, not just what they’ve done. From account takeovers to transaction fraud, detect intent signals that expose risk before it escalates. See Intent in Motion Understand Motives, Not Just Outcomes Account Takeovers Uncover intent shifts and subtle indicators that precede ATOs. Synthetic Identity and Application Fraud Detect coordinated fraud patterns mimicking legitimate behavior. Multi-accounting & Collusion Identify shared intent across proxies, sessions, and other attack infrastructure. Incentive Abuse Expose manipulation of signups, returns, and promotions. Transaction Fraud Locate groups of suspicious actors based on holistic intent signals. Account Sharing Define and enforce your own rules for shared logins across users, teams, or locations. Analytics That Reveal True Intent hCaptcha User Journeys turns data into actionable insights. Network Detection Expose coordinated abuse by linking users through shared infrastructure and holistic intent analysis. Session Monitoring Trace intent across the full session lifecycle, surfacing attack indicators instantly. View Case Studies Rule Simulation & Backtesting Test intent-based controls on real data to validate outcomes and enforce business logic in seconds. View Case Studies Built for Modern Security and Engineering Teams hCaptcha Enterprise offers an API-first platform that deciphers user intent at scale: Stop Account Takeovers Reveal spoofing, tampering, and automation with uniquely accurate signals. Risk Scoring Score sessions based on intent and risk progression over time, not just single anomalies. Rules Engine Define and execute real-time decisions with flexible no-code rule builders. Case Management Track behavioral intent and decision outcomes across users and sessions. Gain clarity on user intent. Stop threats with confidence. Trusted by thousands of companies Start a pilot Region * North America (NA) South America, Mexico (LATAM) Europe, Middle East, Africa (EMEA) Asia-Pacific (APAC) Your Name* Company * Business Email * Any other details we should have? * Do you require urgent onboarding? Yes.   I am under attack and require immediate onboarding. Thank you! Your submission has been received! Oops! Something went wrong while submitting the form. By entering your email, you agree to our Terms and Privacy Policy, and to receive email from us. See hCaptcha Enterprise in Action Get a demo or start a pilot today. Get Started Company About Jobs Trademarks AI Ethics Press Compliance Resources Status Documentation Report a Bug Accessibility Cyberattacks 101 GDPR Contact Us Contact Sales Contact Support Company Jobs AI Ethics Compliance About Trademarks Press Resources Documentation Accessibility Status Report a Bug Cyberattacks 101 Contact Support Contact Support Sales Contact Sales Blog Terms Privacy DMCA Attribution hCaptcha is a registered trademark of Intuition Machines, Inc. ©2025 Intuition Machines, Inc.
2026-01-13T09:30:36
https://bifromq.apache.org/docs/1.0.x/get_started/connect_to/
Connect to BifroMQ | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 1.0.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install BifroMQ Connect to BifroMQ Install & Deploy Configuration User Guide Plugin Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 1.0.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Get Started Connect to BifroMQ Version: 1.0.x On this page Connect to BifroMQ Simple Connection Verification using an MQTT Client ​ Using an existing third-party MQTT client tool, you can quickly verify whether you can send or receive messages by interacting with the MQTT service provided by BifroMQ. There are several free third-party MQTT client tools available such as MQTT.fx, MQTTBox, MQTTLens, MQTTX, etc. In this example, we will be using MQTTX. Visit https://mqttx.app/ to download MQTTX and install it. Open MQTTX and click on “New Connection” or the “+” sign on the left sidebar to create a new connection configuration. Fill in the required fields: Name: Name of this configuration. You can choose any name. ClientID: Client ID, which you can set manually or generate randomly using the button on the right. It must contain characters “a-z”, “0-9”, “_”, “-”, and cannot exceed 128 bytes. It should be in UTF8 encoding and must be unique. Host: Connection address. Choose the protocol prefix from mqtt://, mqtts://, or wss://, corresponding to TCP, TLS/SSL, or WSS in MQTT connection respectively. Please fill in the domain name that can actually access the BifroMQ MQTT service. Port: Connection port. Choose the appropriate port based on the protocol prefix. Default ports are TCP: 1883, TLS/SSL: 1884, WSS: 443. Username & Password: Enter the username and password you possess. MQTT Version: Select 3.1.1 After entering the connection configuration correctly, click "Connect" in the top right corner to connect to the server. If everything is fine, you will see a "Connect Successful" message and be redirected to the message send/receive interface. Subscribe to a topic: Click on the “New Subscription” button in the top left corner and enter the topic in the pop-up dialog box. Note that you must enter a topic you have subscription privileges for. In this example, we will use a test topic: $iot/device1/user/fortest. Select the default QoS 0 and click "Confirm" to subscribe. Publish a message: In the message send/receive interface, enter the topic in the bottom right corner. We will use the same test topic as before. Send a message to yourself by selecting the default QoS 0, entering the message content, and clicking the send button. After sending the message successfully, you can see the sent message on the right. If the MQTT service is working properly, since we are subscribed to that topic, we will receive the message and it will also be displayed on the left side of the conversation interface. Edit this page Previous Install BifroMQ Next Install & Deploy Simple Connection Verification using an MQTT Client Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://docs.aws.amazon.com/de_de/AmazonCloudFront/latest/DeveloperGuide/QueryStringParameters.html
Zwischenspeichern von Inhalten auf der Grundlage von Abfragezeichenfolgeparametern - Amazon CloudFront Zwischenspeichern von Inhalten auf der Grundlage von Abfragezeichenfolgeparametern - Amazon CloudFront Dokumentation Amazon CloudFront Entwicklerhandbuch Konsolen- und API-Einstellungen für die Weiterleitung und Zwischenspeicherung von Abfragezeichenfolgen Optimieren der Zwischenspeicherung Parameter für Abfragezeichenfolgen und CloudFront-Standardprotokolle abfragen (Zugriffsprotokolle) Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich. Zwischenspeichern von Inhalten auf der Grundlage von Abfragezeichenfolgeparametern Einige Webanwendungen verwenden zum Senden von Informationen an den Ursprung Abfragezeichenfolgen. Eine Abfragezeichenfolge ist der Teil einer Webanfrage nach dem Zeichen ? . Die Zeichenfolge kann einen oder mehrere durch das Zeichen & getrennte Parameter enthalten. Im folgenden Beispiel enthält die Abfragezeichenfolge zwei Parameter, color=red und size=large : https://d111111abcdef8.cloudfront.net/images/image.jpg? color=red&size=large Bei Verteilungen können Sie wählen, ob CloudFront Abfragezeichenfolgen an Ihren Ursprung weiterleiten und ob Ihr Inhalt auf der Grundlage von allen oder von ausgewählten Parametern zwischengespeichert werden soll. Warum kann dies sinnvoll sein? Betrachten Sie das folgende Beispiel. Angenommen, Ihre Website ist in fünf Sprachen verfügbar. Die Verzeichnisstruktur und Dateinamen für alle fünf Versionen der Website sind identisch. Wenn ein Benutzer Ihre Website aufruft, beinhalten die an CloudFront weitergeleiteten Anforderungen einen Sprachabfrage-Zeichenfolgeparameter auf der Grundlage der vom Benutzer ausgewählten Sprache. Sie können CloudFront so konfigurieren, dass Abfragezeichenfolgen auf der Grundlage des Sprachparameters an den Ursprung weitergeleitet und Zwischenspeicherungen vorgenommen werden. Wenn Sie Ihren Webserver so konfigurieren, dass die Version einer bestimmten Seite zurückgegeben wird, die der ausgewählten Sprache entspricht, speichert CloudFront alle Sprachversionen auf der Grundlage des Werts des Sprachabfrage-Zeichenfolgeparameters separat zwischen. In diesem Beispiel, in dem die Hauptseite Ihrer Website main.html ist, führen die folgenden fünf Anforderungen dazu, dass CloudFront main.html fünfmal zwischenspeichert, einmal für jeden Wert des Sprachabfrage-Zeichenfolgenparameters: https://d111111abcdef8.cloudfront.net/main.html? language=de https://d111111abcdef8.cloudfront.net/main.html? language=en https://d111111abcdef8.cloudfront.net/main.html? language=es https://d111111abcdef8.cloudfront.net/main.html? language=fr https://d111111abcdef8.cloudfront.net/main.html? language=jp Beachten Sie Folgendes: Einige HTTP-Server verarbeiten keine Abfragezeichenfolgeparameter und geben daher nicht unterschiedliche Versionen eines Objekts auf der Grundlage der Parameterwerte zurück. Wenn Sie bei diesen Ursprüngen CloudFront so konfigurieren, dass Abfragezeichenfolgeparameter an den Ursprung weitergeleitet werden, speichert CloudFront weiterhin auf der Grundlage der Parameterwerte zwischen, selbst wenn der Ursprung für jeden Parameterwert identische Versionen des Objekts an CloudFront zurückgibt. Damit Abfragezeichenfolgeparameter wie im obigen Beispiel beschrieben mit den Sprachen funktionieren, müssen Sie das Zeichen & als Trennzeichen zwischen den Abfragezeichenfolgeparametern verwenden. Wenn Sie ein anderes Trennzeichen verwenden, erhalten Sie möglicherweise unerwartete Ergebnisse, je nachdem, welche Parameter CloudFront als Basis für die Zwischenspeicherung verwenden soll und in welcher Reihenfolge sie in der Abfragezeichenfolge angezeigt werden. Die folgenden Beispiele zeigen, was passiert, wenn Sie ein anderes Trennzeichen verwenden und CloudFront so konfigurieren, dass die Zwischenspeicherung nur auf der Grundlage des color -Parameters erfolgt: In der folgenden Anforderung speichert CloudFront Ihre Inhalte auf der Grundlage des Werts des Parameters color zwischen. CloudFront interpretiert den Wert jedoch als red;size=large : https://d111111abcdef8.cloudfront.net/images/image.jpg? color=red;size=large In der folgenden Anforderung speichert CloudFront Ihre Inhalte zwischen, jedoch nicht basierend auf den Abfragezeichenfolgeparametern. Der Grund hierfür ist, dass Sie CloudFront so konfiguriert haben, dass die Zwischenspeicherung auf der Grundlage des Parameters color erfolgt, CloudFront die folgende Zeichenfolge jedoch so interpretiert, dass sie nur einen size -Parameter mit dem Wert large;color=red enthält: https://d111111abcdef8.cloudfront.net/images/image.jpg? size=large;color=red Sie können CloudFront für eine der folgenden Aktionen konfigurieren: Keine Abfragezeichenfolge an den Ursprung weiterleiten. Wenn Sie keine Abfragezeichenfolgen weiterleiten, speichert CloudFront nicht auf der Grundlage von Abfragezeichenfolgeparametern zwischen. Abfragezeichenfolgen an den Ursprung weiterleiten und auf der Grundlage aller Parameter in der Abfragezeichenfolge zwischenspeichern. Abfragezeichenfolgen an den Ursprung weiterleiten und auf der Grundlage spezifischer Parameter in der Abfragezeichenfolge zwischenspeichern. Weitere Informationen finden Sie unter Optimieren der Zwischenspeicherung . Themen Konsolen- und API-Einstellungen für die Weiterleitung und Zwischenspeicherung von Abfragezeichenfolgen Optimieren der Zwischenspeicherung Parameter für Abfragezeichenfolgen und CloudFront-Standardprotokolle abfragen (Zugriffsprotokolle) Konsolen- und API-Einstellungen für die Weiterleitung und Zwischenspeicherung von Abfragezeichenfolgen Wenn Sie eine Distribution in der CloudFront-Konsole erstellen, konfiguriert CloudFront die Weiterleitung und das Zwischenspeichern von Abfragezeichenfolgen für Sie auf der Grundlage Ihres Quelltyps. Sie können diese Einstellungen auch manuell bearbeiten. Weitere Informationen zu den folgenden Einstellungen finden Sie in der Referenz für alle Distributionseinstellungen : Weiterleitung und Zwischenspeicherung von Abfragezeichenfolgen Zulassungsliste für Abfragezeichenfolgen Informationen dazu, wie Sie die Weiterleitung und Zwischenspeicherung von Abfragezeichenfolgen mit der CloudFront-API konfigurieren, finden Sie unter CachePolicy und OriginRequestPolicy in der Referenz zur Amazon CloudFront API . Optimieren der Zwischenspeicherung Wenn Sie CloudFront konfigurieren, basierend auf Abfragezeichenfolgenparametern zwischenzuspeichern, können Sie die folgenden Schritte ausführen, um die Anzahl der Anforderungen reduzieren, die von CloudFront an Ihren Ursprung weitergeleitet werden. Wenn CloudFront-Edge-Standorte Objekte bereitstellen, reduzieren Sie die Belastung Ihres Ursprungs-Servers und reduzieren die Latenz, da Objekte von Standorten bereitgestellt werden, die näher an Ihren Benutzern liegen. Zwischenspeichern auf der ausschließlichen Grundlage von Parametern, für die Ihr Ursprung verschiedene Versionen eines Objekts zurückgibt Für jeden Abfragezeichenfolgeparameter, den Ihre Webanwendung an CloudFront weiterleitet, leitet CloudFront Anforderungen für jeden Parameterwert an Ihren Ursprung weiter und speichert eine separate Version des Objekts für jeden Parameterwert zwischen. Dies gilt auch, wenn Ihr Ursprung unabhängig vom Parameterwert immer dasselbe Objekt zurückgibt. Bei mehreren Parametern multiplizieren sich die Anzahl der Anfragen und die Anzahl der Objekte. Wir empfehlen, CloudFront so zu konfigurieren, dass die Zwischenspeicherung auf ausschließlicher Grundlage der Abfragezeichenfolgeparameter erfolgt, für die Ihr Ursprung verschiedene Versionen zurückgibt, und dass Sie sorgfältig abwägen, welche Vorteile die Zwischenspeicherung auf der Grundlage aller Parameter hat. Nehmen wir beispielsweise an, dass Sie eine Einzelhandels-Website besitzen. Sie haben Bilder einer Jacke in sechs verschiedenen Farben und es gibt die Jacke in zehn verschiedenen Größen. Die Bilder, die Sie von der Jacke haben, zeigen die verschiedenen Farben, jedoch nicht die verschiedenen Größen. Um die Zwischenspeicherung zu optimieren, sollten Sie CloudFront so konfigurieren, dass die Zwischenspeicherung auf ausschließlicher Grundlage der Farbparameter erfolgt und nicht auf Grundlage der Größenparameter. Dies erhöht die Wahrscheinlichkeit, dass CloudFront eine Anforderung aus dem Cache bereitstellen kann, um die Leistung zu verbessern und die Auslastung des Ursprungs zu reduzieren. Parameter immer in der gleichen Reihenfolge auflisten Die Reihenfolge der Parameter in Abfragezeichenfolgen ist wichtig. Im folgenden Beispiel sind die Abfragezeichenfolgen identisch, abgesehen davon, dass die Parameter eine andere Reihenfolge aufweisen. Dadurch wird CloudFront veranlasst, zwei separate Anforderungen für image.jpg an Ihren Ursprung weiterzuleiten und zwei verschiedene Versionen des Objekts zwischenzuspeichern: https://d111111abcdef8.cloudfront.net/images/image.jpg? color=red&size=large https://d111111abcdef8.cloudfront.net/images/image.jpg? size=large&color=red Wir empfehlen, Parameternamen immer in der gleichen Reihenfolge aufzulisten, beispielsweise in alphabetischer Reihenfolge. Immer dieselbe Schreibweise für Parameternamen und -werte verwenden CloudFront berücksichtigt bei der Zwischenspeicherung auf der Grundlage von Abfragezeichenfolgeparametern die Schreibweise von Parameternamen und -werten. Im folgenden Beispiel sind die Abfragezeichenfolgen identisch, abgesehen von der Schreibweise der Parameternamen und -werte. Dadurch wird CloudFront veranlasst, vier separate Anforderungen für image.jpg an Ihren Ursprung weiterzuleiten und vier verschiedene Versionen des Objekts zwischenzuspeichern: https://d111111abcdef8.cloudfront.net/images/image.jpg? color=red https://d111111abcdef8.cloudfront.net/images/image.jpg? color=Red https://d111111abcdef8.cloudfront.net/images/image.jpg? Color=red https://d111111abcdef8.cloudfront.net/images/image.jpg? Color=Red Wir empfehlen, konsistent dieselbe Schreibweise für Parameternamen und -werte zu verwenden, beispielsweise nur Kleinbuchstaben. Keine Parameternamen verwenden, die mit signierten URLs in Konflikt stehen Wenn Sie signierte URLs verwenden, um den Zugriff auf Ihre Inhalte einzuschränken (wenn Sie vertrauenswürdiger Aussteller zu Ihrer Verteilung hinzugefügt haben), entfernt CloudFront die folgenden Abfragezeichenfolgeparameter, bevor der Rest Ihrer URL an Ihren Ursprung weitergeleitet wird: Expires Key-Pair-Id Policy Signature Wenn Sie signierte URLs verwenden und CloudFront so konfigurieren möchten, dass Abfragezeichenfolgen an Ihren Ursprung weitergeleitet werden, können Ihre eigenen Abfragezeichenfolgeparameter nicht mit Expires , Key-Pair-Id , Policy oder Signature benannt werden. Parameter für Abfragezeichenfolgen und CloudFront-Standardprotokolle abfragen (Zugriffsprotokolle) Wenn Sie die Protokollierung aktivieren, protokolliert CloudFront die vollständige URL einschließlich der Parameter für Abfragezeichenfolgen. Dies gilt unabhängig davon, ob Sie CloudFront so konfiguriert haben, dass Abfragezeichenfolgen an den Ursprung weitergegeben werden. Weitere Informationen zur CloudFront-Protokollierung finden Sie unter Zugriffsprotokolle (Standardprotokolle) . JavaScript ist in Ihrem Browser nicht verfügbar oder deaktiviert. Zur Nutzung der AWS-Dokumentation muss JavaScript aktiviert sein. Weitere Informationen finden auf den Hilfe-Seiten Ihres Browsers. Dokumentkonventionen Verwalten des Cache-Ablaufdatums Zwischenspeichern von Inhalten auf der Grundlage von Cookies Hat Ihnen diese Seite geholfen? – Ja Vielen Dank, dass Sie uns mitgeteilt haben, dass wir gute Arbeit geleistet haben! Würden Sie sich einen Moment Zeit nehmen, um uns mitzuteilen, was wir richtig gemacht haben, damit wir noch besser werden? Hat Ihnen diese Seite geholfen? – Nein Vielen Dank, dass Sie uns mitgeteilt haben, dass diese Seite überarbeitet werden muss. Es tut uns Leid, dass wir Ihnen nicht weiterhelfen konnten. Würden Sie sich einen Moment Zeit nehmen, um uns mitzuteilen, wie wir die Dokumentation verbessern können?
2026-01-13T09:30:36
https://bifromq.apache.org/docs/admin_guide/observability/intro/
Observability Overview | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ Next (Incubating) Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation BifroMQ Cluster User Guide Plugin Administration Configuration Tuning Observability Logging Metrics Events Security Benchmark Contribution Administration Observability Version: Next (Incubating) Observability Overview In the administration of BifroMQ, ensuring comprehensive system observability stands as a foundational element for conducting effective system operations and maintenance activities. Given BifroMQ's unique positioning as a multi-tenant capable MQTT broker, its observability features not only facilitate general operational excellence but are also crucial for the efficient management of multi-tenant business scenarios. This section explores the key components of BifroMQ's observability capabilities: logging, metrics, and events, with a particular focus on features designed to support multi-tenant environments. Edit this page Previous Linux Kernel Tuning Next Logging Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://aws.amazon.com/vpn/client-vpn/
client-vpn Skip to main content Filter: All English Contact us AWS Marketplace Support My account Search Filter: All Sign in to console Create account AWS VPN Overview Features Pricing FAQs Resources Networking and Content Delivery › AWS VPN › Client VPN AWS Client VPN Securely connect your remote workforce to AWS or on-premises resources Get started with Client VPN Download Client VPN for desktop Why Client VPN? AWS Client VPN is a fully-managed remote access VPN solution used by your remote workforce to securely access resources within both AWS and your on-premises network. Fully elastic, it automatically scales up, or down, based on demand. When migrating applications to AWS, your users access them the same way before, during, and after the move. AWS Client VPN, including the software client, supports the OpenVPN protocol. Play Benefits Advanced authentication Many organizations require multi-factor authentication (MFA) and federated authentication from their VPN solution. AWS Client VPN supports these and other authentication methods. Elastic Traditional on-premises VPN services are limited by the capacity of the hardware that runs them. AWS Client VPN is a pay-as-you-go cloud VPN service that elastically scales up or down based on user demand. Remote access Unlike on-premises VPN services, AWS Client VPN allows users to connect to AWS and on-premises networks using a single VPN connection. Fully managed AWS Client VPN automatically takes care of deployment, capacity provisioning, and service updates — while you monitor all connections from a single console. Client VPN use cases Quickly scale remote access Unexpected events can require many of your employees to work remotely. This creates a spike in VPN connections and traffic that can reduce performance or availability for your users. AWS Client VPN is elastic, and automatically scales up to handle peak demand. When the spike has passed, it scales down so you are not paying for unused capacity. Access applications during migration AWS Client VPN provides users with secure access to applications both on premises and in AWS. This is helpful during a cloud migration when applications move from on-premises locations to the cloud. With AWS Client VPN, users don’t have to change the way they access their applications during or after migration. Integrate with your authentication and MDM systems AWS Client VPN supports authentication with Microsoft Active Directory using AWS Directory Services, Certificate-based authentication, and Federated Authentication using SAML-2.0 to facilitate these scenarios when using the AWS provided OpenVPN Client software. AWS Client VPN works with Mobile Device Management (MDM) solutions to reject devices that do not comply with the your policies. Securely connecting IoT devices Create encrypted connections between IoT devices and Amazon Virtual Private Cloud (VPC) resources using certificate-based authentication. Columbia University Medical Center "Columbia University Medical Center is a clinical, research, and educational enterprise located on a campus in northern Manhattan. We have an emergency situation where due to the COVID 19 our hospital is limiting access to the campus. We needed to supplement our current physical VPN solution in order to support up to an additional 150 concurrent users with access to our datacenter and campus, so we have set up a Client VPN endpoint. With AWS Client VPN, our staff and researchers are quickly able to access the campus and continue to do research on the virus." Robert De Boer, Deputy CIO, Columbia University Medical Center Shionogi "Shionogi is a pharmaceutical company headquartered in Osaka, Japan, with research and distribution extended worldwide. We needed to dramatically and quickly change our VPN environment to support mandated Work From Home (WFH). This applied to all employees which was practically impossible with our current system. With AWS Client VPN, we were able to turn up the VPN environment for approximately 3,000 employees in just 3 days. As a result, end-users thanked us saying that the User Experience for the remote work has been greatly improved, which proved that our IT department can make a difference to the organization. The whole experience reminded us the power of the Cloud – for its speed, flexibility, and scalability." Kazuhiro Shirahase, Director of IT Promotion Division I, Shionogi Digital Science Co., Ltd. KOKUYO "KOKUYO is a manufacturing company headquartered in Osaka, Japan, creating more value in places where people ‘work’, ‘learn’, and ‘live.’ With products and services that go beyond KOKUYO's office and school supplies, the business is expanding both in Japan and also across Asia Pacific countries. In February 2020, when the COVID-19 pandemic was starting to expand, we identified the need to make changes to our existing VPN environment. Thanks to AWS Client VPN, we were able to support the rapid capacity expansion by replacing the original 550 users on our on-premises environment with 1,000 users on AWS Client VPN in the matter of 10 days. And, we were able to let it scale seamlessly from 1,000 to 4,000 users when needed, which gave us a unique experience with the elastic, scalable nature of the cloud." Takashi Yamamura, General Manager, Information Systems, KOKUYO Co., Ltd. Get started Pricing Learn more about product pricing Learn more Getting started Get started with a free account Sign up Console Start building with the console Get started Create an AWS account Learn What Is AWS? What Is Cloud Computing? What Is Agentic AI? Cloud Computing Concepts Hub AWS Cloud Security What's New Blogs Press Releases Resources Getting Started Training AWS Trust Center AWS Solutions Library Architecture Center Product and Technical FAQs Analyst Reports AWS Partners Developers Builder Center SDKs & Tools .NET on AWS Python on AWS Java on AWS PHP on AWS JavaScript on AWS Help Contact Us File a Support Ticket AWS re:Post Knowledge Center AWS Support Overview Get Expert Help AWS Accessibility Legal English Back to top Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. x facebook linkedin instagram twitch youtube podcasts email Privacy Site terms Cookie Preferences © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2026-01-13T09:30:36
https://phproundtable.com/show/php-internals-past-present-future
PHPRoundtable PHPRoundtable The PHP podcast where everyone has a seat. Guests Library Sponsors About Us 5: PHP Internals - Past, Present & Future Panelists: Anthony Ferrara Sara Golemon Elizabeth Smith Joe Watkins October 19 2014 How the sausage is made. Taking a look at PHP's history and where it's going in the future. 2:00 - Guest Introductions 4:00 - Show Begins 4:15 - Op code pops up alot in PHP Internals . Machine readable version of your script, it's what PHP actually steps through as it is executing your program. 5:50 About Us Sponsors © 2026 PHPRoundtable Proud member of the php[architect] family
2026-01-13T09:30:36
https://elevenapril.com/sunshinepal
SunshinePal - Daily Sunlight Tracker | ElevenApril Skip to main content SunshinePal Your daily sunlight companion. Track your exposure, set healthy goals, and reconnect with nature for better sleep and mood. Download from App Store See SunshinePal in Action Experience how effortless it is to track your sunlight exposure and improve your well-being. Why Sunshine Matters In our modern lives, we spend so much time indoors that we often forget our connection to the sun. Yet, sunlight is essential for our circadian rhythm, vitamin D production, and overall mental well-being. SunshinePal was created to help you bridge that gap. By using the sensors in your Apple Watch, it effortlessly tracks your time in daylight, giving you a clear picture of your daily habits. It's not about baking in the sun; it's about finding that healthy balance. A morning walk, a lunch break outside, or just a few moments of fresh air can make a world of difference. Let SunshinePal be your gentle reminder to step outside, breathe, and soak in the light. 🔒 Privacy First Your health data stays on your device. SunshinePal reads "Time in Daylight" from HealthKit and processes everything locally. We never see, store, or sell your data. Read Privacy Policy Features ☀️ Automatic Tracking Seamlessly tracks your time in daylight using your Apple Watch sensors. No manual entry needed. 🎯 Daily Goals Set your own daily sunlight goals and visualize your progress with beautiful rings. 📈 Trends & History View your 7-day history to understand your habits and stay consistent. 🔔 Gentle Reminders Get notified when you haven't had enough sun, encouraging you to take a break outside. 📱 Widgets Keep track of your sunlight exposure right from your Home Screen or Lock Screen. 🔒 Private & Secure Built with privacy at its core. Your health data never leaves your device. How It Works 1 Wear Your Watch Simply wear your Apple Watch (Series 6 or later) as you go about your day. 2 Track Automatically The ambient light sensor detects when you are outdoors in daylight. 3 Check Your Progress Open SunshinePal to see your daily total and progress towards your goal. Frequently Asked Questions ☀️ About SunshinePal Q: What is SunshinePal? A: SunshinePal is an iOS and Apple Watch app that helps you track your daily sunlight exposure. It uses your Apple Watch sensors to measure time spent in daylight, helping you maintain a healthy circadian rhythm. Q: Do I need an Apple Watch? A: Yes, SunshinePal relies on the Apple Watch's ambient light sensors and HealthKit integration to accurately track your time in daylight. 🎯 Features Q: How does it track sunlight? A: It uses the "Time in Daylight" data from Apple Health, which is automatically recorded by your Apple Watch (Series 6 and later) when you are outdoors. Q: Can I set daily goals? A: Yes! You can set a daily sunlight goal (e.g., 30 minutes) and track your progress towards it every day. 🔒 Privacy & Data Q: Is my health data private? A: Absolutely. SunshinePal reads data directly from HealthKit on your device. Your health data never leaves your device and is not shared with any third parties. Q: Where is data stored? A: All app data is stored locally on your iPhone and Apple Watch. We prioritize your privacy and do not use cloud servers for data storage. Legal & Privacy Privacy Policy We believe your health data belongs to you. Read how we protect your privacy. Read Privacy Policy → Terms of Use Understand the terms and conditions for using SunshinePal. Read Terms of Use → Explore More BucketPal Track your life goals and bucket list with progress visualization. 3ThingsPal The simple ADHD-friendly to-do list. Focus on just 3 tasks a day. DishPal Turn your meals into shop-ready lists with AI-powered recipe parsing. LiveMarquee Create beautiful scrolling text displays for events and signage. 📝 Our Blog App development insights and the stories behind our apps. ❓ FAQ Find answers to common questions about our apps and support.
2026-01-13T09:30:36
https://phproundtable.com/show/the-alcoholic-and-unfit-php-culture
PHPRoundtable PHPRoundtable The PHP podcast where everyone has a seat. Guests Library Sponsors About Us 28: The Alcoholic And Unfit PHP Culture Panelists: Samantha Quiñones Matt Frost Dustin Uresk Scott Arciszewski Michelle Sanver Daniel Noel-Davies Jenny Wong Jeremy Mikola August 20 2015 The PHP community has its fair-share of devs struggling with alcohol & weight loss and it doesn't help that there is a strong culture around alcohol consumption at nerd events. For some, the bottle is just a fun weekend with nerds. For others, it's a vice About Us Sponsors © 2026 PHPRoundtable Proud member of the php[architect] family
2026-01-13T09:30:36
https://bifromq.apache.org/docs/1.0.x/get_started/connect_to/
Connect to BifroMQ | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 1.0.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install BifroMQ Connect to BifroMQ Install & Deploy Configuration User Guide Plugin Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 1.0.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Get Started Connect to BifroMQ Version: 1.0.x On this page Connect to BifroMQ Simple Connection Verification using an MQTT Client ​ Using an existing third-party MQTT client tool, you can quickly verify whether you can send or receive messages by interacting with the MQTT service provided by BifroMQ. There are several free third-party MQTT client tools available such as MQTT.fx, MQTTBox, MQTTLens, MQTTX, etc. In this example, we will be using MQTTX. Visit https://mqttx.app/ to download MQTTX and install it. Open MQTTX and click on “New Connection” or the “+” sign on the left sidebar to create a new connection configuration. Fill in the required fields: Name: Name of this configuration. You can choose any name. ClientID: Client ID, which you can set manually or generate randomly using the button on the right. It must contain characters “a-z”, “0-9”, “_”, “-”, and cannot exceed 128 bytes. It should be in UTF8 encoding and must be unique. Host: Connection address. Choose the protocol prefix from mqtt://, mqtts://, or wss://, corresponding to TCP, TLS/SSL, or WSS in MQTT connection respectively. Please fill in the domain name that can actually access the BifroMQ MQTT service. Port: Connection port. Choose the appropriate port based on the protocol prefix. Default ports are TCP: 1883, TLS/SSL: 1884, WSS: 443. Username & Password: Enter the username and password you possess. MQTT Version: Select 3.1.1 After entering the connection configuration correctly, click "Connect" in the top right corner to connect to the server. If everything is fine, you will see a "Connect Successful" message and be redirected to the message send/receive interface. Subscribe to a topic: Click on the “New Subscription” button in the top left corner and enter the topic in the pop-up dialog box. Note that you must enter a topic you have subscription privileges for. In this example, we will use a test topic: $iot/device1/user/fortest. Select the default QoS 0 and click "Confirm" to subscribe. Publish a message: In the message send/receive interface, enter the topic in the bottom right corner. We will use the same test topic as before. Send a message to yourself by selecting the default QoS 0, entering the message content, and clicking the send button. After sending the message successfully, you can see the sent message on the right. If the MQTT service is working properly, since we are subscribed to that topic, we will receive the message and it will also be displayed on the left side of the conversation interface. Edit this page Previous Install BifroMQ Next Install & Deploy Simple Connection Verification using an MQTT Client Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://www.frontendinterviewhandbook.com/ja-JP/introduction#__docusaurus_skipToContent_fallback
Introduction | The Official Front End Interview Handbook 2025 メインコンテンツまでスキップ We are now part of GreatFrontEnd , a front end interview preparation platform created by ex-Meta and Google Engineers. Get 20% off today ! Front End Interview Handbook Start reading Practice Coding Questions System Design Quiz Questions System design Blog 日本語 English 简体中文 Español 日本語 한국어 Polski Português Русский Tagalog বাংলা 検索 Introduction Coding interview JavaScript coding User interface coding Algorithms coding Quiz/trivia interview System design interview Overview User interface components Applications Behavorial interviews Resume preparation Interview questions 🔥 Amazon interview questions Google interview questions Microsoft interview questions Meta interview questions Airbnb interview questions ByteDance/TikTok interview questions Atlassian interview questions Uber interview questions Apple interview questions Canva interview questions Dropbox interview questions LinkedIn interview questions Lyft interview questions Twitter interview questions Shopify interview questions Pinterest interview questions Reddit interview questions Adobe interview questions Palantir interview questions Salesforce interview questions Oracle interview questions Introduction このページの見出し Introduction Latest version on GreatFrontEnd Find the latest version of this page on GreatFrontEnd's Front End Interview Playbook . What is this? ​ Unlike typical software engineer job interviews, front end interviews have less emphasis on algorithms and have more questions on intricate knowledge and expertise about the front end domain — HTML, CSS, JavaScript, just to name a few. Many front end interviews are highly-focused on domain knowledge and applying them to real-world scenarios. You might find that grinding LeetCode is not all you need when it comes to interviewing for a front end position, but that's a good thing! Front end interviews tend to test concepts that are more practical and relevant to real world front end development. But that doesn't mean that you don't have to be familiar with basic data structures and algorithmic concepts - there's just less emphasis on them and you are probably going to get easier algorithmic questions. While there are some existing resources to help front end developers in preparing for interviews, they aren't as abundant as materials for a general software engineer interview. Among the existing resources, the most helpful question bank would probably be Front-end Developer Interview Questions . Unfortunately, there aren't many complete and satisfactory answers to these questions readily available online. This handbook answers these trivia-style questions along with information and guidance for other front end interview formats. To solve this problem, GreatFrontEnd , an interview preparation platform for Front End interviews, was created. It contains Front End interview questions and answers written by ex-FAANG Senior Engineers (such as myself!) and have both questions and answers for various formats: JavaScript, TypeScript, User Interface Component questions, quiz-style front end questions. General tips for front end interviews ​ Regardless of which type of format you are given, one thing stays true - you need to be extremely strong in your front end fundamentals and constantly display mastery of them to your interviewer. Be extremely familiar with the following concepts: CSS : Specificity, Box model, Layout, Positioning JavaScript : this keyword, Prototypes, closures, Async-style code, Promises, Timers ( setTimeout() , setInterval() ) JavaScript design patterns : Observer pattern, Module pattern HTML : Event delegation (it was useful in almost every interview), DOM traversal, DOM manipulation, Form validation and submission DOM manipulation : DOM manipulation in Vanilla JS, or jQuery at the very least. Not all interviews allow you to use React as they want to see mastery of the fundamentals Look out for interview questions by companies on Glassdoor. Front end questions are not as abundant but some still can be found. Many companies use similar questions. Front end interview formats ​ Unlike Software Engineering interviews, the formats for front end interviews are less known and not standardized across the industry. We painstakingly searched the Internet for front end interview questions asked by popular tech companies and collated the questions which appear very often. In general, you should be familiar with the following questions and formats: JavaScript coding ​ This is the front end version of LeetCode-style algorithm questions. Implement a function in JavaScript, which can be a utility function found in Lodash/Underscore (e.g. throttle ), or a polyfill for the JavaScript language/DOM APIs (e.g. Array.prototype.filter() , Promise.all() , document.getElementsByClassName() ). Implement Array.prototype functions: map , reduce , filter , sort . Implement DOM APIs: document.getElementsByClassName , document.getElementsByTagName . debounce / throttle . Implement Promise/Promise-related APIs: Promise , Promise.all , Promise.any . Read more about JavaScript coding questions → Practice JavaScript coding questions on GreatFrontEnd User interface coding ​ Build user interfaces (can be a UI component, an app, or a game) using HTML, CSS, and JavaScript. Components Autocomplete ( very popular ) Photo gallery Image carousel Tooltip component Star rating widget Apps Build tic-tac-toe Build a chess board with movable pieces Read more about user interface coding questions → Practice user interface coding questions on GreatFrontEnd Algorithmic coding ​ LeetCode-style algorithmic coding questions which evaluate your core data structures and algorithms skills. You can be asked any question on LeetCode and might be asked to complete them using JavaScript. Read more about algorithm coding questions → Practice algorithm questions on GreatFrontEnd Quiz/trivia questions ​ Short questions which test your knowledge and have clear non-subjective answers. These are usually asked within coding / system design rounds and even by recruiters because the accuracy of the answers can be somewhat verified by non-technical people. Here are some examples: JavaScript What is a closure? What is the difference between a promise and a callback? Explain the this keyword in JavaScript. CSS What is the CSS box model? Various CSS position properties and its differences. Read more about front end quiz questions → Practice front end quiz questions on GreatFrontEnd System design ​ Describe and discuss how you would build a UI component/app/game and its architecture. This is the front end version of system design questions. E.g. Describe how you would build the Emoji autocomplete feature in a chat app, what APIs it would have, what components there are to the feature, how to ensure it has good performance, UX, etc. Design an image carousel component. Design an email client application. Read more about front end system design → Practice front end system design questions on GreatFrontEnd You can also try out the above mentioned question types at GreatFrontEnd . It has over 500+ practice questions and all of them are provided with comprehensive answers written by ex-FAANG senior engineers. Company interview formats ​ Through extensive research, here are the different type of formats companies ask during the technical rounds of front end interviews. If you're interviewing for front end engineering roles at certain companies, prepare accordingly! Legend: ✅: Asked, ❌: Not asked, ⚠️: No data Company Quiz Algorithms JavaScript coding UI coding System design Airbnb ❌ ✅ ✅ ✅ ✅ Amazon ✅ ✅ ✅ ✅ ✅ Apple ✅ ⚠️ ✅ ✅ ⚠️ Atlassian ❌ ❌ ✅ ✅ ✅ ByteDance/TikTok ✅ ✅ ✅ ✅ ❌ Dropbox ❌ ⚠️ ✅ ✅ ✅ Facebook/Meta ✅ ❌ ✅ ❌ ✅ Flipkart ⚠️ ✅ ⚠️ ⚠️ ⚠️ Google ✅ ✅ ✅ ✅ ✅ LinkedIn ✅ ⚠️ ✅ ✅ ⚠️ Lyft ❌ ❌ ✅ ✅ ✅ Microsoft ✅ ✅ ✅ ✅ ✅ Salesforce ✅ ⚠️ ⚠️ ⚠️ ⚠️ Twitter ✅ ⚠️ ✅ ✅ ⚠️ Uber ⚠️ ⚠️ ✅ ✅ ⚠️ このページを編集 2025年11月30日 に Danielle Ford が 最終更新 次へ JavaScript coding Table of Contents What is this? General tips for front end interviews Front end interview formats JavaScript coding User interface coding Algorithmic coding Quiz/trivia questions System design Company interview formats General Get started Trivia questions Company questions Blog Coding Algorithms JavaScript utility functions User interfaces System design System design overview User interface components Applications More GreatFrontEnd GitHub X Discord Contact us Tech Interview Handbook Copyright © 2025 Yangshun Tay and GreatFrontEnd
2026-01-13T09:30:36
https://vml.visma.ai/#testimonials
Visma Machine Learning - Automate your processes About us Who are we? Learn more about Visma Machine Learning What we do Learn more about the products we offer What our customers say Read our customers' testimonials Products Autosuggest Automate your workflow Smartscan Extract data from your documents Resources Blog Product news and showcases Showcase of prototypes Prototypes, ideas and experiments Support Get started Find out more about onboarding to Visma Machine Learning FAQ We have answers to your frequently asked questions. Privacy policy Learn how we handle your data and protect your privacy Cookie policy Learn about how we use cookies to enhance your experience API Documentation Contact Us About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Showcase of prototypes Support Get started FAQ Privacy policy Cookie policy API Documentation Loading... Gærtorvet 1-5 1799 Copenhagen Denmark E-mail: worksmarter@visma.com About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Prototypes Documentation Support Get started FAQ Privacy policy Cookie policy Security Information Operating Status © 2026 Visma Group. All rights reserved Transforming the way people work Visma Machine Learning dramatically reduces the time spent on routine tasks, and lets our customers focus on the important things. Our products save people many hours of data entry into accounting systems which directly translates into cost savings for companies and helps them to become paperless. Contact us Try out Smartscan Let our numbers speak for us 0 + thousand companies use our ML 0 + million documents scanned per month 0 + million API requests per day 30+ SaaS products powered by our machine learning APIs We simplify and automate accounting workflows Data entry is one of the big time sinks in business processes. With Smartscan we're eliminating most of this work for document handling. With AutoSuggest we're dramatically simplifying the decisions you need to make in the accounting workflow. Leading machine learning solutions Industry leading OCR and Data Capture API for scanning and extracting information from invoices and receipts. Learn more The process toolkit for your workflows and tasks. Simple-to-use prediction engine for scanned invoices and bank transactions. Learn more Minimise the time spent processing documents and doing manual work Easy setup We make machine learning as simple as possible - available through simple JSON APIs. Best in class AI We use state of the art techniques to offer the best coverage on the market. Blazingly fast Our speed is a point of pride. Document scans complete in 1-2 seconds. Faster than most document AI APIs. See what our customers have to say Great Service For any new Dinero customers the machine learning predictions will work right away, and it will be magical. Our customers love it! Alexander Jasper Lead AI Engineer, Dinero Intuitive Implementation The implementation was a breeze thanks to your documentation. Marco Hokke Software Developer, Visma Raet Efficient Performance If we want to increase our customers automation level, that is where ML Assets become extremely important. Oliver Storm-Pallesen Product Line Manager, e-conomic Questions? Are you using a Visma product but you are missing Autosuggest or Smartscan capabilities? Talk to your sales contact, if you have one, and ask for Autosuggest or Smartscan. Email us at worksmarter@visma.com to let us know which product you have and we'll get things rolling. Contact us
2026-01-13T09:30:36
https://bifromq.apache.org/docs/1.0.x/intro/features_list/
Features List | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 1.0.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Features List Get Started Install & Deploy Configuration User Guide Plugin Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 1.0.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Introduction Features List Version: 1.0.x Features List Full support for MQTT 3.1, 3.1.1 (MQTT5 support coming soon) features over TCP, TLS, WS, WSS Native support for multi-tenancy resource sharing and workload isolation Built-in storage engine. Optimized for critical load targeting, no third-party middleware dependencies Extension mechanism for supporting: Authentication/Authorization Runtime Setting Bridging Event System/Tenant-level Monitoring Edit this page Previous Introduction Next Get Started Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://www.facebook.com/login/?next=https%3A%2F%2Fl.facebook.com%2Fl.php%3Fu%3Dhttps%253A%252F%252Fwww.instagram.com%252F%26amp%253Bh%3DAT34pS_RQFlBmcaNQOulqRe7J4_PCItZ84NLZDJDu21S7FGu2-_v8zr7eB-3ObSEUmwdaSx5xmwpYqeU-vT-ppR-POIGEA8RUUr4nxMvRIAurCBa9myixBL6EqY19V8uZHMj4kLzKW-6zc4b
Facebook Facebook 이메일 또는 휴대폰 비밀번호 계정을 잊으셨나요? 새 계정 만들기 일시적으로 차단됨 일시적으로 차단됨 회원님의 이 기능 사용 속도가 너무 빠른 것 같습니다. 이 기능 사용에서 일시적으로 차단되었습니다. Back 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) 日本語 Português (Brasil) Français (France) Deutsch 가입하기 로그인 Messenger Facebook Lite 동영상 Meta Pay Meta 스토어 Meta Quest Ray-Ban Meta Meta AI Meta AI 콘텐츠 더 보기 Instagram Threads 투표 정보 센터 개인정보처리방침 개인정보 보호 센터 정보 광고 만들기 페이지 만들기 개발자 채용 정보 쿠키 AdChoices 이용 약관 고객 센터 연락처 업로드 및 비사용자 설정 활동 로그 Meta © 2026
2026-01-13T09:30:36
https://aws.amazon.com/es/products/networking/
Redes y entrega de contenido en AWS: Amazon Web Services Saltar al contenido principal Filter: Todo English Contáctenos AWS Marketplace Soporte Mi cuenta Búsqueda Filter: Todo Iniciar sesión en la consola Crear cuenta Redes y entrega de contenido Información general Áreas de soluciones Socios Productos › Redes y entrega de contenido de AWS Redes y entrega de contenido de AWS Ejecute todas las cargas de trabajo en una red global segura y de confianza Información general Obtenga el conjunto de servicios de redes y entrega de contenido más amplio y completo del mundo con AWS. Ejecute aplicaciones con el nivel más alto de fiabilidad, seguridad y rendimiento en la nube. Reproducir Beneficios Más seguro Cumpla los requisitos de seguridad más exigentes del mundo con las capacidades de redes de AWS. Asegure la confidencialidad, la integridad y la disponibilidad de los datos mediante el permanente monitoreo de la infraestructura. Máxima disponibilidad de red Mantenga los niveles de disponibilidad más altos para las cargas de trabajo esenciales con el uso del modelo región de AWS/zona de disponibilidad (AZ). Los analistas del sector reconocieron el modelo de zona de disponibilidad como la estrategia recomendada para ejecutar aplicaciones para empresas que requieran una alta disponibilidad. Alto rendimiento consistente Ejecute las cargas de trabajo con la red en la nube con el rendimiento más alto y la latencia más baja. Utilice la red de AWS para proporcionar a sus clientes aplicaciones más rápidas y con mejor capacidad de respuesta. La más amplia cobertura mundial Entregue aplicaciones y contenido en todo el mundo mediante una red personalizada. AWS ofrece la presencia de infraestructura global más grande entre todos los proveedores. Maximice la eficiencia y reduzca los costos gracias a la migración a AWS La firma analista Enterprise Strategy Group confirmó que las organizaciones redujeron los costos de redes, computación y almacenamiento hasta en un 66 % al migrar a AWS. Leer el informe Servicios de redes y entrega de contenido de AWS Fundamentos de red Personalice y controle el entorno de redes con la nube virtual privada (VPC) de Amazon Más información AWS Transit Gateway Simplifique su red con VPC y redes local que estén conectadas a una única puerta de enlace Más información AWS PrivateLink Establezca conectividad privada entre las VPC y AWS o los servicios en las instalaciones Más información Redes de aplicaciones Amazon VPC Lattice Simplifique la conectividad, la seguridad y la supervisión entre servicios Más información AWS AppMesh Conecte contenedores y microservicios con redes de nivel de aplicación Más información AWS API Gateway Cree, conserve y proteja las API a cualquier escala Más información AWS Cloud Map Descubra y acceda a los recursos de servicios más actualizados Más información Elastic Load Balancing Distribuya el tráfico de red para mejorar la escalabilidad de las aplicaciones Más información Redes periféricas Amazon CloudFront Entregue datos, videos, aplicaciones y API a altas velocidades de transferencia con baja latencia Más información Amazon Route 53 Impulse a los usuarios finales a que utilicen aplicaciones de Internet con un sistema de nombres de dominio (DNS) administrado y de bajo costo Más información AWS Global Accelerator Optimice el tráfico de usuario para la aplicación Más información Conectividad AWS Direct Connect Establezca una conexión privada y dedicada de AWS en su centro de datos, oficina o entorno de coubicación Más información AWS Site-to-Site VPN Cree una conexión de red cifrada en las nubes de Amazon VPC o las AWS Transit Gateway Más información AWS Client VPN Conecte el personal remoto a AWS o a recursos locales con una red privada virtual (VPN) Más información WAN en la nube de AWS Cree, administre y supervise fácilmente redes globales de área amplia Más información AWS Interconnect: múltiples nubes (versión preliminar) Conexiones privadas sencillas, resistentes y de alta velocidad con otros proveedores de servicios en la nube. Más información AWS Interconnect: última milla (versión preliminar cerrada) Conecte las ubicaciones remotas a AWS con solo unos clics Más información Seguridad de la red AWS Shield Proteja las aplicaciones de AWS de ataques de denegación de servicio distribuida (DDoS) Más información AWS WAF Proteja sus aplicaciones web de ataques web comunes Más información AWS Network Firewall Implemente seguridad de red en las nubes de Amazon VPC Más información AWS Firewall Manager Configure y administre reglas de firewall de forma centralizada Más información Áreas de soluciones Cree fundamentos de red sólidos Mantenga las pestañas en su complejo tráfico de red con los fundamentos de red de AWS. Simplifique el lanzamiento de recursos, la administración de red, la conectividad y el monitoreo de tráfico con servicios tales como Amazon VPC, AWS Transit Gateway, AWS PrivateLink, los registros de flujo de Amazon VPC y la replicación de tráfico de VPC. Más información Conecte una infraestructura híbrida Conecte los servicios que se ejecutan en AWS y en las instalaciones con una comunicación de red segura y eficaz. Las soluciones de conectividad híbrida de AWS proporcionan una selección de servicios y tipos de conexión para crear redes híbridas que funcionan de forma fluida desde la nube hasta los recursos locales y hasta las redes de periferia. Más información Entregue aplicaciones más rápidas y seguras con redes periféricas Entregue datos y aplicaciones de usuario con mayor seguridad y baja latencia con el uso de redes periféricas. Pase el tráfico de Internet a la red en la nube de mejor rendimiento y mayor seguridad del mundo. Amazon CloudFront, AWS Global Accelerator y Amazon Route 53 entregan los datos de manera segura con baja latencia y alto rendimiento. Más información Optimice las redes de aplicaciones Simplifique y mejore la arquitectura de red de la aplicación con las redes de aplicaciones de AWS. Elastic Load Balancing (ELB), AWS Global Accelerator (AGA) y AWS App Mesh se combinan para proporcionar capacidades de monitoreo optimizado, rendimiento, disponibilidad y seguridad mejorada. Más información Soluciones destacadas en AWS Descubra los servicios diseñados específicamente, las soluciones de AWS, las soluciones para socios y las directrices para abordar rápidamente sus casos de uso técnicos y empresariales. Orquestación de redes para AWS Transit Gateway Automatice el proceso de configuración y administración de redes de tránsito en entornos de AWS distribuidos. Visualice y supervise su red global desde un único panel en la Consola de AWS para poder controlar, auditar y aprobar los cambios en la red (de tránsito). Introducción Automatización del firewall para el tráfico de red en AWS Implemente una solución para automatizar el proceso de aprovisionar un AWS Network Firewall centralizado a fin de inspeccionar el tráfico entre las VPC de Amazon. Introducción AWS Summit Hamburgo 2025: Viva hoy la nube del mañana Únase a pioneros del sector y expertos en la nube durante una jornada de aprendizaje práctico y oportunidades de networking que transformarán el traspaso a la nube de su empresa. Regístrese ahora Cree una cuenta de AWS Aprender ¿Qué es AWS? ¿Qué es la computación en la nube? ¿Qué es la IA agéntica? Centro de conceptos de computación en la nube Seguridad en la nube de AWS Novedades Blogs Notas de prensa Recursos Introducción Formación Centro de confianza de AWS Biblioteca de soluciones de AWS Centro de arquitectura Preguntas frecuentes sobre cuestiones técnicas y productos Informes de analistas Socios de AWS Desarrolladores Centro de creadores SDK y herramientas .NET en AWS Python en AWS Java en AWS PHP en AWS JavaScript en AWS Ayuda Contacto Abra un ticket de soporte técnico AWS re:Post Centro de conocimientos Información general de AWS Support Reciba ayuda de expertos Accesibilidad de AWS Asuntos jurídicos English Volver arriba Amazon es un empleador que ofrece igualdad de oportunidades: minorías, mujeres, discapacitados, veteranos, identidad de género, orientación sexual y edad. x facebook linkedin instagram twitch youtube podcasts email Privacidad Términos del sitio Preferencias de cookies © 2026, Amazon Web Services, Inc. o sus empresas afiliadas. Todos los derechos reservados.
2026-01-13T09:30:36
https://www.hcaptcha.com/start-a-pilot.html
Start a Pilot Pricing Pro Enterprise MFA User Journeys Docs Blog Sign Up Log In From the blog: Browser Agent Safety is an Afterthought for Vendors → Switch to English Accessibility Pricing Pro Enterprise MFA User Journeys Docs Blog Contact Sales Sign Up Log In hCaptcha.com Bot detection and anti-abuse services. Used by millions of websites and apps. Learn more. Try us out in your environment with no obligation. The best way to show you what we can do is to demonstrate results. Virtually all companies that start a pilot ultimately choose us. Use this form to reach one of our technical specialists. We respond quickly. You can also email us directly. Region * North America (NA) South America, Mexico (LATAM) Europe, Middle East, Africa (EMEA) Asia-Pacific (APAC) Your Name* Company * Business Email * Any other details we should have? * Do you require urgent onboarding? Yes.   I am under attack and require immediate onboarding. Thank you! Your submission has been received! Oops! Something went wrong while submitting the form. By entering your email, you agree to our Terms and Privacy Policy, and to receive email from us. What do companies switching to hCaptcha say? ” You guys are doing >10x better than [leading competitor] this time last year for [fake registration] bots. Compared to last year [when using competitor] we had a 96% reduction in bot throughput. We're seeing extremely low levels of abuse across all of our properties in conjunction with a relatively low level of friction across the board. — Security lead, Top 10 Game Company Now using hCaptcha Enterprise on login, signup, and more Trusted By ..and thousands of other organizations Integration couldn't be easier hCaptcha has dozens of pre-built integrations for the frontend and backend systems you use. If you happen to be coming from Google's reCAPTCHA, our APIs are drop-in replacements. Two lines of code are all you need. Our onboarding engineers can get you going quickly, whether you need React integration, SDKs for iOS native apps, a Java backend example, or virtually any other scenario. And as always, privacy is a core value for us. Add our challenge code only where it is necessary, and where it makes sense to protect both you and your users. Minimizing data collection starts from the moment of integration. Get started with hCaptcha Enterprise Contact Sales Company About Jobs Trademarks AI Ethics Press Compliance Resources Status Documentation Report a Bug Accessibility Cyberattacks 101 GDPR Contact Support Contact Support Sales Contact Sales Terms Privacy DMCA Attribution hCaptcha is a registered trademark of Intuition Machines, Inc. ©2025 Intuition Machines, Inc.
2026-01-13T09:30:36
https://ja-jp.facebook.com/login/?next=https%3A%2F%2Fl.facebook.com%2Fl.php%3Fu%3Dhttps%253A%252F%252Fwww.instagram.com%252F%26amp%253Bh%3DAT34pS_RQFlBmcaNQOulqRe7J4_PCItZ84NLZDJDu21S7FGu2-_v8zr7eB-3ObSEUmwdaSx5xmwpYqeU-vT-ppR-POIGEA8RUUr4nxMvRIAurCBa9myixBL6EqY19V8uZHMj4kLzKW-6zc4b
Facebook Facebook メールアドレスまたは電話番号 パスワード アカウントを忘れた場合 新しいアカウントを作成 機能の一時停止 機能の一時停止 この機能の使用ペースが早過ぎるため、機能の使用が一時的にブロックされました。 Back 日本語 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) Português (Brasil) Français (France) Deutsch アカウント登録 ログイン Messenger Facebook Lite 動画 Meta Pay Metaストア Meta Quest Ray-Ban Meta Meta AI Meta AIのコンテンツをもっと見る Instagram Threads 投票情報センター プライバシーポリシー プライバシーセンター Facebookについて 広告を作成 ページを作成 開発者 採用情報 Cookie AdChoices 規約 ヘルプ 連絡先のアップロードと非ユーザー 設定 アクティビティログ Meta © 2026
2026-01-13T09:30:36
http://anh.cs.luc.edu/handsonPythonTutorial/ifstatements.html#sign-exercise
3.1. If Statements — Hands-on Python Tutorial for Python 3 Navigation index next | previous | Hands-on Python Tutorial » 3. More On Flow of Control » 3.1. If Statements ¶ 3.1.1. Simple Conditions ¶ The statements introduced in this chapter will involve tests or conditions . More syntax for conditions will be introduced later, but for now consider simple arithmetic comparisons that directly translate from math into Python. Try each line separately in the Shell 2 < 5 3 > 7 x = 11 x > 10 2 * x < x type ( True ) You see that conditions are either True or False . These are the only possible Boolean values (named after 19th century mathematician George Boole). In Python the name Boolean is shortened to the type bool . It is the type of the results of true-false conditions or tests. Note The Boolean values True and False have no quotes around them! Just as '123' is a string and 123 without the quotes is not, 'True' is a string, not of type bool. 3.1.2. Simple if Statements ¶ Run this example program, suitcase.py. Try it at least twice, with inputs: 30 and then 55. As you an see, you get an extra result, depending on the input. The main code is: weight = float ( input ( "How many pounds does your suitcase weigh? " )) if weight > 50 : print ( "There is a $25 charge for luggage that heavy." ) print ( "Thank you for your business." ) The middle two line are an if statement. It reads pretty much like English. If it is true that the weight is greater than 50, then print the statement about an extra charge. If it is not true that the weight is greater than 50, then don’t do the indented part: skip printing the extra luggage charge. In any event, when you have finished with the if statement (whether it actually does anything or not), go on to the next statement that is not indented under the if . In this case that is the statement printing “Thank you”. The general Python syntax for a simple if statement is if condition : indentedStatementBlock If the condition is true, then do the indented statements. If the condition is not true, then skip the indented statements. Another fragment as an example: if balance < 0 : transfer = - balance # transfer enough from the backup account: backupAccount = backupAccount - transfer balance = balance + transfer As with other kinds of statements with a heading and an indented block, the block can have more than one statement. The assumption in the example above is that if an account goes negative, it is brought back to 0 by transferring money from a backup account in several steps. In the examples above the choice is between doing something (if the condition is True ) or nothing (if the condition is False ). Often there is a choice of two possibilities, only one of which will be done, depending on the truth of a condition. 3.1.3. if - else Statements ¶ Run the example program, clothes.py . Try it at least twice, with inputs 50 and then 80. As you can see, you get different results, depending on the input. The main code of clothes.py is: temperature = float ( input ( 'What is the temperature? ' )) if temperature > 70 : print ( 'Wear shorts.' ) else : print ( 'Wear long pants.' ) print ( 'Get some exercise outside.' ) The middle four lines are an if-else statement. Again it is close to English, though you might say “otherwise” instead of “else” (but else is shorter!). There are two indented blocks: One, like in the simple if statement, comes right after the if heading and is executed when the condition in the if heading is true. In the if - else form this is followed by an else: line, followed by another indented block that is only executed when the original condition is false . In an if - else statement exactly one of two possible indented blocks is executed. A line is also shown de dented next, removing indentation, about getting exercise. Since it is dedented, it is not a part of the if-else statement: Since its amount of indentation matches the if heading, it is always executed in the normal forward flow of statements, after the if - else statement (whichever block is selected). The general Python if - else syntax is if condition : indentedStatementBlockForTrueCondition else: indentedStatementBlockForFalseCondition These statement blocks can have any number of statements, and can include about any kind of statement. See Graduate Exercise 3.1.4. More Conditional Expressions ¶ All the usual arithmetic comparisons may be made, but many do not use standard mathematical symbolism, mostly for lack of proper keys on a standard keyboard. Meaning Math Symbol Python Symbols Less than < < Greater than > > Less than or equal ≤ <= Greater than or equal ≥ >= Equals = == Not equal ≠ != There should not be space between the two-symbol Python substitutes. Notice that the obvious choice for equals , a single equal sign, is not used to check for equality. An annoying second equal sign is required. This is because the single equal sign is already used for assignment in Python, so it is not available for tests. Warning It is a common error to use only one equal sign when you mean to test for equality, and not make an assignment! Tests for equality do not make an assignment, and they do not require a variable on the left. Any expressions can be tested for equality or inequality ( != ). They do not need to be numbers! Predict the results and try each line in the Shell : x = 5 x x == 5 x == 6 x x != 6 x = 6 6 == x 6 != x 'hi' == 'h' + 'i' 'HI' != 'hi' [ 1 , 2 ] != [ 2 , 1 ] An equality check does not make an assignment. Strings are case sensitive. Order matters in a list. Try in the Shell : 'a' > 5 When the comparison does not make sense, an Exception is caused. [1] Following up on the discussion of the inexactness of float arithmetic in String Formats for Float Precision , confirm that Python does not consider .1 + .2 to be equal to .3: Write a simple condition into the Shell to test. Here is another example: Pay with Overtime. Given a person’s work hours for the week and regular hourly wage, calculate the total pay for the week, taking into account overtime. Hours worked over 40 are overtime, paid at 1.5 times the normal rate. This is a natural place for a function enclosing the calculation. Read the setup for the function: def calcWeeklyWages ( totalHours , hourlyWage ): '''Return the total weekly wages for a worker working totalHours, with a given regular hourlyWage. Include overtime for hours over 40. ''' The problem clearly indicates two cases: when no more than 40 hours are worked or when more than 40 hours are worked. In case more than 40 hours are worked, it is convenient to introduce a variable overtimeHours. You are encouraged to think about a solution before going on and examining mine. You can try running my complete example program, wages.py, also shown below. The format operation at the end of the main function uses the floating point format ( String Formats for Float Precision ) to show two decimal places for the cents in the answer: def calcWeeklyWages ( totalHours , hourlyWage ): '''Return the total weekly wages for a worker working totalHours, with a given regular hourlyWage. Include overtime for hours over 40. ''' if totalHours <= 40 : totalWages = hourlyWage * totalHours else : overtime = totalHours - 40 totalWages = hourlyWage * 40 + ( 1.5 * hourlyWage ) * overtime return totalWages def main (): hours = float ( input ( 'Enter hours worked: ' )) wage = float ( input ( 'Enter dollars paid per hour: ' )) total = calcWeeklyWages ( hours , wage ) print ( 'Wages for {hours} hours at ${wage:.2f} per hour are ${total:.2f}.' . format ( ** locals ())) main () Here the input was intended to be numeric, but it could be decimal so the conversion from string was via float , not int . Below is an equivalent alternative version of the body of calcWeeklyWages , used in wages1.py . It uses just one general calculation formula and sets the parameters for the formula in the if statement. There are generally a number of ways you might solve the same problem! if totalHours <= 40 : regularHours = totalHours overtime = 0 else : overtime = totalHours - 40 regularHours = 40 return hourlyWage * regularHours + ( 1.5 * hourlyWage ) * overtime The in boolean operator : There are also Boolean operators that are applied to types others than numbers. A useful Boolean operator is in , checking membership in a sequence: >>> vals = [ 'this' , 'is' , 'it] >>> 'is' in vals True >>> 'was' in vals False It can also be used with not , as not in , to mean the opposite: >>> vals = [ 'this' , 'is' , 'it] >>> 'is' not in vals False >>> 'was' not in vals True In general the two versions are: item in sequence item not in sequence Detecting the need for if statements : Like with planning programs needing``for`` statements, you want to be able to translate English descriptions of problems that would naturally include if or if - else statements. What are some words or phrases or ideas that suggest the use of these statements? Think of your own and then compare to a few I gave: [2] 3.1.4.1. Graduate Exercise ¶ Write a program, graduate.py , that prompts students for how many credits they have. Print whether of not they have enough credits for graduation. (At Loyola University Chicago 120 credits are needed for graduation.) 3.1.4.2. Head or Tails Exercise ¶ Write a program headstails.py . It should include a function flip() , that simulates a single flip of a coin: It randomly prints either Heads or Tails . Accomplish this by choosing 0 or 1 arbitrarily with random.randrange(2) , and use an if - else statement to print Heads when the result is 0, and Tails otherwise. In your main program have a simple repeat loop that calls flip() 10 times to test it, so you generate a random sequence of 10 Heads and Tails . 3.1.4.3. Strange Function Exercise ¶ Save the example program jumpFuncStub.py as jumpFunc.py , and complete the definitions of functions jump and main as described in the function documentation strings in the program. In the jump function definition use an if - else statement (hint [3] ). In the main function definition use a for -each loop, the range function, and the jump function. The jump function is introduced for use in Strange Sequence Exercise , and others after that. 3.1.5. Multiple Tests and if - elif Statements ¶ Often you want to distinguish between more than two distinct cases, but conditions only have two possible results, True or False , so the only direct choice is between two options. As anyone who has played “20 Questions” knows, you can distinguish more cases by further questions. If there are more than two choices, a single test may only reduce the possibilities, but further tests can reduce the possibilities further and further. Since most any kind of statement can be placed in an indented statement block, one choice is a further if statement. For instance consider a function to convert a numerical grade to a letter grade, ‘A’, ‘B’, ‘C’, ‘D’ or ‘F’, where the cutoffs for ‘A’, ‘B’, ‘C’, and ‘D’ are 90, 80, 70, and 60 respectively. One way to write the function would be test for one grade at a time, and resolve all the remaining possibilities inside the next else clause: def letterGrade ( score ): if score >= 90 : letter = 'A' else : # grade must be B, C, D or F if score >= 80 : letter = 'B' else : # grade must be C, D or F if score >= 70 : letter = 'C' else : # grade must D or F if score >= 60 : letter = 'D' else : letter = 'F' return letter This repeatedly increasing indentation with an if statement as the else block can be annoying and distracting. A preferred alternative in this situation, that avoids all this indentation, is to combine each else and if block into an elif block: def letterGrade ( score ): if score >= 90 : letter = 'A' elif score >= 80 : letter = 'B' elif score >= 70 : letter = 'C' elif score >= 60 : letter = 'D' else : letter = 'F' return letter The most elaborate syntax for an if - elif - else statement is indicated in general below: if condition1 : indentedStatementBlockForTrueCondition1 elif condition2 : indentedStatementBlockForFirstTrueCondition2 elif condition3 : indentedStatementBlockForFirstTrueCondition3 elif condition4 : indentedStatementBlockForFirstTrueCondition4 else: indentedStatementBlockForEachConditionFalse The if , each elif , and the final else lines are all aligned. There can be any number of elif lines, each followed by an indented block. (Three happen to be illustrated above.) With this construction exactly one of the indented blocks is executed. It is the one corresponding to the first True condition, or, if all conditions are False , it is the block after the final else line. Be careful of the strange Python contraction. It is elif , not elseif . A program testing the letterGrade function is in example program grade1.py . See Grade Exercise . A final alternative for if statements: if - elif -.... with no else . This would mean changing the syntax for if - elif - else above so the final else: and the block after it would be omitted. It is similar to the basic if statement without an else , in that it is possible for no indented block to be executed. This happens if none of the conditions in the tests are true. With an else included, exactly one of the indented blocks is executed. Without an else , at most one of the indented blocks is executed. if weight > 120 : print ( 'Sorry, we can not take a suitcase that heavy.' ) elif weight > 50 : print ( 'There is a $25 charge for luggage that heavy.' ) This if - elif statement only prints a line if there is a problem with the weight of the suitcase. 3.1.5.1. Sign Exercise ¶ Write a program sign.py to ask the user for a number. Print out which category the number is in: 'positive' , 'negative' , or 'zero' . 3.1.5.2. Grade Exercise ¶ In Idle, load grade1.py and save it as grade2.py Modify grade2.py so it has an equivalent version of the letterGrade function that tests in the opposite order, first for F, then D, C, .... Hint: How many tests do you need to do? [4] Be sure to run your new version and test with different inputs that test all the different paths through the program. Be careful to test around cut-off points. What does a grade of 79.6 imply? What about exactly 80? 3.1.5.3. Wages Exercise ¶ * Modify the wages.py or the wages1.py example to create a program wages2.py that assumes people are paid double time for hours over 60. Hence they get paid for at most 20 hours overtime at 1.5 times the normal rate. For example, a person working 65 hours with a regular wage of $10 per hour would work at $10 per hour for 40 hours, at 1.5 * $10 for 20 hours of overtime, and 2 * $10 for 5 hours of double time, for a total of 10*40 + 1.5*10*20 + 2*10*5 = $800. You may find wages1.py easier to adapt than wages.py . Be sure to test all paths through the program! Your program is likely to be a modification of a program where some choices worked before, but once you change things, retest for all the cases! Changes can mess up things that worked before. 3.1.6. Nesting Control-Flow Statements ¶ The power of a language like Python comes largely from the variety of ways basic statements can be combined . In particular, for and if statements can be nested inside each other’s indented blocks. For example, suppose you want to print only the positive numbers from an arbitrary list of numbers in a function with the following heading. Read the pieces for now. def printAllPositive ( numberList ): '''Print only the positive numbers in numberList.''' For example, suppose numberList is [3, -5, 2, -1, 0, 7] . You want to process a list, so that suggests a for -each loop, for num in numberList : but a for -each loop runs the same code body for each element of the list, and we only want print ( num ) for some of them. That seems like a major obstacle, but think closer at what needs to happen concretely. As a human, who has eyes of amazing capacity, you are drawn immediately to the actual correct numbers, 3, 2, and 7, but clearly a computer doing this systematically will have to check every number. In fact, there is a consistent action required: Every number must be tested to see if it should be printed. This suggests an if statement, with the condition num > 0 . Try loading into Idle and running the example program onlyPositive.py , whose code is shown below. It ends with a line testing the function: def printAllPositive ( numberList ): '''Print only the positive numbers in numberList.''' for num in numberList : if num > 0 : print ( num ) printAllPositive ([ 3 , - 5 , 2 , - 1 , 0 , 7 ]) This idea of nesting if statements enormously expands the possibilities with loops. Now different things can be done at different times in loops, as long as there is a consistent test to allow a choice between the alternatives. Shortly, while loops will also be introduced, and you will see if statements nested inside of them, too. The rest of this section deals with graphical examples. Run example program bounce1.py . It has a red ball moving and bouncing obliquely off the edges. If you watch several times, you should see that it starts from random locations. Also you can repeat the program from the Shell prompt after you have run the script. For instance, right after running the program, try in the Shell bounceBall ( - 3 , 1 ) The parameters give the amount the shape moves in each animation step. You can try other values in the Shell , preferably with magnitudes less than 10. For the remainder of the description of this example, read the extracted text pieces. The animations before this were totally scripted, saying exactly how many moves in which direction, but in this case the direction of motion changes with every bounce. The program has a graphic object shape and the central animation step is shape . move ( dx , dy ) but in this case, dx and dy have to change when the ball gets to a boundary. For instance, imagine the ball getting to the left side as it is moving to the left and up. The bounce obviously alters the horizontal part of the motion, in fact reversing it, but the ball would still continue up. The reversal of the horizontal part of the motion means that the horizontal shift changes direction and therefore its sign: dx = - dx but dy does not need to change. This switch does not happen at each animation step, but only when the ball reaches the edge of the window. It happens only some of the time - suggesting an if statement. Still the condition must be determined. Suppose the center of the ball has coordinates (x, y). When x reaches some particular x coordinate, call it xLow, the ball should bounce. The edge of the window is at coordinate 0, but xLow should not be 0, or the ball would be half way off the screen before bouncing! For the edge of the ball to hit the edge of the screen, the x coordinate of the center must be the length of the radius away, so actually xLow is the radius of the ball. Animation goes quickly in small steps, so I cheat. I allow the ball to take one (small, quick) step past where it really should go ( xLow ), and then we reverse it so it comes back to where it belongs. In particular if x < xLow : dx = - dx There are similar bounding variables xHigh , yLow and yHigh , all the radius away from the actual edge coordinates, and similar conditions to test for a bounce off each possible edge. Note that whichever edge is hit, one coordinate, either dx or dy, reverses. One way the collection of tests could be written is if x < xLow : dx = - dx if x > xHigh : dx = - dx if y < yLow : dy = - dy if y > yHigh : dy = - dy This approach would cause there to be some extra testing: If it is true that x < xLow , then it is impossible for it to be true that x > xHigh , so we do not need both tests together. We avoid unnecessary tests with an elif clause (for both x and y): if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy Note that the middle if is not changed to an elif , because it is possible for the ball to reach a corner , and need both dx and dy reversed. The program also uses several methods to read part of the state of graphics objects that we have not used in examples yet. Various graphics objects, like the circle we are using as the shape, know their center point, and it can be accessed with the getCenter() method. (Actually a clone of the point is returned.) Also each coordinate of a Point can be accessed with the getX() and getY() methods. This explains the new features in the central function defined for bouncing around in a box, bounceInBox . The animation arbitrarily goes on in a simple repeat loop for 600 steps. (A later example will improve this behavior.) def bounceInBox ( shape , dx , dy , xLow , xHigh , yLow , yHigh ): ''' Animate a shape moving in jumps (dx, dy), bouncing when its center reaches the low and high x and y coordinates. ''' delay = . 005 for i in range ( 600 ): shape . move ( dx , dy ) center = shape . getCenter () x = center . getX () y = center . getY () if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy time . sleep ( delay ) The program starts the ball from an arbitrary point inside the allowable rectangular bounds. This is encapsulated in a utility function included in the program, getRandomPoint . The getRandomPoint function uses the randrange function from the module random . Note that in parameters for both the functions range and randrange , the end stated is past the last value actually desired: def getRandomPoint ( xLow , xHigh , yLow , yHigh ): '''Return a random Point with coordinates in the range specified.''' x = random . randrange ( xLow , xHigh + 1 ) y = random . randrange ( yLow , yHigh + 1 ) return Point ( x , y ) The full program is listed below, repeating bounceInBox and getRandomPoint for completeness. Several parts that may be useful later, or are easiest to follow as a unit, are separated out as functions. Make sure you see how it all hangs together or ask questions! ''' Show a ball bouncing off the sides of the window. ''' from graphics import * import time , random def bounceInBox ( shape , dx , dy , xLow , xHigh , yLow , yHigh ): ''' Animate a shape moving in jumps (dx, dy), bouncing when its center reaches the low and high x and y coordinates. ''' delay = . 005 for i in range ( 600 ): shape . move ( dx , dy ) center = shape . getCenter () x = center . getX () y = center . getY () if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy time . sleep ( delay ) def getRandomPoint ( xLow , xHigh , yLow , yHigh ): '''Return a random Point with coordinates in the range specified.''' x = random . randrange ( xLow , xHigh + 1 ) y = random . randrange ( yLow , yHigh + 1 ) return Point ( x , y ) def makeDisk ( center , radius , win ): '''return a red disk that is drawn in win with given center and radius.''' disk = Circle ( center , radius ) disk . setOutline ( "red" ) disk . setFill ( "red" ) disk . draw ( win ) return disk def bounceBall ( dx , dy ): '''Make a ball bounce around the screen, initially moving by (dx, dy) at each jump.''' win = GraphWin ( 'Ball Bounce' , 290 , 290 ) win . yUp () radius = 10 xLow = radius # center is separated from the wall by the radius at a bounce xHigh = win . getWidth () - radius yLow = radius yHigh = win . getHeight () - radius center = getRandomPoint ( xLow , xHigh , yLow , yHigh ) ball = makeDisk ( center , radius , win ) bounceInBox ( ball , dx , dy , xLow , xHigh , yLow , yHigh ) win . close () bounceBall ( 3 , 5 ) 3.1.6.1. Short String Exercise ¶ Write a program short.py with a function printShort with heading: def printShort ( strings ): '''Given a list of strings, print the ones with at most three characters. >>> printShort(['a', 'long', one']) a one ''' In your main program, test the function, calling it several times with different lists of strings. Hint: Find the length of each string with the len function. The function documentation here models a common approach: illustrating the behavior of the function with a Python Shell interaction. This part begins with a line starting with >>> . Other exercises and examples will also document behavior in the Shell. 3.1.6.2. Even Print Exercise ¶ Write a program even1.py with a function printEven with heading: def printEven ( nums ): '''Given a list of integers nums, print the even ones. >>> printEven([4, 1, 3, 2, 7]) 4 2 ''' In your main program, test the function, calling it several times with different lists of integers. Hint: A number is even if its remainder, when dividing by 2, is 0. 3.1.6.3. Even List Exercise ¶ Write a program even2.py with a function chooseEven with heading: def chooseEven ( nums ): '''Given a list of integers, nums, return a list containing only the even ones. >>> chooseEven([4, 1, 3, 2, 7]) [4, 2] ''' In your main program, test the function, calling it several times with different lists of integers and printing the results in the main program. (The documentation string illustrates the function call in the Python shell, where the return value is automatically printed. Remember, that in a program, you only print what you explicitly say to print.) Hint: In the function, create a new list, and append the appropriate numbers to it, before returning the result. 3.1.6.4. Unique List Exercise ¶ * The madlib2.py program has its getKeys function, which first generates a list of each occurrence of a cue in the story format. This gives the cues in order, but likely includes repetitions. The original version of getKeys uses a quick method to remove duplicates, forming a set from the list. There is a disadvantage in the conversion, though: Sets are not ordered, so when you iterate through the resulting set, the order of the cues will likely bear no resemblance to the order they first appeared in the list. That issue motivates this problem: Copy madlib2.py to madlib2a.py , and add a function with this heading: def uniqueList ( aList ): ''' Return a new list that includes the first occurrence of each value in aList, and omits later repeats. The returned list should include the first occurrences of values in aList in their original order. >>> vals = ['cat', 'dog', 'cat', 'bug', 'dog', 'ant', 'dog', 'bug'] >>> uniqueList(vals) ['cat', 'dog', 'bug', 'ant'] ''' Hint: Process aList in order. Use the in syntax to only append elements to a new list that are not already in the new list. After perfecting the uniqueList function, replace the last line of getKeys , so it uses uniqueList to remove duplicates in keyList . Check that your madlib2a.py prompts you for cue values in the order that the cues first appear in the madlib format string. 3.1.7. Compound Boolean Expressions ¶ To be eligible to graduate from Loyola University Chicago, you must have 120 credits and a GPA of at least 2.0. This translates directly into Python as a compound condition : credits >= 120 and GPA >= 2.0 This is true if both credits >= 120 is true and GPA >= 2.0 is true. A short example program using this would be: credits = float ( input ( 'How many units of credit do you have? ' )) GPA = float ( input ( 'What is your GPA? ' )) if credits >= 120 and GPA >= 2.0 : print ( 'You are eligible to graduate!' ) else : print ( 'You are not eligible to graduate.' ) The new Python syntax is for the operator and : condition1 and condition2 The compound condition is true if both of the component conditions are true. It is false if at least one of the conditions is false. See Congress Exercise . In the last example in the previous section, there was an if - elif statement where both tests had the same block to be done if the condition was true: if x < xLow : dx = - dx elif x > xHigh : dx = - dx There is a simpler way to state this in a sentence: If x < xLow or x > xHigh, switch the sign of dx. That translates directly into Python: if x < xLow or x > xHigh : dx = - dx The word or makes another compound condition: condition1 or condition2 is true if at least one of the conditions is true. It is false if both conditions are false. This corresponds to one way the word “or” is used in English. Other times in English “or” is used to mean exactly one alternative is true. Warning When translating a problem stated in English using “or”, be careful to determine whether the meaning matches Python’s or . It is often convenient to encapsulate complicated tests inside a function. Think how to complete the function starting: def isInside ( rect , point ): '''Return True if the point is inside the Rectangle rect.''' pt1 = rect . getP1 () pt2 = rect . getP2 () Recall that a Rectangle is specified in its constructor by two diagonally oppose Point s. This example gives the first use in the tutorials of the Rectangle methods that recover those two corner points, getP1 and getP2 . The program calls the points obtained this way pt1 and pt2 . The x and y coordinates of pt1 , pt2 , and point can be recovered with the methods of the Point type, getX() and getY() . Suppose that I introduce variables for the x coordinates of pt1 , point , and pt2 , calling these x-coordinates end1 , val , and end2 , respectively. On first try you might decide that the needed mathematical relationship to test is end1 <= val <= end2 Unfortunately, this is not enough: The only requirement for the two corner points is that they be diagonally opposite, not that the coordinates of the second point are higher than the corresponding coordinates of the first point. It could be that end1 is 200; end2 is 100, and val is 120. In this latter case val is between end1 and end2 , but substituting into the expression above 200 <= 120 <= 100 is False. The 100 and 200 need to be reversed in this case. This makes a complicated situation. Also this is an issue which must be revisited for both the x and y coordinates. I introduce an auxiliary function isBetween to deal with one coordinate at a time. It starts: def isBetween ( val , end1 , end2 ): '''Return True if val is between the ends. The ends do not need to be in increasing order.''' Clearly this is true if the original expression, end1 <= val <= end2 , is true. You must also consider the possible case when the order of the ends is reversed: end2 <= val <= end1 . How do we combine these two possibilities? The Boolean connectives to consider are and and or . Which applies? You only need one to be true, so or is the proper connective: A correct but redundant function body would be: if end1 <= val <= end2 or end2 <= val <= end1 : return True else : return False Check the meaning: if the compound expression is True , return True . If the condition is False , return False – in either case return the same value as the test condition. See that a much simpler and neater version is to just return the value of the condition itself! return end1 <= val <= end2 or end2 <= val <= end1 Note In general you should not need an if - else statement to choose between true and false values! Operate directly on the boolean expression. A side comment on expressions like end1 <= val <= end2 Other than the two-character operators, this is like standard math syntax, chaining comparisons. In Python any number of comparisons can be chained in this way, closely approximating mathematical notation. Though this is good Python, be aware that if you try other high-level languages like Java and C++, such an expression is gibberish. Another way the expression can be expressed (and which translates directly to other languages) is: end1 <= val and val <= end2 So much for the auxiliary function isBetween . Back to the isInside function. You can use the isBetween function to check the x coordinates, isBetween ( point . getX (), p1 . getX (), p2 . getX ()) and to check the y coordinates, isBetween ( point . getY (), p1 . getY (), p2 . getY ()) Again the question arises: how do you combine the two tests? In this case we need the point to be both between the sides and between the top and bottom, so the proper connector is and . Think how to finish the isInside method. Hint: [5] Sometimes you want to test the opposite of a condition. As in English you can use the word not . For instance, to test if a Point was not inside Rectangle Rect, you could use the condition not isInside ( rect , point ) In general, not condition is True when condition is False , and False when condition is True . The example program chooseButton1.py , shown below, is a complete program using the isInside function in a simple application, choosing colors. Pardon the length. Do check it out. It will be the starting point for a number of improvements that shorten it and make it more powerful in the next section. First a brief overview: The program includes the functions isBetween and isInside that have already been discussed. The program creates a number of colored rectangles to use as buttons and also as picture components. Aside from specific data values, the code to create each rectangle is the same, so the action is encapsulated in a function, makeColoredRect . All of this is fine, and will be preserved in later versions. The present main function is long, though. It has the usual graphics starting code, draws buttons and picture elements, and then has a number of code sections prompting the user to choose a color for a picture element. Each code section has a long if - elif - else test to see which button was clicked, and sets the color of the picture element appropriately. '''Make a choice of colors via mouse clicks in Rectangles -- A demonstration of Boolean operators and Boolean functions.''' from graphics import * def isBetween ( x , end1 , end2 ): '''Return True if x is between the ends or equal to either. The ends do not need to be in increasing order.''' return end1 <= x <= end2 or end2 <= x <= end1 def isInside ( point , rect ): '''Return True if the point is inside the Rectangle rect.''' pt1 = rect . getP1 () pt2 = rect . getP2 () return isBetween ( point . getX (), pt1 . getX (), pt2 . getX ()) and \ isBetween ( point . getY (), pt1 . getY (), pt2 . getY ()) def makeColoredRect ( corner , width , height , color , win ): ''' Return a Rectangle drawn in win with the upper left corner and color specified.''' corner2 = corner . clone () corner2 . move ( width , - height ) rect = Rectangle ( corner , corner2 ) rect . setFill ( color ) rect . draw ( win ) return rect def main (): win = GraphWin ( 'pick Colors' , 400 , 400 ) win . yUp () # right side up coordinates redButton = makeColoredRect ( Point ( 310 , 350 ), 80 , 30 , 'red' , win ) yellowButton = makeColoredRect ( Point ( 310 , 310 ), 80 , 30 , 'yellow' , win ) blueButton = makeColoredRect ( Point ( 310 , 270 ), 80 , 30 , 'blue' , win ) house = makeColoredRect ( Point ( 60 , 200 ), 180 , 150 , 'gray' , win ) door = makeColoredRect ( Point ( 90 , 150 ), 40 , 100 , 'white' , win ) roof = Polygon ( Point ( 50 , 200 ), Point ( 250 , 200 ), Point ( 150 , 300 )) roof . setFill ( 'black' ) roof . draw ( win ) msg = Text ( Point ( win . getWidth () / 2 , 375 ), 'Click to choose a house color.' ) msg . draw ( win ) pt = win . getMouse () if isInside ( pt , redButton ): color = 'red' elif isInside ( pt , yellowButton ): color = 'yellow' elif isInside ( pt , blueButton ): color = 'blue' else : color = 'white' house . setFill ( color ) msg . setText ( 'Click to choose a door color.' ) pt = win . getMouse () if isInside ( pt , redButton ): color = 'red' elif isInside ( pt , yellowButton ): color = 'yellow' elif isInside ( pt , blueButton ): color = 'blue' else : color = 'white' door . setFill ( color ) win . promptClose ( msg ) main () The only further new feature used is in the long return statement in isInside . return isBetween ( point . getX (), pt1 . getX (), pt2 . getX ()) and \ isBetween ( point . getY (), pt1 . getY (), pt2 . getY ()) Recall that Python is smart enough to realize that a statement continues to the next line if there is an unmatched pair of parentheses or brackets. Above is another situation with a long statement, but there are no unmatched parentheses on a line. For readability it is best not to make an enormous long line that would run off your screen or paper. Continuing to the next line is recommended. You can make the final character on a line be a backslash ( '\\' ) to indicate the statement continues on the next line. This is not particularly neat, but it is a rather rare situation. Most statements fit neatly on one line, and the creator of Python decided it was best to make the syntax simple in the most common situation. (Many other languages require a special statement terminator symbol like ‘;’ and pay no attention to newlines). Extra parentheses here would not hurt, so an alternative would be return ( isBetween ( point . getX (), pt1 . getX (), pt2 . getX ()) and isBetween ( point . getY (), pt1 . getY (), pt2 . getY ()) ) The chooseButton1.py program is long partly because of repeated code. The next section gives another version involving lists. 3.1.7.1. Congress Exercise ¶ A person is eligible to be a US Senator who is at least 30 years old and has been a US citizen for at least 9 years. Write an initial version of a program congress.py to obtain age and length of citizenship from the user and print out if a person is eligible to be a Senator or not. A person is eligible to be a US Representative who is at least 25 years old and has been a US citizen for at least 7 years. Elaborate your program congress.py so it obtains age and length of citizenship and prints out just the one of the following three statements that is accurate: You are eligible for both the House and Senate. You eligible only for the House. You are ineligible for Congress. 3.1.8. More String Methods ¶ Here are a few more string methods useful in the next exercises, assuming the methods are applied to a string s : s .startswith( pre ) returns True if string s starts with string pre : Both '-123'.startswith('-') and 'downstairs'.startswith('down') are True , but '1 - 2 - 3'.startswith('-') is False . s .endswith( suffix ) returns True if string s ends with string suffix : Both 'whoever'.endswith('ever') and 'downstairs'.endswith('airs') are True , but '1 - 2 - 3'.endswith('-') is False . s .replace( sub , replacement , count ) returns a new string with up to the first count occurrences of string sub replaced by replacement . The replacement can be the empty string to delete sub . For example: s = '-123' t = s . replace ( '-' , '' , 1 ) # t equals '123' t = t . replace ( '-' , '' , 1 ) # t is still equal to '123' u = '.2.3.4.' v = u . replace ( '.' , '' , 2 ) # v equals '23.4.' w = u . replace ( '.' , ' dot ' , 5 ) # w equals '2 dot 3 dot 4 dot ' 3.1.8.1. Article Start Exercise ¶ In library alphabetizing, if the initial word is an article (“The”, “A”, “An”), then it is ignored when ordering entries. Write a program completing this function, and then testing it: def startsWithArticle ( title ): '''Return True if the first word of title is "The", "A" or "An".''' Be careful, if the title starts with “There”, it does not start with an article. What should you be testing for? 3.1.8.2. Is Number String Exercise ¶ ** In the later Safe Number Input Exercise , it will be important to know if a string can be converted to the desired type of number. Explore that here. Save example isNumberStringStub.py as isNumberString.py and complete it. It contains headings and documentation strings for the functions in both parts of this exercise. A legal whole number string consists entirely of digits. Luckily strings have an isdigit method, which is true when a nonempty string consists entirely of digits, so '2397'.isdigit() returns True , and '23a'.isdigit() returns False , exactly corresponding to the situations when the string represents a whole number! In both parts be sure to test carefully. Not only confirm that all appropriate strings return True . Also be sure to test that you return False for all sorts of bad strings. Recognizing an integer string is more involved, since it can start with a minus sign (or not). Hence the isdigit method is not enough by itself. This part is the most straightforward if you have worked on the sections String Indices and String Slices . An alternate approach works if you use the count method from Object Orientation , and some methods from this section. Complete the function isIntStr . Complete the function isDecimalStr , which introduces the possibility of a decimal point (though a decimal point is not required). The string methods mentioned in the previous part remain useful. [1] This is an improvement that is new in Python 3. [2] “In this case do ___; otherwise”, “if ___, then”, “when ___ is true, then”, “___ depends on whether”, [3] If you divide an even number by 2, what is the remainder? Use this idea in your if condition. [4] 4 tests to distinguish the 5 cases, as in the previous version [5] Once again, you are calculating and returning a Boolean result. You do not need an if - else statement. Table Of Contents 3.1. If Statements 3.1.1. Simple Conditions 3.1.2. Simple if Statements 3.1.3. if - else Statements 3.1.4. More Conditional Expressions 3.1.4.1. Graduate Exercise 3.1.4.2. Head or Tails Exercise 3.1.4.3. Strange Function Exercise 3.1.5. Multiple Tests and if - elif Statements 3.1.5.1. Sign Exercise 3.1.5.2. Grade Exercise 3.1.5.3. Wages Exercise 3.1.6. Nesting Control-Flow Statements 3.1.6.1. Short String Exercise 3.1.6.2. Even Print Exercise 3.1.6.3. Even List Exercise 3.1.6.4. Unique List Exercise 3.1.7. Compound Boolean Expressions 3.1.7.1. Congress Exercise 3.1.8. More String Methods 3.1.8.1. Article Start Exercise 3.1.8.2. Is Number String Exercise Previous topic 3. More On Flow of Control Next topic 3.2. Loops and Tuples This Page Show Source Quick search Enter search terms or a module, class or function name. Navigation index next | previous | Hands-on Python Tutorial » 3. More On Flow of Control » © Copyright 2019, Dr. Andrew N. Harrington. Last updated on Jan 05, 2020. Created using Sphinx 1.3.1+.
2026-01-13T09:30:36
https://pt-br.facebook.com/login/?next=https%3A%2F%2Fl.facebook.com%2Fl.php%3Fu%3Dhttps%253A%252F%252Fwww.instagram.com%252F%26amp%253Bh%3DAT34pS_RQFlBmcaNQOulqRe7J4_PCItZ84NLZDJDu21S7FGu2-_v8zr7eB-3ObSEUmwdaSx5xmwpYqeU-vT-ppR-POIGEA8RUUr4nxMvRIAurCBa9myixBL6EqY19V8uZHMj4kLzKW-6zc4b
Facebook Facebook Email ou telefone Senha Esqueceu a conta? Criar nova conta Você está bloqueado temporariamente Você está bloqueado temporariamente Parece que você estava usando este recurso de forma indevida. Bloqueamos temporariamente sua capacidade de usar o recurso. Back Português (Brasil) 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) 日本語 Français (France) Deutsch Cadastre-se Entrar Messenger Facebook Lite Vídeo Meta Pay Meta Store Meta Quest Ray-Ban Meta Meta AI Mais conteúdo da Meta AI Instagram Threads Central de Informações de Votação Política de Privacidade Central de Privacidade Sobre Criar anúncio Criar Página Desenvolvedores Carreiras Cookies Escolhas para anúncios Termos Ajuda Upload de contatos e não usuários Configurações Registro de atividades Meta © 2026
2026-01-13T09:30:36
https://bifromq.apache.org/docs/1.0.x/get_started/quick_install/
Install BifroMQ | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 1.0.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install BifroMQ Connect to BifroMQ Install & Deploy Configuration User Guide Plugin Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 1.0.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Get Started Install BifroMQ Version: 1.0.x On this page Install BifroMQ Docker ​ docker run -d --name bifromq -p 1883:1883 bifromq/bifromq:latest bash ​ For more installation options, details: Install & Deploy Edit this page Previous Get Started Next Connect to BifroMQ Docker bash Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://bifromq.apache.org/docs/2.1.x/category/plugin/
Plugin | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 2.1.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install & Deploy Configuration User Guide Plugin Overview Auth Provider Event Collector Setting Provider BifroMQ Plugin Practice and Notice Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 2.1.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Plugin Version: 2.1.x Plugin BifroMQ Plugin. 📄️ Overview BifroMQ's plugin mechanism allows users to integrate custom business logic with BifroMQ at runtime. Currently, BifroMQ defines 3 types of Plugin interfaces, catering to different use cases: 📄️ Auth Provider The Auth Provider plugin is designed to provide BifroMQ runtime with the capability to authenticate MQTT client connections and authorize Pub/Sub message topics. The interface for the plugin is defined in the following Maven module: 📄️ Event Collector The Event Collector Plugin is designed to gather various events generated during the execution of BifroMQ. By filtering through event types, you can focus on the events that matter to you, enabling the implementation of various business logic such as usage statistics, monitoring, alerts, etc. The Plugin's interface is defined in the following Maven module: 📄️ Setting Provider BifroMQ defines a category of settings (Setting) that can be modified at runtime, allowing for dynamic adjustment of BifroMQ's service behavior per tenant. The purpose of the Setting Provider Plugin is to supply custom values for these settings at runtime. The Plugin's interface is defined in the following Maven module: 📄️ BifroMQ Plugin Practice and Notice BifroMQ is a powerful messaging system that allows seamless communication between itself and customized services. Previous API Service Next Overview Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://zh-cn.facebook.com/login/?next=https%3A%2F%2Fl.facebook.com%2Fl.php%3Fu%3Dhttps%253A%252F%252Fwww.instagram.com%252F%26amp%253Bh%3DAT34pS_RQFlBmcaNQOulqRe7J4_PCItZ84NLZDJDu21S7FGu2-_v8zr7eB-3ObSEUmwdaSx5xmwpYqeU-vT-ppR-POIGEA8RUUr4nxMvRIAurCBa9myixBL6EqY19V8uZHMj4kLzKW-6zc4b
Facebook Facebook 邮箱或手机号 密码 忘记账户了? 创建新账户 你暂时被禁止使用此功能 你暂时被禁止使用此功能 似乎你过度使用了此功能,因此暂时被阻止,不能继续使用。 Back 中文(简体) 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 日本語 Português (Brasil) Français (France) Deutsch 注册 登录 Messenger Facebook Lite 视频 Meta Pay Meta 商店 Meta Quest Ray-Ban Meta Meta AI Meta AI 更多内容 Instagram Threads 选民信息中心 隐私政策 隐私中心 关于 创建广告 创建公共主页 开发者 招聘信息 Cookie Ad Choices 条款 帮助 联系人上传和非用户 设置 动态记录 Meta © 2026
2026-01-13T09:30:36
https://es-la.facebook.com/login/?next=https%3A%2F%2Fl.facebook.com%2Fl.php%3Fu%3Dhttps%253A%252F%252Fwww.instagram.com%252F%26amp%253Bh%3DAT34pS_RQFlBmcaNQOulqRe7J4_PCItZ84NLZDJDu21S7FGu2-_v8zr7eB-3ObSEUmwdaSx5xmwpYqeU-vT-ppR-POIGEA8RUUr4nxMvRIAurCBa9myixBL6EqY19V8uZHMj4kLzKW-6zc4b
Facebook Facebook Correo o teléfono Contraseña ¿Olvidaste tu cuenta? Crear cuenta nueva Se te bloqueó temporalmente Se te bloqueó temporalmente Parece que hiciste un uso indebido de esta función al ir muy rápido. Se te bloqueó su uso temporalmente. Back Español 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย 中文(简体) 日本語 Português (Brasil) Français (France) Deutsch Registrarte Iniciar sesión Messenger Facebook Lite Video Meta Pay Tienda de Meta Meta Quest Ray-Ban Meta Meta AI Más contenido de Meta AI Instagram Threads Centro de información de votación Política de privacidad Centro de privacidad Información Crear anuncio Crear página Desarrolladores Empleo Cookies Opciones de anuncios Condiciones Ayuda Importación de contactos y no usuarios Configuración Registro de actividad Meta © 2026
2026-01-13T09:30:36
https://ko-kr.facebook.com/login/?next=https%3A%2F%2Fwww.facebook.com%2Fshare_channel%2F%3Ftype%3Dreshare%26amp%253Blink%3Dhttps%253A%252F%252Fsecure.qgiv.com%252Ffor%252Famericanglaucomasocietyfoundation%26amp%253Bapp_id%3D966242223397117%26amp%253Bsource_surface%3Dexternal_reshare%26amp%253Bdisplay%26amp%253Bhashtag
Facebook Facebook 이메일 또는 휴대폰 비밀번호 계정을 잊으셨나요? 새 계정 만들기 일시적으로 차단됨 일시적으로 차단됨 회원님의 이 기능 사용 속도가 너무 빠른 것 같습니다. 이 기능 사용에서 일시적으로 차단되었습니다. Back 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) 日本語 Português (Brasil) Français (France) Deutsch 가입하기 로그인 Messenger Facebook Lite 동영상 Meta Pay Meta 스토어 Meta Quest Ray-Ban Meta Meta AI Meta AI 콘텐츠 더 보기 Instagram Threads 투표 정보 센터 개인정보처리방침 개인정보 보호 센터 정보 광고 만들기 페이지 만들기 개발자 채용 정보 쿠키 AdChoices 이용 약관 고객 센터 연락처 업로드 및 비사용자 설정 활동 로그 Meta © 2026
2026-01-13T09:30:36
https://bifromq.apache.org/docs/plugin/plugin_practice/
Plugin Practice and Notice | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ Next (Incubating) Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct Get Started Installation BifroMQ Cluster User Guide Plugin Auth Provider Client Balancer Event Collector Resource Throttler Setting Provider Plugin Practice and Notice Administration Benchmark Contribution Plugin Plugin Practice and Notice Version: Next (Incubating) On this page Plugin Practice and Notice This article outlines some practices and considerations when developing BifroMQ plugins. Start a BifroMQ Plugin Project Quickly ​ To jump start your BifroMQ plugin development, execute the following Maven command: mvn archetype:generate \ -DarchetypeGroupId=org.apache.bifromq \ -DarchetypeArtifactId=bifromq-plugin-archetype \ -DarchetypeVersion=<BIFROMQ_VERSION> \ -DgroupId=<YOUR_GROUP_ID> \ -DartifactId=<YOUR_ARTIFACT_ID> \ -Dversion=<YOUR_PROJECT_VERSION> \ -DpluginName=<YOUR_PLUGIN_CLASS_NAME> \ -DpluginContextName=<YOUR_PLUGIN_CONTEXT_CLASS_NAME> \ -DbifromqVersion=<BIFROMQ_VERSION> \ -DinteractiveMode=false Replace <YOUR_GROUP_ID> , <YOUR_ARTIFACT_ID> , <YOUR_PROJECT_VERSION> , <YOUR_PLUGIN_CLASS_NAME> , and < YOUR_PLUGIN_CONTEXT_CLASS_NAME> with your specific details. This command generates a ready-to-build multi-module project structured for BifroMQ plugin development. Important Note : The archetype version should be 3.2.0 or higher as the archetype is compatible starting from version 3.2.0. Ensure that <BIFROMQ_VERSION> is set accordingly. In addition to the foundational code framework for plugin development, the generated BifroMQ plugin project also includes the following features: PluginContext: Defines the plugin context to facilitate the transfer of necessary runtime information. Configuration File: Uses a standalone config.yaml file for plugin configuration. Logging Configuration: Uses a standalone logback.xml file for plugin logging configuration. Remote Debugging with BifroMQ ​ BifroMQ supports remote debugging, which can be activated through the JVM_DEBUG environment variable. Additionally, the remote debugging port can be specified through the JAVA_DEBUG_PORT environment variable. If not specified, the default port is 8008. Before starting the BifroMQ process, specify these environment variables using shell: export JVM_DEBUG=true export JAVA_DEBUG_PORT=8008 export DEBUG_SUSPEND_FLAG=n Ensure the debugging port is correctly configured to avoid port conflicts. Remote debugging can be performed using an IDE (for example, IntelliJ or Eclipse). Setting DEBUG_SUSPEND_FLAG=y can assist in debugging the plugin's initialization process. Pay Attention to Java ClassLoading ​ BifroMQ uses separate ClassLoaders for each plugin to load classes from the plugin's classpath. Therefore, ensure your plugin's packaging includes all dependencies used (except those provided by BifroMQ). Some third-party libraries might load classes in other ways, leading to class loading failures. Most situations can be resolved by swapping the Thread ContextLoader: class MyPlugin { public void pluginMethod() { ClassLoader originalLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); // Initialize dependencies here dependenciesInit(); } finally { Thread.currentThread().setContextClassLoader(originalLoader); } } } Properly Organize the Plugin Directory ​ When developing plugins, ensure there are no unrelated jar files in the plugin directory. pf4j recursively checks jar files in the plugin directory, and unrelated jars may lead to PF4J validation errors. Keeping the plugin directory clean and containing only necessary jar files ensures smooth plugin loading and prevents conflicts or validation issues. Metrics and Logging ​ For the Plugin project generated from BifroMQ Plugin Archetype. The plubin log output can be controlled using dedicated log4j2.xml file under plugin's own conf folder. BifroMQ captures and records metrics during invocations of plugin methods, offering useful insights for debugging and performance optimization. Edit this page Previous Tenant-level Settings Next Admin Guide Overview Start a BifroMQ Plugin Project Quickly Remote Debugging with BifroMQ Pay Attention to Java ClassLoading Properly Organize the Plugin Directory Metrics and Logging Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
http://www.videolan.org/news.html#news-2021-04-05
News - VideoLAN * { behavior: url("/style/box-sizing.htc"); } Toggle navigation VideoLAN Team & Organization Consulting Services & Partners Events Legal Press center Contact us VLC Download Features Customize Get Goodies Projects DVBlast x264 x262 x265 multicat dav1d VLC Skin Editor VLC media player libVLC libdvdcss libdvdnav libdvdread libbluray libdvbpsi libaacs libdvbcsa biTStream vlc-unity All Projects Contribute Getting started Donate Report a bug Support donate donate Donate donate donate VideoLAN, a project and a non-profit organization. News archive VLC 3.0.23 2026-01-08 VideoLAN and the VLC team are publishing the 3.0.23 release of VLC today, which is the 24th update to VLC's 3.0 branch: it updates codecs, adds a dark mode option on Windows and Linux, support for Windows ARM64 and improves support for Windows XP SP3. This is the largest bug fix release ever with a large number of stability and security improvements to demuxers (reported by rub.de, oss-fuzz and others) and updates to most third party libraries. Additional details on the release page . The security impact of this release is detailed here . The major maintenance effort of this release to strengthen VLC's overall stability as well as the compatibility with old releases of Windows and macOS was made possible by a generous sponsorship of the Sovereign Tech Fund by Germany's Federal Ministry for Digital Transformation and Government Modernisation. VLC for iOS, iPadOS and tvOS 3.7.0 2026-01-08 Alongside the 3.0.23 release for desktop, VideoLAN and the VLC team are publishing a larger update for Apple's mobile platforms to include the latest improvements of VLC's 3.0 branch plus important bug fixes and amendments for the 26 versions of the OS. Previously, we added pCloud as a European choice for cloud storage allowing direct streaming and downloads within the app. New releases for biTStream, DVBlast and multicat 2025-12-01 We are pleased to release versions 1.6 of biTStream , 3.5 of DVBlast and 2.4 of multicat . DVBlast and multicat had major improvements and new features. New releases for libdvdcss, libdvdread and libdvdnav 2025-11-09 New releases of libdvdread , libdvdnav and libdvdcss have been published today. The biggest features of those releases (libdvdread/nav 7 and libdvdcss 1.5) are related to DVD-Audio support, including DRM decryption. VLC for Android 3.6.0 2025-01-13 We are pleased to release version 3.6.0 of the VLC version for the Android platform. It comes with the new Remote Access feature, a parental control and a lot of fixes. See our Android page . VLC 3.0.21 2024-06-10 VideoLAN and the VLC team are publishing the 3.0.21 release of VLC today, which is the 22nd update to VLC's 3.0 branch: it updates codecs, adds Super Resolution and VQ Enhancement filtering with AMD GPUs, NVIDIA TrueHDR to generate a HDR representation from SDR sources with NVIDIA GPUs and improves playback of numerous formats including improved subtitles rendering notably on macOS with Asian languages. Additional details on the release page . This release also fixes a security issue, which is detailed here . VLC for iOS, iPadOS and Apple TV 3.5.0 2024-02-16 We are happy to announce a major update of VLC for iOS, iPadOS and tvOS adding playback history, A to B playback, Siri integration, support for external subtitles and audio tracks, a way to favorite folders on local network servers, improved CarPlay integration and many small improvements. VLC 3.0.20 2023-11-02 Today, VideoLAN is publishing the 3.0.20 release of VLC, which is a medium update to VLC's 3.0 branch: it updates codecs, fixes a FLAC quality issue and improves playback of numerous formats including improved subtitles rendering. It also fixes a freeze when using frame-by-frame actions. On macOS, audio layout problems are resolved. Finally, we update the user interface translations and add support for more. Additional details on the release page . This release also fixes two security issues, which are detailed here and there . VLC for iOS, iPadOS and Apple TV 3.4.0 2023-05-03 We are happy to announce a major update of VLC for iOS, iPadOS and tvOS adding a new audio playback interface, CarPlay integration, various improvements to the local media library and iterations to existing features such as WiFi Sharing. Notably, we also added maintenance improvements to the port to tvOS including support for the Apple Remote's single click mode. See the press release for details. VLC 3.0.18 2022-11-29 Today, VideoLAN is publishing the 3.0.18 release of VLC, which adds support for a few formats, improves adaptive streaming support, fixes some crashes and updates many third party libraries. More details on the release page . This release also fixes multiple security issues, which are detailed here . VideoLAN supports the UNHCR 2022-10-24 VideoLAN is a de-facto pacifist organization and cares about cross-countries cooperations, and believes in the power of knowledge and sharing. War goes against those ideals. As a response Russia's invasion of Ukraine, we decided to financially support the United Nations High Commissioner for Refugees and their work on aiding and protecting forcibly displaced people and communities, in the places where they are necessary. See our press statement . VLC for Android 3.5.0 2022-07-20 VideoLAN is proud to release the new major version of VLC for Android. It comes with new widgets, network media indexation, a better tablet and foldable support, design improvements in the audio screen, improved accessibility and performance improvements. VLC 3.0.17 2022-04-19 Today, VideoLAN is publishing the 3.0.17 release of VLC, which adds support for a few formats, improves adaptive streaming support, fixes some crashes and updates many third party libraries. More details on the release page . VLC for iOS, iPadOS and tvOS 3.3.0 2022-03-21 We are happy to announce a major update of VLC for iOS, iPadOS and tvOS adding a new video playback interface, support for NFS and SFTP network shares and major improvements to the media handling especially for audio. See the press release . libbluray releases 2022-03-06 libbluray and related libraries, libaacs and libbdplus, have new releases, focused on maintenance, minor improvements, and notably new OSes and new java versions compatibility. See libbluray , libaacs and libbdplus pages. VLC and log4j 2021-12-15 Since its very early days in 1996, VideoLAN software is written in programming languages of the C family (mostly plain C with additions in C++ and Objective-C) with the notable exception of its port to Android, which was started in Java and recently transitioned to Kotlin. VLC does not use the log4j library on any platform and is therefore unaffected by any related security implications. VLC for Android 3.4.0 2021-09-20 We are pleased to release version 3.4.0 of the VLC version for the Android platforms. Still based on libVLC 3, it revamps the Audio Player and the Auto support, it adds bookmarks in each media, simplifies the permissions and improves video grouping. See our Android page . VLC 3.0.16 2021-06-21 Today, VideoLAN is publishing the 3.0.16 release of VLC, which fixes delays when seeking on Windows, opening DVD folders with non-ASCII character names, fixes HTTPS support on Windows XP, addresses audio drop-outs on seek with specific MP4 content and improves subtitles renderering. It also adds support for the TouchBar on macOS. More details on the release page . VLC 3.0.14, auto update issues and explanations 2021-05-11 VLC users on Windows might encounter issues when trying to auto update VLC from version 3.0.12 and 3.0.13. Find more details here . We are publishing version 3.0.14 to address this problem for future updates. VLC 3.0.13 2021-05-10 VideoLAN is now publishing 3.0.13 release, which improves the network shares and adaptive streaming support, fixes some MP4 audio regressions, fixes some crashes on Windows and macOS and fixes security issues. More details on the release page . libbluray 1.3.0 2021-04-05 A new release of libbluray was pushed today, adding new APIs, to improve the control of the library, improve platforms support, and fix some bugs. See our libbluray page. VideoLAN is 20 years old today! 2021-02-01 20 years ago today, VideoLAN moved from a closed-source student project to the GNU GPL, thanks to the authorization of the École Centrale Paris director at that time. VLC has grown a lot since, thanks to 1000 volunteers! Read our press release! . VLC for Android 3.3.4 2021-01-21 VideoLAN is now publishing the VLC for Android 3.3.4 release which focuses on improving the Chromecast support. Since the 3.3.0 release, a lot of improvements have been made for Android TV, SMB support, RTL support, subtitles picking and stability. . VLC 3.0.12 2021-01-18 VideoLAN is now publishing 3.0.12 release, which adds support for Apple Silicon, improves Bluray, DASH and RIST support. It fixes some audio issues on macOS, some crashes on Windows and fixes security issues. More details on the release page . libbluray 1.2.1 2020-10-23 A minor release of libbluray was pushed today, focused on fixing bugs and improving the support for UHD Blurays. More details on the libbluray page. VLC for Android 3.3 2020-09-23 VideoLAN is proud to release the new major version of VLC for Android. A complete design rework has been done. The navigation is now at the bottom for a better experience. The Video player has also been completely revamped for a more modern look. The video grouping has been improved and lets you create custom groups. You can also easily share your media with your friends. The settings have been simplified and a lot of bugs have been fixed. VLC 3.0.11.1 2020-07-29 Today, VideoLAN is publishing the VLC 3.0.11.1 release for macOS, which notably solves an audio rendering regression introduced in the last update specific to that platform. Additionally, it improves playback of HLS streams, WebVTT subtitles and UPnP discovery. VLC 3.0.11 2020-06-16 VideoLAN is now publishing the VLC 3.0.11 release, which improves HLS playback and seeking certain m4a files as well as AAC playback. Additionally, this solves an audio rendering regression on macOS when pausing playback and adds further bug fixes. Additionally, a security issue was resolved. More information available on the release page . VLC 3.0.10 2020-04-28 VideoLAN is now publishing the VLC 3.0.10 release, which improves DVD, macOS Catalina, adaptive streaming, SMB and AV1 support, and fixes some important security issues. More information available on the release page . We are also releasing new versions for iOS (3.2.8) and Android 3.2.11 for the same security issues. VLC for iOS and tvOS releases 2020-03-31 VideoLAN is publishing updates to VLC on iOS and tvOS, to fix numerous small issues, add passcode protection on the web sharing, and improve the quick actions and the stability of the application. VLC for iOS 3.2.5 release 2019-12-03 VideoLAN is publishing updates to VLC on iOS, to improve support for iOS9 compatibility and add new quick actions and improves the collection handling. libdvdread and libdvdnav releases 2019-10-13 We are publishing today libdvdnav and libdvdread minor releases to fix minor crashes and improving the support for difficult discs. See libdvread page for more information . VLC for iOS 3.2.0 release 2019-09-14 VideoLAN is finally publishing its new major version of iOS, numbered 3.2.0. This update starts the changes for the new interface that will drive the development for the next year. It should give the correct building blocks for the future of the iOS app. VLC 3.0.8 2019-08-19 VideoLAN is now publishing the VLC 3.0.8 release, which improves adaptive streaming support, audio output on macOS, VTT subtitles rendering, and also fixes a dozen of security issues. More information available on the release page . VLC 3.0.7 2019-06-07 After 100 millions downloads of 3.0.6, VideoLAN is releasing today the VLC 3.0.7 release, focusing on numerous security fixes, improving HDR support on Windows, and Blu-ray menu support. VideoLAN would like to thank the EU-FOSSA project from the European Commission, who funded this initiative. More information available on the release page . VLC for Android 3.1 2019-04-08 VideoLAN is happy to present the new major version of VLC for Android platforms. Featuring AV1 decoding with dav1d, Android Auto, Launcher Shortcuts, Oreo/Pie integration, Video Groups, SMBv2, and OTG drive support, but also improvements on Cast, Chromebooks and managing the audio/video libraries, this is a quite large update. libbluray 1.1.0 2019-02-12 VideoLAN is releasing a new major version of libbluray: 1.1.0. It adds support for UHD menus (experimental) , for more recents of Java, and improves vastly BD-J menus. This release fixes numerous small issues reported. libdvdread 6.0.1 2019-02-05 VideoLAN is releasing a new minor version of libdvdread, numbered 6.0.1, fixing minor DVD issues. See libdvdread page for more info. VLC reaches 3 billion downloads 2019-01-12 VideoLAN is very happy to announce that VLC crossed the 3 billion downloads on our website: VLC statistics . Please note that this number is under-estimating the number of downloads of VLC. VLC 3.0.6 2019-01-10 VideoLAN is now publishing the VLC 3.0.6 release, which fixes an important regression that appeared on 3.0.5 for DVD subtitles. It also adds support for HDR in AV1. VLC 3.0.5 2018-12-27 VideoLAN is now publishing the VLC 3.0.5 release, a new minor release of the 3.0 branch. This release notably improves the macOS mojave support, adds a new AV1 decoder and fixes numerous issues with hardware acceleration on Windows. More information available here . VLC 3.0.4 2018-08-31 VideoLAN is publishing the VLC 3.0.4 release, a new minor release of the 3.0 branch. This release notably improves the video outputs on most OSes, supports AV1 codec, and fixes numerous small issues on all OSes and Platforms. More information available here . Update for all Windows versions is strongly advised. VLC 3.0.13 for Android 2018-07-31 VideoLAN is publishing today, VLC 3.0.13 on Android and Android TV. This release fixes numerous issues from the 3.0.x branch and improves stability. VLC 3.1.0 for WinRT and iOS 2018-07-20 VideoLAN is publishing today, VLC 3.1.0 on iOS and on Windows App (WinRT) platforms. This release brings hardware encoding and ChromeCast on those 2 mobile platforms. It also updates the libvlc to 3.0.3 in those platforms. VLC 3.0.3 2018-05-29 VideoLAN is publishing the VLC 3.0.3 release, a new minor release of 3.0. This release is fixing numerous crashes and regressions from VLC 3.0.0, "Vetinari", and it fixes some security issues. More information available here . Update for everyone is advised for this release. VLC 3.0.2 2018-04-23 VideoLAN is publishing the VLC 3.0.2 release, for general availability. This release is fixing most of the important bugs and regressions from VLC 3.0.0, "Vetinari", and improves decoding speed on macOS. More than 150 bugs were fixed since the 3.0.0 release. More information available here . VLC 3.0.1 2018-02-28 VideoLAN and the VLC development team are releasing VLC 3.0.1, the first bugfix release of the "Vetinari" branch, for Linux, Windows and macOS. This version improves the chromecast support, hardware decoding, adaptive streaming, and fixes many bugs or crashes encountered in the 3.0.0 version. In total more than 30 issues have been fixed, on all platforms. More information available here . VLC 3.0.0 2018-02-09 VideoLAN and the VLC development team are releasing VLC 3.0.0 "Vetinari" for Linux, Windows, OS X, BSD, Android, iOS, UWP and Windows Phone today! This is the first major release in three years. It activates hardware decoding by default to get 4K and 8K playback, supports 10bits and HDR playback, 360° video and 3D audio, audio passthrough for HD audio codecs, streaming to Chromecast devices (even in formats not supported natively), playback of Blu-Ray Java menus and adds browsing of local network drives. More info on our release page . VLC 2.2.8 2017-12-05 VideoLAN and the VLC development team are happy to publish version 2.2.8 of VLC media player today. This release fixes a security issue in the AVI demuxer. Additionally, it includes the following fixes, which are part of 2.2.7: This release fixes compatibility with macOS High Sierra and fixes SSA subtitles rendering on macOS. This release also fixes a few security issues, in the flac and the libavcodec modules (heap write overflow), in the avi module and a few crashes. For macOS users, please note: A bug was fixed in VLC 2.2.7 concerning the update mechanism on macOS. In rare circumstances, an auto-update from older versions of VLC to VLC 2.2.8 might not be possible. Please download the update manually from our website in this case. VideoLAN joins the Alliance for Open Media 2017-05-16 The VideoLAN non-profit organization is joining the Alliance for Open Media , to help developing open and royalty-free codecs and other video technologies! More information in our press release: VideoLAN joins Alliance for Open Media . VLC 2.2.5.1 2017-05-12 VideoLAN and the VLC development team are happy to publish version 2.2.5.1 of VLC media player today This fifth stable release of the "WeatherWax" version of VLC fixes a few bugs reported on VLC 2.2.4, notably video rendering issues on AMD graphics card as well as audio distortion on macOS and 64bit Windows for certain audio files. It also includes updated codecs libraries and improves overall security. Read more about it on our release page . Press release: Wikileaks revelations about VLC 2017-03-09 Following the recent revelations from Wikileaks about the use of VLC by the CIA, you can download the official statement from the VideoLAN organization here . VLC for Android 2.1 beta 2017-02-24 VideoLAN and the VLC development team are happy to publish beta version 2.1 of VLC for Android today It brings 360° video & faster audio codecs passthru support, performances improvements, Android auto integration and a refreshed UX. See all new features and get it VLC for Android 2.0.0 2016-06-21 VideoLAN and the VLC development team are happy to publish version 2.0 of VLC for Android today It supports network shares browsing and playback, video playlists, downloading subtitles, pop-up video view and multiwindows, the new releases of the Android operating system, and merged Android TV and Android packages. Get it now! and give us your feedback. VLC 2.2.4 2016-06-05 VideoLAN and the VLC development team are happy to publish version 2.2.4 of VLC media player today This fourth stable release of the "WeatherWax" version of VLC fixes a few bugs reported on VLC 2.2.3 for Windows XP and certain audio files. It also includes updated codecs libraries and fixes a security issue when playing specifically crafted QuickTime files as well as a 3rd party security issue in libmad. Read more about it on our release page . VideoLAN servers under maintenance 2016-05-19 Due to unscheduled maintenance on one of our servers, some git repositories , the trac bug tracker and mailing-lists are currently not available. We are restoring the services, but we can't give detailed information when everything will be back online. Note that downloads from this website, git repositories on code.videolan.org , the wiki and the forum are not affected. Important: Any communication send to email addresses on the videolan.org domain (aka yourdude@videolan.org) won't reach the receiver. VLC 2.2.3 2016-05-03 VideoLAN and the VLC development team are happy to publish version 2.2.3 of VLC media player today This third stable release of the "WeatherWax" version of VLC fixes more than 30 important bugs reported on VLC 2.2.2. It also includes updated codecs libraries and fixes 3rd party libraries security issues. Read more about it on our release page . VideoLAN Dev Days 2016 part of QtCon 2016-02-18 2016 is a special year for many FLOSS projects: VideoLAN as open-source project and Free Software Foundation Europe both have their 15th birthday while KDE has its 20th birthday. All these call for celebrations! This year VideoLAN has come together with Qt , FSFE , KDE and KDAB to bring you QtCon , where attendees can meet, collaborate and get the latest news of all these projects. VideoLAN Dev Days 2016 will be organised as part of QtCon in Berlin. The event will start on Friday the 2nd of September with 3 shared days of talks, workshops, meetups and coding sessions. The current plan is to have a Call for Papers in March with the Program announced in early June. VLC 2.2.2 2016-02-06 VideoLAN and the VLC development team are happy to publish version 2.2.2 of VLC media player today This second stable release of the "WeatherWax" version of VLC fixes more than 100 important bugs and security issues reported on VLC 2.2.1. It also includes updated codecs libraries and fixes 3rd party libraries security issues. Finally, this update solves installation issues on Mac OS X 10.11 El Capitan. Read more about it on our release page . 15 years of GPL 2016-02-01 VideoLAN is happy to celebrate with you the 15th anniversary of the birth of VideoLAN and VLC as open source projects! Announcing VLC for Apple TV 2016-01-12 VideoLAN and the VLC team is excited to announce the first release of VLC for Apple TV. It allows you to get access to all your files and video streams in their native formats without conversions, directly on the new Apple device and your TV. You can find details in our press release . libdvdcss 1.4.0 2015-12-24 VideoLAN is proud to announce the release of version 1.4.0 of libdvdcss . This release adds support for network callbacks, to play ISOs over the network, Android support, and cleans the codebase. VLC for iOS 2.7.0 2015-12-22 VideoLAN and the VLC development team are excited to announce a major version of VLC for iOS today, which adds full support for iOS 9 including split screen and iPad Pro, for Windows shares (SMB), watchOS 2, a new subtitles engine, right-to-left interfaces, system-wide search (spotlight), Touch ID protection, and more. It will be available on the App Store shortly. VLC for ChromeOS 2015-12-17 VideoLAN and the Android teams are happy to announce the port of VLC to the ChromeOS operating system. This is the port of the Android version to ChromeOS, using the Android Runtime on Chrome. You can download it now! . VLC for Android 1.7.0 2015-12-01 VideoLAN and the Android teams are happy to present the release of VLC for Android 1.7.0. This release includes a large refactoring that gives a new playlist, new notifications, a new subtitles engine, and uses less permissions. Get it now! . VLC for Android 1.6.0 2015-10-09 VideoLAN and the Android teams are happy to present the release of VLC for Android 1.6.0. Ported to Android 6.0, this release should provide an important performance boost for decoding and the interface. Get it now! . DVBlast 3.0, multicat 2.1, bitstream 1.1 2015-10-07 VideoLAN and the DVBlast teams are happy to present the simultaneous release of DVBlast 3.0, bitstream 1.1 and multicat 2.1! DVBlast and multicat are now ported to OSX and DVBlast 3.0 is a major rewrite with new features like PID/SID remapping and stream monitoring. DVBlast , bitstream and multicat . libbluray 0.9.0 2015-10-04 VideoLAN and the libbluray team are releasing today libbluray 0.9.0. Adding numerous features, notably to better support BD-J menus and embedded subtitles files, it also fixes a few important issues, like font-caching. See more on libbluray page VLC for iOS 2.6.0 2015-06-30 VideoLAN and the VLC development team are excited to announce a major version of VLC for iOS today, which adds support for Apple Watch to remote control and browse the library on iPhone, a mini player and large number of improvements through-out the app. It will be available on the App Store shortly. libbluray 0.8.0, libaacs 0.8.1 released 2015-04-30 The 2 VideoLAN Blu-Ray libraries have been released: libbluray 0.8.0 , libaacs 0.8.1 . These releases add support for ISO files, BD-J JSM and virtual devices. VLC 2.2.1 2015-04-16 VideoLAN and the VLC development team are releasing today VLC 2.2.1, named "Terry Pratchett". This first stable release of the "WeatherWax" version of VLC fixes most of the important bugs reported of VLC 2.2.0. VLC 2.2.0, a major version of VLC, introduced accelerated auto-rotation of videos, 0-copy hardware acceleration, support for UHD codecs, playback resume, integrated extensions and more than 1000 bugs and improvements. 2.2.0 release was the first release to have versions for all operating systems, including mobiles (iOS, Android, WinRT). More info on our release page VLC for Android 1.2.1, for WinRT & Windows Phone 1.2.1 and for iOS 2.5.0 2015-03-27 VideoLAN and the VLC development team are happy to release updates for all three mobile platforms today. VLC for Android received support for audio playlists, improved audio quality, improvements to the material design interface, including the black theme and switch to audio mode. Further, it is a major update for Android TV adding support for media discovery via UPnP, with improvements for recommendations and gamepads. VLC for Windows Phone and WinRT received partial hardware accelerated decoding allowing playback of HD contents of certain formats as well as further iterations on the user interface. For VLC for iOS, we focused on improved cloud integration adding support for iCloud Drive, OneDrive and Box.com, a 10-band equalizer as well as sharing of the media library on the local network alongside an improved playback experience. All updates will be available on the respective stores later today. We hope that you like them as much as we do. VLC 2.2.0 2015-02-27 VideoLAN and the VLC development team are releasing VLC 2.2.0 for most OSes. We're releasing the desktop version for Linux, Windows, OS X, BSD, and at the same time, Android, iOS, Windows RT and Windows Phone versions. More info on our release page and press release . libbluray 0.7.0, libaacs 0.8.0 and libbdplus 0.1.2 released 2015-01-27 The 3 VideoLAN Blu-Ray libraries have been released: libbluray 0.7.0 , libaacs 0.8.0 and libbdplus 0.1.2 library. Those releases notably improves BD-J support, fonts support and file-system access. VLC for Android 0.9.9 2014-09-05 VideoLAN and the VLC development team are happy to present a new release for Android. This focuses on fixing crashes, better decoding and update of translations. More info in the release notes and download page . VLC 2.1.5 2014-07-26 VideoLAN and the VLC development team are happy to present a new minor version of the VLC 2.1.x branch. This fixes a few bugs and security issues in third-party libraries, like GnuTLS and libpng. More info on our release page libbluray, libaacs and libbdplus release 2014-07-13 The 3 VideoLAN Blu-Ray libraries have been released: libbluray 0.6.0 , libaacs 0.7.1 and libbdplus 0.1.1 library. Those releases notably add correct support for BD-J , the Java interactivity layer of Blu-Ray Discs. VLC for Android 0.9.7 2014-07-06 VideoLAN and the VLC development team are happy to present a new release for Android today. It improves a lot DVD menus and navigation, adds compatibility with Android L, fixes a few UI crashes and updates the translations. More info in the release notes . VLC for Android 0.9.5 2014-06-13 VideoLAN and the VLC development team are happy to present a new release for Android today. It adds support for DVD menus, a new VLC icon, tutorials and numerous fixes for crashes. More info in the release notes . VLC for iOS 2.3.0 2014-04-18 VideoLAN and the VLC development team are happy to present a new release for iOS today. It adds support for folders to group media, more options to customize playback, improved network interaction in various regards, many small but noticeable improvements as well as 3 new translations. More info in the release notes . VideoLAN announces distributed codec and conecoins! 2014-04-01 VideoLAN and the VLC development team are happy to present their new distributed codec, named CloudCodet ! To help smartphones users, this codec allows powerful computers to decode for other devices and the CPU-sharers will mine some conecoin , a new cone-shaped crypto-currency, in reward. More info on our press page VLC 2.1.4 and 2.0.10 2014-02-21 VideoLAN and the VLC development team are happy to present two updates for Mac OS X today. Version 2.1.4 solves an important DVD playback regression, while 2.0.10 accumulates a number of small improvements and bugfixes for older Macs based on PowerPC or 32-bit Intel CPUs running OS X 10.5. VLC 2.1.3 2014-02-04 VideoLAN and the VLC development team are happy to present a new minor version of the VLC 2.1.x branch. Fixing multiple bugs and regressions introduced in 2.1.0, 2.1.1 and 2.1.2, notably on audio and video outputs, decoders and demuxers More info on our release page libbluray, libaacs and libbdplus release 2013-12-24 Several Blu-Ray related libraries have been released: libbluray 0.5.0 , libaacs 0.7.0 and the new libbdplus library. VLC 2.1.2 2013-12-10 VideoLAN and the VLC development team are proud to present the second minor version of the VLC 2.1.x branch. Fixing many bugs and regressions introduced in 2.1.0, notably on audio device management and SPDIF/HDMI pass-thru. More info on our release page VLC 2.1.1 2013-11-14 VideoLAN and the VLC development team are proud to present the first minor version of the VLC 2.1.x branch. Fixing a numerous number of bugs and regressions introduced in 2.1.0, it also adds experimental HEVC and VP9 decoding and improves VLC installer on Windows. More info on our release page VLC 2.0.9 2013-11-05 VideoLAN and the VLC development team are glad to present a new minor version of the VLC 2.0.x branch. Mostly focused on fixing a few important bugs and security issues, this version is mostly needed for Mac OS X, notably for PowerPC and Intel32 platforms that cannot upgrade to 2.1.0. VLC 2.1.0 2013-09-26 VideoLAN and the VLC development team are glad to present the new major version of VLC, 2.1.0, named Rincewind With a new audio core, hardware decoding and encoding, port to mobile platforms, preparation for Ultra-HD video and a special care to support more formats, 2.1 is a major upgrade for VLC. Rincewind has a new rendering pipeline for audio, with better effiency, volume and device management, to improve VLC audio support. It supports many new devices inputs, formats, metadata and improves most of the current ones, preparing for the next-gen codecs. More info on our release page . VLC for iOS version 2.1 2013-09-06 VideoLAN and the VLC for iOS development team are happy to present version 2.1 of VLC for iOS, a first major update to this new port adding support for subtitles in non-western languages, basic UPNP discovery and streaming, FTP server discovery, streaming and downloading, playback of audio-only media, a newly implemented menu and application flow as well as various stability improvements, minor enhancements and additional translations. VLC 2.0.8 and 2.1.0-pre2 2013-07-29 VideoLAN and the VLC development team are happy to present VLC 2.0.8, a security update to the "Twoflower" family, and VLC 2.1.0-pre2, the second pre-version of VLC 2.1.0. You can find info about 2.0.8 in the release notes . VLC 2.1.0-pre2 is a test version of the next major version of VLC, named "Rincewind", intended for advanced users. If you're brave, you can try it now! NB: The first binaries of 2.0.8 for Win32 and Mac were broken. Please re-download them. VLC 2.0.7 2013-06-10 VideoLAN and the VLC development team are happy to present the eighth version of "Twoflower", a minor update that improves the overall stability. Notable changes include fixes for audio decoding, audio encoding, small security issues, regressions, fixes for PowerPC, Mac OS X and new translations. More info in the release notes . VLC 2.0.6 2013-04-11 VideoLAN and the VLC development team are happy to present the seventh version of "Twoflower", a minor update that improves the overall stability. Notable changes include support for Matroska v4, improved reliability for ASF, Ogg, ASF and srt support, fixed GPU decoding on Windows on Intel GPU, fixed ALAC and FLAC decoding, and a new compiler for Windows release. More info in the release notes . VLC for the new Windows 8 User Experience fundraiser 2012-11-29 Today, some VideoLAN team members launched a fundraiser on Kickstarter to support a port to the new User Experience on Windows 8 (aka "Metro") and Windows RT. Find out more . VLC fundraiser for Windows 8, RT and Phone ended 2012-12-29 Today, the fundraising campaign for for Windows 8, RT and Phone run by some VideoLAN team members ended. Their goal was successfully reached and they announced to start working on the new ports right away. Find out more . VLC 2.0.5 2012-12-15 VideoLAN and the VLC development team are happy to present the sixth version of "Twoflower", a minor update that improves the overall stability. Notable changes include improved reliability for MKV file playback, fixed MPEG2 audio and video encoding, pulseaudio synchronization, Mac OS interface, and other fixes. It also resolves potential security issues in HTML subtitle parser, freetype renderer, AIFF demuxer and SWF demuxer. More info in the release notes . We would like to remind our users that some VideoLAN team members are trying to raise money for VLC for Windows Metro on Kickstarter . VLC for the new Windows 8 User Experience fundraiser 2012-11-29 Today, some VideoLAN team members launched a fundraiser on Kickstarter to support a port to the new User Experience on Windows 8 (aka "Metro") and Windows RT. Find out more . VideoLAN Security Advisory 1203 2012-11-02 VLC media player versions 2.0.3 and older suffer from a critical buffer overflow vulnerability. Refer to our advisory for technical details. A fix for this issue is already available in VLC 2.0.4. We strongly recommend all users to update to this new version. VLC 2.0.4 2012-10-18 VideoLAN and the VLC development team present the fifth version of "Twoflower", a major update that fixes a lot of regressions, issues and security issues in this branch. It introduces Opus support, improves Youtube, Vimeo streams and Blu-Ray dics support. It also fixes many issues in playback, notably on Ogg and MKV playback and audio device selections and a hundred of other bugs. More info in the release notes . Updated 2.0.3 builds for Mac OS X 2012-08-01 A small number of users on specific setups experienced audio issues with the latest version of VLC media player for Mac OS X. If you are affected, please download VLC again and replace the existing installation. If you're not, there is nothing to do. VideoLAN at FISL 2012-07-19 Next week, we will give two talks about VideoLAN and VLC media player at the 13° Fórum Internacional Software Livre in Porto Alegre, Brazil. This is the first time VideoLAN members attend a conference in South America. We are looking forward to it and hope to see you around. VLC 2.0.3 2012-07-19 VideoLAN and the VLC development are proud to present a minor update adding support for OS X Mountain Lion as well as improving VLC's overall stability on OS X. Additionally, this version includes updates for 18 translations and adds support for Uzbek and Marathi. For MS Windows, you can update manually if you need the translation updates. VLC 2.0.2 2012-07-01 After more than 100 million downloads of VLC 2.0 versions, VideoLAN and the VLC development team present the third version of "Twoflower", a major update that fixes a lot of regressions in this branch. It introduces an important number of features for the Mac OS X platform, notably interface improvements to be on-par with the classic VLC interface, better performance and Retina Display support. VLC 2.0.2 fixes the video playback on older devices both on MS Windows and Mac OS X, includes overall performance improvements and fixes for a couple of hundreds of bugs. More info in the release notes . World IPv6 Launch 2012-06-04 The VideoLAN organization is taking part in the World IPv6 launch on June 6. All services including the website, the forums, the bugtracker and the git server are now accessible via IPv6. VideoLAN at LinuxTag 2012-05-21 We will presenting VLC and other VideoLAN projects at LinuxTag in Berlin this week (booth #167, hall 7.2a). Come around and have a look at our latest developments! Of course, we will also be present during LinuxNacht, in case that you prefer to share a beer with us. 1 billion thank you! 2012-05-09 VideoLAN would like to thank VLC users 1 billion times, since VLC has now been downloaded more than 1 billion times from our servers, since 2005! Get the numbers ! VLC 2.0.1 2012-03-19 After 15 million downloads of VLC 2.0.0 versions, VideoLAN and the VLC development team present the second version of "Twoflower", a bugfix release. Support for MxPEG files, new features in the Mac OS X interface are part of this release, in addition to faster decoding and fixes for hundred of bugs and regression, notably for HLS, MKV, RAR, Ogg, Bluray discs and many other things. This is also a security update . More info on the release notes . VLC 2.0.0 2012-02-18 After 485 million downloads of VLC 1.1.x versions, VideoLAN and the VLC development team present VLC 2.0.0 "Twoflower", a major new release. With faster decoding on multi-core, GPU, and mobile hardware and the ability to open more formats, notably professional, HD and 10bits codecs, 2.0 is a major upgrade for VLC. Twoflower has a new rendering pipeline for video, with higher quality subtitles, and new video filters to enhance your videos. It supports many new devices and BluRay Discs (experimental). It features a completely reworked Mac and Web interfaces and improvements in the other interfaces make VLC easier than ever to use. Twoflower fixes several hundreds of bugs, in more than 7000 commits from 160 volunteers. More info on the release notes . VideoLAN at SCALE 10x 2012-01-15 VideoLAN will have a booth (#74) at the Southern California Linux Expo at the Hilton Los Angeles Airport Hotel next week-end. The event will take place from Friday throughout Sunday. We will happily show you the latest developments and our forthcoming major VLC update. multicat 2.0 2012-01-04 VideoLAN is happy to announce the second major release of multicat . It brings numerous new features, such as recording chunks of a stream in a directory, and supporting TCP socket and IPv6, as well as bug fixes. Also aggregaRTP was extended to support retransmission of lost packets. DVBlast 2.1 2012-01-04 VideoLAN is happy to announce version 2.1 of DVBlast . It is a bugfix release, fixing in particular a problem with MMI menus present in 2.0. VLC engine relicensed to LGPL 2011-12-21 As previously stated , VideoLAN worked on the relicensing of libVLC and libVLCcore: the VLC engine. We are glad to announce that this process is now complete for VLC 1.2. Thanks a lot for the support. VLC 1.1.13 2011-12-20 VideoLAN and the VLC development team present VLC 1.1.13, a bug and security fix release. This release was necessary due to a security issue in the TiVo demuxer . Source code is available. DVBlast 2.0 and biTStream 1.0 2011-12-15 VideoLAN is happy to announce DVBlast 2.0, the fourth major release of DVBlast . It fixes a number of issues, such as packet bursts and CAM communication problems, adds more configuration options, and improves dvblastctl with stream information. It also gets rid of the runtime dependency on libdvbpsi thanks to biTStream. VideoLAN is also happy to introduce the first public release of biTStream , a set of C headers allowing a simpler access (read and write) to binary structures such as specified by MPEG, DVB, IETF, etc... It is released under the MIT license to avoid readability concerns being shadowed by license issues. It already has a pretty decent support of MPEG systems packet structures, MPEG PSI, DVB SI, DVB simulcast and IETF RTP. libaacs 0.3.0 2011-12-02 The doom9 researchers and the libaacs developers would like to present the first official release of their library of the implementation of the libaacs standard. libaacs 0.3.0 source code can be downloaded on the VideoLAN download service . Nota Bene: This library is of no use without AACS keys. libbluray 0.2.1 2011-11-30 VideoLAN and the libbluray developers would like to present the first official release of their library to help playback of Blu-Ray for open source systems. libbluray 0.2.1 source code can be downloaded on the VideoLAN ftp . VLC 1.1.12 2011-10-06 VideoLAN and the VLC development team present VLC 1.1.12, a bug and security fix release with improvements for audio output on Mac OS X and with PulseAudio. This release was necessary due to a security issue in the HTTP and RTSP server components, though this does not affect standard usage of the player. Binaries for Mac OS X and sources are available. Changing the VLC engine license to LGPL 2011-09-07 During the third VideoLAN Dev Days , last weekend in Paris, numerous developers approved the process of changing the license of the VLC engine to LGPL 2.1 (or later). This is the beginning of the process and will require the authorization from all the past contributors. See our press release on this process. libdvbpsi 0.2.1 2011-09-01 The libdvbpsi development team release version 0.2.1 of their library for decoding and encoding MPEG-TS PSI information commonly found in DVB and MPEG transport streams. The version 0.2.1 is a bugfix release which corrects minor issues in libdvbpsi. For more information on features visit libdvbpsi main page . Invitation to VDD11 2011-08-15 VideoLAN would like to invite you to join us at the VideoLAN Dev Days 2011. This technical conference about open source multimedia, will see developers from VLC, libav, FFmpeg, x264, Phonon, DVBlast, PulseAudio, KDE, Gnome and other projects gather to discuss about open source development for multimedia projects. It will be held in Paris, France, on September 3rd and 4th , 2011. See more info, on the dedicated page. VLC 1.1.11 2011-07-15 VideoLAN and the VLC development team present VLC 1.1.11, a security release with some other improvements. This release was necessary due to two security issues in the real and avi demuxers. It also contains improvements in the fullscreen mode of the Win32 mozilla plugin, the MacOSX Media Key handling and Auhal audio output as well as bug fixes in GUI, decoders and demuxers.. Source and binaries builds for Windows and Mac are available. VLC 1.1.10.1 2011-06-16 Shortly after VLC 1.1.10, VideoLAN and the VLC development team present version 1.1.10.1, which includes small fixes for the Mac OS X port such as disappearing repeat buttons and restored Freebox TV access. Additionally, the installation size was reduced by up to 30 MB. See the release notes for more information on the additional improvements included from VLC 1.1.10. VLC 1.1.10 2011-06-06 VideoLAN and the VLC development team present VLC 1.1.10, a minor release of the 1.1 branch. This release, 2 months after 1.1.9, was necessary because some security issues were found (see SA 1104 ), and the VLC development team cares about security. This release brings a rewritten pulseaudio output, an important number of small Mac OS X fixes, the removal of the font-cache building for the freetype module on Windows and updates of codecs. Source and binaries builds for Windows and Mac are available. See the release notes for more information on 1.1.10. libdvbpsi 0.2.0 2011-05-05 The libdvbpsi development team release version 0.2.0 of their library for decoding and encoding MPEG-TS PSI information commonly found in DVB and MPEG transport streams. The version 0.2.0 marks a license change from GPLv2 to LGPLv2.1 . For more information on features visit libdvbpsi main page . Phonon VLC 0.4.0 2011-04-27 VideoLAN would like to point out that the Phonon team has released Phonon VLC 0.4.0 . The new version of the best backend for the Qt multimedia library features much improved stability, more video features and control as well as completely redone streaming input capabilities. You can read more on Phonon VLC 0.4.0 in the release announcement ! VLC 1.1.9 2011-04-12 VideoLAN and the VLC development team present VLC 1.1.9, a minor release of the 1.1 branch. This release, not long after 1.1.8, was necessary because some security issues were found, and the VLC development team cares about security. This release also brings updated translations and a lot of small Mac OS X fixes. Source and binaries builds for Windows and Mac are available. See the release notes for more information on 1.1.9. libdvbcsa 1.1.0 is now out! 2011-04-03 libdvbcsa's new versions brings major speed improvements and optimizations of key schedules. It also fixes minor issues. You can get it now on our FTP or on the main libdvbcsa page! A new year of Google Summer of Code 2011-03-28 Instead of having a lousy student summer internship, why not working for VideoLAN and have an impact on millions of people world-wide? The Google Summer of Code program is starting soon and you should send your applications before April 8th 2011, 19:00 UTC, on the webapplication . You shouldn't wait for the last minute and we would like to remember that application can be modified afterwards and that you can submit multiple applications. Join the team now! VLC 1.1.8 and anti-virus software 2011-03-25 Yet again, broken anti-virus software flag the latest version of VLC on Windows as a malware. This is, once again, a false positive . As some of the anti-virus makers plainly refuse to fix their code, we recommend to our users to stop using Kaspersky , AVL , TheHacker or AVG . Users are advised to use the free Antivir or the new Microsoft Security Essential . Moreover , we advise users to download VLC only from videolan.org , as very numerous scam websites have appeared lately. VLC 1.1.8 2011-03-23 VideoLAN and the VLC development team present VLC 1.1.8, a minor release of the 1.1 branch. Small new features, many bugfixes, updated translations and security issues are making this release too. Notable improvements include updated look on Mac, new Dirac encoder, new VP8/Webm encoder, and numerous fixes in codecs, demuxers, interface, subtitles auto-detection, protocols and platform integration. Source and Windows and MacOSX builds are available. See the release notes for more information on 1.1.8. CeBit and 10 years of open source... 2011-02-28 The VideoLAN project and organization would like to thank everyone for the support during this month for our 10 years We'd like to invite you to meet us at the CeBIT , starting from tomorrow, in the open source lounge, Hall 2, Stand F44 . 10 years of open source for VideoLAN: end of 10 days... 2011-02-12 The VideoLAN project and organization continues to celebrate with the community the 10 th anniversary of open sourcing of all VideoLAN software. Day 6 showed a selection of extensions ; Day 7 detailed a few secret features ; Day 8 showed a few nice cones ; Day 9 detailed our committers and download numbers ; Day 10 showed of a showed a promotionnal video . Please join the celebration! 10 years of open source for VideoLAN: continued... 2011-02-07 The VideoLAN project and organization continues to celebrate with the community the 10 th anniversary of open sourcing of all VideoLAN software. Day 1 spoke about the early history of the project ; Day 2 spoke about the website design ; Day 3 showed a cool video ; Day 4 listed our preferred skins ; Day 5 showed of a photo of the team at the FOSDEM ; Day 6 (one day late) showed a selection of extensions . Please join the celebration! New website design 2011-02-02 As you might have seen, we've change the design of the main website . The website design was done by Argon and this project was sponsored by netzwelt.de . VLC 1.1.7 2011-02-01 VideoLAN and the VLC development team present VLC 1.1.7, a small security update on 1.1.6. Small new features, many bugfixes, updated translations and security issues were making the 1.1.6 release. Notable improvements include codecs, demuxers, Audio-CD support, subtitles, visualization and platform integration. Source and Windows and MacOSX builds are available. See the release notes for more information on 1.1.6. Source was available yesterday; binaries for Windows and Mac OS X are now available. 10 years of open source for VideoLAN 2011-02-01 The VideoLAN project and organization are proud to celebrate with the community the 10 th anniversary of open sourcing of all VideoLAN software, that happened exactly 10 years ago. To celebrate, small infos, stories and goodies will be posted in the next ten days on this site . Day 1 speaks about the early history of the project Please join the celebration! VLC 1.1.6 2011-01-23 VideoLAN and the VLC development team are proud to present VLC 1.1.6, the sixth bugfix release of the VLC 1.1.x branch. Small new features, many bugfixes, updated translations and security issues are making this release. Notable improvements include codecs, demuxers, Audio-CD support, subtitles, visualization and platform integration. Source and Windows and MacOSX builds are available. See the release notes for more information. NB: The first versions for Intel-based Macs (64bit and Universal Binary) included a rtsp streaming bug, which also hindered access to the Freebox. Please re-download. End of support for VLC 1.0 series 2011-01-22 The VideoLAN team ceases all form of support for VLC media player versions 1.0.x. Focusing maintenance efforts on the current VLC 1.1 versions, and further development on the upcoming VLC 1.2 series, the VideoLAN team will not deliver any further update for VLC versions 1.0.x (last release was 1.0.6), and VLC 0.9.x (last release was 0.9.10). VLC 1.1.6 will be released shortly. This release will introdu
2026-01-13T09:30:36
http://anh.cs.luc.edu/handsonPythonTutorial/ifstatements.html#even-list-exercise
3.1. If Statements — Hands-on Python Tutorial for Python 3 Navigation index next | previous | Hands-on Python Tutorial » 3. More On Flow of Control » 3.1. If Statements ¶ 3.1.1. Simple Conditions ¶ The statements introduced in this chapter will involve tests or conditions . More syntax for conditions will be introduced later, but for now consider simple arithmetic comparisons that directly translate from math into Python. Try each line separately in the Shell 2 < 5 3 > 7 x = 11 x > 10 2 * x < x type ( True ) You see that conditions are either True or False . These are the only possible Boolean values (named after 19th century mathematician George Boole). In Python the name Boolean is shortened to the type bool . It is the type of the results of true-false conditions or tests. Note The Boolean values True and False have no quotes around them! Just as '123' is a string and 123 without the quotes is not, 'True' is a string, not of type bool. 3.1.2. Simple if Statements ¶ Run this example program, suitcase.py. Try it at least twice, with inputs: 30 and then 55. As you an see, you get an extra result, depending on the input. The main code is: weight = float ( input ( "How many pounds does your suitcase weigh? " )) if weight > 50 : print ( "There is a $25 charge for luggage that heavy." ) print ( "Thank you for your business." ) The middle two line are an if statement. It reads pretty much like English. If it is true that the weight is greater than 50, then print the statement about an extra charge. If it is not true that the weight is greater than 50, then don’t do the indented part: skip printing the extra luggage charge. In any event, when you have finished with the if statement (whether it actually does anything or not), go on to the next statement that is not indented under the if . In this case that is the statement printing “Thank you”. The general Python syntax for a simple if statement is if condition : indentedStatementBlock If the condition is true, then do the indented statements. If the condition is not true, then skip the indented statements. Another fragment as an example: if balance < 0 : transfer = - balance # transfer enough from the backup account: backupAccount = backupAccount - transfer balance = balance + transfer As with other kinds of statements with a heading and an indented block, the block can have more than one statement. The assumption in the example above is that if an account goes negative, it is brought back to 0 by transferring money from a backup account in several steps. In the examples above the choice is between doing something (if the condition is True ) or nothing (if the condition is False ). Often there is a choice of two possibilities, only one of which will be done, depending on the truth of a condition. 3.1.3. if - else Statements ¶ Run the example program, clothes.py . Try it at least twice, with inputs 50 and then 80. As you can see, you get different results, depending on the input. The main code of clothes.py is: temperature = float ( input ( 'What is the temperature? ' )) if temperature > 70 : print ( 'Wear shorts.' ) else : print ( 'Wear long pants.' ) print ( 'Get some exercise outside.' ) The middle four lines are an if-else statement. Again it is close to English, though you might say “otherwise” instead of “else” (but else is shorter!). There are two indented blocks: One, like in the simple if statement, comes right after the if heading and is executed when the condition in the if heading is true. In the if - else form this is followed by an else: line, followed by another indented block that is only executed when the original condition is false . In an if - else statement exactly one of two possible indented blocks is executed. A line is also shown de dented next, removing indentation, about getting exercise. Since it is dedented, it is not a part of the if-else statement: Since its amount of indentation matches the if heading, it is always executed in the normal forward flow of statements, after the if - else statement (whichever block is selected). The general Python if - else syntax is if condition : indentedStatementBlockForTrueCondition else: indentedStatementBlockForFalseCondition These statement blocks can have any number of statements, and can include about any kind of statement. See Graduate Exercise 3.1.4. More Conditional Expressions ¶ All the usual arithmetic comparisons may be made, but many do not use standard mathematical symbolism, mostly for lack of proper keys on a standard keyboard. Meaning Math Symbol Python Symbols Less than < < Greater than > > Less than or equal ≤ <= Greater than or equal ≥ >= Equals = == Not equal ≠ != There should not be space between the two-symbol Python substitutes. Notice that the obvious choice for equals , a single equal sign, is not used to check for equality. An annoying second equal sign is required. This is because the single equal sign is already used for assignment in Python, so it is not available for tests. Warning It is a common error to use only one equal sign when you mean to test for equality, and not make an assignment! Tests for equality do not make an assignment, and they do not require a variable on the left. Any expressions can be tested for equality or inequality ( != ). They do not need to be numbers! Predict the results and try each line in the Shell : x = 5 x x == 5 x == 6 x x != 6 x = 6 6 == x 6 != x 'hi' == 'h' + 'i' 'HI' != 'hi' [ 1 , 2 ] != [ 2 , 1 ] An equality check does not make an assignment. Strings are case sensitive. Order matters in a list. Try in the Shell : 'a' > 5 When the comparison does not make sense, an Exception is caused. [1] Following up on the discussion of the inexactness of float arithmetic in String Formats for Float Precision , confirm that Python does not consider .1 + .2 to be equal to .3: Write a simple condition into the Shell to test. Here is another example: Pay with Overtime. Given a person’s work hours for the week and regular hourly wage, calculate the total pay for the week, taking into account overtime. Hours worked over 40 are overtime, paid at 1.5 times the normal rate. This is a natural place for a function enclosing the calculation. Read the setup for the function: def calcWeeklyWages ( totalHours , hourlyWage ): '''Return the total weekly wages for a worker working totalHours, with a given regular hourlyWage. Include overtime for hours over 40. ''' The problem clearly indicates two cases: when no more than 40 hours are worked or when more than 40 hours are worked. In case more than 40 hours are worked, it is convenient to introduce a variable overtimeHours. You are encouraged to think about a solution before going on and examining mine. You can try running my complete example program, wages.py, also shown below. The format operation at the end of the main function uses the floating point format ( String Formats for Float Precision ) to show two decimal places for the cents in the answer: def calcWeeklyWages ( totalHours , hourlyWage ): '''Return the total weekly wages for a worker working totalHours, with a given regular hourlyWage. Include overtime for hours over 40. ''' if totalHours <= 40 : totalWages = hourlyWage * totalHours else : overtime = totalHours - 40 totalWages = hourlyWage * 40 + ( 1.5 * hourlyWage ) * overtime return totalWages def main (): hours = float ( input ( 'Enter hours worked: ' )) wage = float ( input ( 'Enter dollars paid per hour: ' )) total = calcWeeklyWages ( hours , wage ) print ( 'Wages for {hours} hours at ${wage:.2f} per hour are ${total:.2f}.' . format ( ** locals ())) main () Here the input was intended to be numeric, but it could be decimal so the conversion from string was via float , not int . Below is an equivalent alternative version of the body of calcWeeklyWages , used in wages1.py . It uses just one general calculation formula and sets the parameters for the formula in the if statement. There are generally a number of ways you might solve the same problem! if totalHours <= 40 : regularHours = totalHours overtime = 0 else : overtime = totalHours - 40 regularHours = 40 return hourlyWage * regularHours + ( 1.5 * hourlyWage ) * overtime The in boolean operator : There are also Boolean operators that are applied to types others than numbers. A useful Boolean operator is in , checking membership in a sequence: >>> vals = [ 'this' , 'is' , 'it] >>> 'is' in vals True >>> 'was' in vals False It can also be used with not , as not in , to mean the opposite: >>> vals = [ 'this' , 'is' , 'it] >>> 'is' not in vals False >>> 'was' not in vals True In general the two versions are: item in sequence item not in sequence Detecting the need for if statements : Like with planning programs needing``for`` statements, you want to be able to translate English descriptions of problems that would naturally include if or if - else statements. What are some words or phrases or ideas that suggest the use of these statements? Think of your own and then compare to a few I gave: [2] 3.1.4.1. Graduate Exercise ¶ Write a program, graduate.py , that prompts students for how many credits they have. Print whether of not they have enough credits for graduation. (At Loyola University Chicago 120 credits are needed for graduation.) 3.1.4.2. Head or Tails Exercise ¶ Write a program headstails.py . It should include a function flip() , that simulates a single flip of a coin: It randomly prints either Heads or Tails . Accomplish this by choosing 0 or 1 arbitrarily with random.randrange(2) , and use an if - else statement to print Heads when the result is 0, and Tails otherwise. In your main program have a simple repeat loop that calls flip() 10 times to test it, so you generate a random sequence of 10 Heads and Tails . 3.1.4.3. Strange Function Exercise ¶ Save the example program jumpFuncStub.py as jumpFunc.py , and complete the definitions of functions jump and main as described in the function documentation strings in the program. In the jump function definition use an if - else statement (hint [3] ). In the main function definition use a for -each loop, the range function, and the jump function. The jump function is introduced for use in Strange Sequence Exercise , and others after that. 3.1.5. Multiple Tests and if - elif Statements ¶ Often you want to distinguish between more than two distinct cases, but conditions only have two possible results, True or False , so the only direct choice is between two options. As anyone who has played “20 Questions” knows, you can distinguish more cases by further questions. If there are more than two choices, a single test may only reduce the possibilities, but further tests can reduce the possibilities further and further. Since most any kind of statement can be placed in an indented statement block, one choice is a further if statement. For instance consider a function to convert a numerical grade to a letter grade, ‘A’, ‘B’, ‘C’, ‘D’ or ‘F’, where the cutoffs for ‘A’, ‘B’, ‘C’, and ‘D’ are 90, 80, 70, and 60 respectively. One way to write the function would be test for one grade at a time, and resolve all the remaining possibilities inside the next else clause: def letterGrade ( score ): if score >= 90 : letter = 'A' else : # grade must be B, C, D or F if score >= 80 : letter = 'B' else : # grade must be C, D or F if score >= 70 : letter = 'C' else : # grade must D or F if score >= 60 : letter = 'D' else : letter = 'F' return letter This repeatedly increasing indentation with an if statement as the else block can be annoying and distracting. A preferred alternative in this situation, that avoids all this indentation, is to combine each else and if block into an elif block: def letterGrade ( score ): if score >= 90 : letter = 'A' elif score >= 80 : letter = 'B' elif score >= 70 : letter = 'C' elif score >= 60 : letter = 'D' else : letter = 'F' return letter The most elaborate syntax for an if - elif - else statement is indicated in general below: if condition1 : indentedStatementBlockForTrueCondition1 elif condition2 : indentedStatementBlockForFirstTrueCondition2 elif condition3 : indentedStatementBlockForFirstTrueCondition3 elif condition4 : indentedStatementBlockForFirstTrueCondition4 else: indentedStatementBlockForEachConditionFalse The if , each elif , and the final else lines are all aligned. There can be any number of elif lines, each followed by an indented block. (Three happen to be illustrated above.) With this construction exactly one of the indented blocks is executed. It is the one corresponding to the first True condition, or, if all conditions are False , it is the block after the final else line. Be careful of the strange Python contraction. It is elif , not elseif . A program testing the letterGrade function is in example program grade1.py . See Grade Exercise . A final alternative for if statements: if - elif -.... with no else . This would mean changing the syntax for if - elif - else above so the final else: and the block after it would be omitted. It is similar to the basic if statement without an else , in that it is possible for no indented block to be executed. This happens if none of the conditions in the tests are true. With an else included, exactly one of the indented blocks is executed. Without an else , at most one of the indented blocks is executed. if weight > 120 : print ( 'Sorry, we can not take a suitcase that heavy.' ) elif weight > 50 : print ( 'There is a $25 charge for luggage that heavy.' ) This if - elif statement only prints a line if there is a problem with the weight of the suitcase. 3.1.5.1. Sign Exercise ¶ Write a program sign.py to ask the user for a number. Print out which category the number is in: 'positive' , 'negative' , or 'zero' . 3.1.5.2. Grade Exercise ¶ In Idle, load grade1.py and save it as grade2.py Modify grade2.py so it has an equivalent version of the letterGrade function that tests in the opposite order, first for F, then D, C, .... Hint: How many tests do you need to do? [4] Be sure to run your new version and test with different inputs that test all the different paths through the program. Be careful to test around cut-off points. What does a grade of 79.6 imply? What about exactly 80? 3.1.5.3. Wages Exercise ¶ * Modify the wages.py or the wages1.py example to create a program wages2.py that assumes people are paid double time for hours over 60. Hence they get paid for at most 20 hours overtime at 1.5 times the normal rate. For example, a person working 65 hours with a regular wage of $10 per hour would work at $10 per hour for 40 hours, at 1.5 * $10 for 20 hours of overtime, and 2 * $10 for 5 hours of double time, for a total of 10*40 + 1.5*10*20 + 2*10*5 = $800. You may find wages1.py easier to adapt than wages.py . Be sure to test all paths through the program! Your program is likely to be a modification of a program where some choices worked before, but once you change things, retest for all the cases! Changes can mess up things that worked before. 3.1.6. Nesting Control-Flow Statements ¶ The power of a language like Python comes largely from the variety of ways basic statements can be combined . In particular, for and if statements can be nested inside each other’s indented blocks. For example, suppose you want to print only the positive numbers from an arbitrary list of numbers in a function with the following heading. Read the pieces for now. def printAllPositive ( numberList ): '''Print only the positive numbers in numberList.''' For example, suppose numberList is [3, -5, 2, -1, 0, 7] . You want to process a list, so that suggests a for -each loop, for num in numberList : but a for -each loop runs the same code body for each element of the list, and we only want print ( num ) for some of them. That seems like a major obstacle, but think closer at what needs to happen concretely. As a human, who has eyes of amazing capacity, you are drawn immediately to the actual correct numbers, 3, 2, and 7, but clearly a computer doing this systematically will have to check every number. In fact, there is a consistent action required: Every number must be tested to see if it should be printed. This suggests an if statement, with the condition num > 0 . Try loading into Idle and running the example program onlyPositive.py , whose code is shown below. It ends with a line testing the function: def printAllPositive ( numberList ): '''Print only the positive numbers in numberList.''' for num in numberList : if num > 0 : print ( num ) printAllPositive ([ 3 , - 5 , 2 , - 1 , 0 , 7 ]) This idea of nesting if statements enormously expands the possibilities with loops. Now different things can be done at different times in loops, as long as there is a consistent test to allow a choice between the alternatives. Shortly, while loops will also be introduced, and you will see if statements nested inside of them, too. The rest of this section deals with graphical examples. Run example program bounce1.py . It has a red ball moving and bouncing obliquely off the edges. If you watch several times, you should see that it starts from random locations. Also you can repeat the program from the Shell prompt after you have run the script. For instance, right after running the program, try in the Shell bounceBall ( - 3 , 1 ) The parameters give the amount the shape moves in each animation step. You can try other values in the Shell , preferably with magnitudes less than 10. For the remainder of the description of this example, read the extracted text pieces. The animations before this were totally scripted, saying exactly how many moves in which direction, but in this case the direction of motion changes with every bounce. The program has a graphic object shape and the central animation step is shape . move ( dx , dy ) but in this case, dx and dy have to change when the ball gets to a boundary. For instance, imagine the ball getting to the left side as it is moving to the left and up. The bounce obviously alters the horizontal part of the motion, in fact reversing it, but the ball would still continue up. The reversal of the horizontal part of the motion means that the horizontal shift changes direction and therefore its sign: dx = - dx but dy does not need to change. This switch does not happen at each animation step, but only when the ball reaches the edge of the window. It happens only some of the time - suggesting an if statement. Still the condition must be determined. Suppose the center of the ball has coordinates (x, y). When x reaches some particular x coordinate, call it xLow, the ball should bounce. The edge of the window is at coordinate 0, but xLow should not be 0, or the ball would be half way off the screen before bouncing! For the edge of the ball to hit the edge of the screen, the x coordinate of the center must be the length of the radius away, so actually xLow is the radius of the ball. Animation goes quickly in small steps, so I cheat. I allow the ball to take one (small, quick) step past where it really should go ( xLow ), and then we reverse it so it comes back to where it belongs. In particular if x < xLow : dx = - dx There are similar bounding variables xHigh , yLow and yHigh , all the radius away from the actual edge coordinates, and similar conditions to test for a bounce off each possible edge. Note that whichever edge is hit, one coordinate, either dx or dy, reverses. One way the collection of tests could be written is if x < xLow : dx = - dx if x > xHigh : dx = - dx if y < yLow : dy = - dy if y > yHigh : dy = - dy This approach would cause there to be some extra testing: If it is true that x < xLow , then it is impossible for it to be true that x > xHigh , so we do not need both tests together. We avoid unnecessary tests with an elif clause (for both x and y): if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy Note that the middle if is not changed to an elif , because it is possible for the ball to reach a corner , and need both dx and dy reversed. The program also uses several methods to read part of the state of graphics objects that we have not used in examples yet. Various graphics objects, like the circle we are using as the shape, know their center point, and it can be accessed with the getCenter() method. (Actually a clone of the point is returned.) Also each coordinate of a Point can be accessed with the getX() and getY() methods. This explains the new features in the central function defined for bouncing around in a box, bounceInBox . The animation arbitrarily goes on in a simple repeat loop for 600 steps. (A later example will improve this behavior.) def bounceInBox ( shape , dx , dy , xLow , xHigh , yLow , yHigh ): ''' Animate a shape moving in jumps (dx, dy), bouncing when its center reaches the low and high x and y coordinates. ''' delay = . 005 for i in range ( 600 ): shape . move ( dx , dy ) center = shape . getCenter () x = center . getX () y = center . getY () if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy time . sleep ( delay ) The program starts the ball from an arbitrary point inside the allowable rectangular bounds. This is encapsulated in a utility function included in the program, getRandomPoint . The getRandomPoint function uses the randrange function from the module random . Note that in parameters for both the functions range and randrange , the end stated is past the last value actually desired: def getRandomPoint ( xLow , xHigh , yLow , yHigh ): '''Return a random Point with coordinates in the range specified.''' x = random . randrange ( xLow , xHigh + 1 ) y = random . randrange ( yLow , yHigh + 1 ) return Point ( x , y ) The full program is listed below, repeating bounceInBox and getRandomPoint for completeness. Several parts that may be useful later, or are easiest to follow as a unit, are separated out as functions. Make sure you see how it all hangs together or ask questions! ''' Show a ball bouncing off the sides of the window. ''' from graphics import * import time , random def bounceInBox ( shape , dx , dy , xLow , xHigh , yLow , yHigh ): ''' Animate a shape moving in jumps (dx, dy), bouncing when its center reaches the low and high x and y coordinates. ''' delay = . 005 for i in range ( 600 ): shape . move ( dx , dy ) center = shape . getCenter () x = center . getX () y = center . getY () if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy time . sleep ( delay ) def getRandomPoint ( xLow , xHigh , yLow , yHigh ): '''Return a random Point with coordinates in the range specified.''' x = random . randrange ( xLow , xHigh + 1 ) y = random . randrange ( yLow , yHigh + 1 ) return Point ( x , y ) def makeDisk ( center , radius , win ): '''return a red disk that is drawn in win with given center and radius.''' disk = Circle ( center , radius ) disk . setOutline ( "red" ) disk . setFill ( "red" ) disk . draw ( win ) return disk def bounceBall ( dx , dy ): '''Make a ball bounce around the screen, initially moving by (dx, dy) at each jump.''' win = GraphWin ( 'Ball Bounce' , 290 , 290 ) win . yUp () radius = 10 xLow = radius # center is separated from the wall by the radius at a bounce xHigh = win . getWidth () - radius yLow = radius yHigh = win . getHeight () - radius center = getRandomPoint ( xLow , xHigh , yLow , yHigh ) ball = makeDisk ( center , radius , win ) bounceInBox ( ball , dx , dy , xLow , xHigh , yLow , yHigh ) win . close () bounceBall ( 3 , 5 ) 3.1.6.1. Short String Exercise ¶ Write a program short.py with a function printShort with heading: def printShort ( strings ): '''Given a list of strings, print the ones with at most three characters. >>> printShort(['a', 'long', one']) a one ''' In your main program, test the function, calling it several times with different lists of strings. Hint: Find the length of each string with the len function. The function documentation here models a common approach: illustrating the behavior of the function with a Python Shell interaction. This part begins with a line starting with >>> . Other exercises and examples will also document behavior in the Shell. 3.1.6.2. Even Print Exercise ¶ Write a program even1.py with a function printEven with heading: def printEven ( nums ): '''Given a list of integers nums, print the even ones. >>> printEven([4, 1, 3, 2, 7]) 4 2 ''' In your main program, test the function, calling it several times with different lists of integers. Hint: A number is even if its remainder, when dividing by 2, is 0. 3.1.6.3. Even List Exercise ¶ Write a program even2.py with a function chooseEven with heading: def chooseEven ( nums ): '''Given a list of integers, nums, return a list containing only the even ones. >>> chooseEven([4, 1, 3, 2, 7]) [4, 2] ''' In your main program, test the function, calling it several times with different lists of integers and printing the results in the main program. (The documentation string illustrates the function call in the Python shell, where the return value is automatically printed. Remember, that in a program, you only print what you explicitly say to print.) Hint: In the function, create a new list, and append the appropriate numbers to it, before returning the result. 3.1.6.4. Unique List Exercise ¶ * The madlib2.py program has its getKeys function, which first generates a list of each occurrence of a cue in the story format. This gives the cues in order, but likely includes repetitions. The original version of getKeys uses a quick method to remove duplicates, forming a set from the list. There is a disadvantage in the conversion, though: Sets are not ordered, so when you iterate through the resulting set, the order of the cues will likely bear no resemblance to the order they first appeared in the list. That issue motivates this problem: Copy madlib2.py to madlib2a.py , and add a function with this heading: def uniqueList ( aList ): ''' Return a new list that includes the first occurrence of each value in aList, and omits later repeats. The returned list should include the first occurrences of values in aList in their original order. >>> vals = ['cat', 'dog', 'cat', 'bug', 'dog', 'ant', 'dog', 'bug'] >>> uniqueList(vals) ['cat', 'dog', 'bug', 'ant'] ''' Hint: Process aList in order. Use the in syntax to only append elements to a new list that are not already in the new list. After perfecting the uniqueList function, replace the last line of getKeys , so it uses uniqueList to remove duplicates in keyList . Check that your madlib2a.py prompts you for cue values in the order that the cues first appear in the madlib format string. 3.1.7. Compound Boolean Expressions ¶ To be eligible to graduate from Loyola University Chicago, you must have 120 credits and a GPA of at least 2.0. This translates directly into Python as a compound condition : credits >= 120 and GPA >= 2.0 This is true if both credits >= 120 is true and GPA >= 2.0 is true. A short example program using this would be: credits = float ( input ( 'How many units of credit do you have? ' )) GPA = float ( input ( 'What is your GPA? ' )) if credits >= 120 and GPA >= 2.0 : print ( 'You are eligible to graduate!' ) else : print ( 'You are not
2026-01-13T09:30:36
https://bifromq.apache.org/docs/2.1.x/category/plugin/
Plugin | An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) Skip to main content Apache BifroMQ (Incubating) Docs Community Download FAQ 2.1.x Next (Incubating) 3.3.x 3.2.x 3.1.x 3.0.x 2.1.x 2.0.0 1.0.x ASF Foundation License Events Privacy Security Sponsorship Thanks Code of Conduct BifroMQ Introduction Get Started Install & Deploy Configuration User Guide Plugin Overview Auth Provider Event Collector Setting Provider BifroMQ Plugin Practice and Notice Operations Best Practices FAQ MQTT Test Report BifroMQ Inside This is documentation for An Open Source Apache MQTT Broker | Apache BifroMQ (Incubating) 2.1.x , which is no longer actively maintained. For up-to-date documentation, see the latest version ( Next (Incubating) ). Plugin Version: 2.1.x Plugin BifroMQ Plugin. 📄️ Overview BifroMQ's plugin mechanism allows users to integrate custom business logic with BifroMQ at runtime. Currently, BifroMQ defines 3 types of Plugin interfaces, catering to different use cases: 📄️ Auth Provider The Auth Provider plugin is designed to provide BifroMQ runtime with the capability to authenticate MQTT client connections and authorize Pub/Sub message topics. The interface for the plugin is defined in the following Maven module: 📄️ Event Collector The Event Collector Plugin is designed to gather various events generated during the execution of BifroMQ. By filtering through event types, you can focus on the events that matter to you, enabling the implementation of various business logic such as usage statistics, monitoring, alerts, etc. The Plugin's interface is defined in the following Maven module: 📄️ Setting Provider BifroMQ defines a category of settings (Setting) that can be modified at runtime, allowing for dynamic adjustment of BifroMQ's service behavior per tenant. The purpose of the Setting Provider Plugin is to supply custom values for these settings at runtime. The Plugin's interface is defined in the following Maven module: 📄️ BifroMQ Plugin Practice and Notice BifroMQ is a powerful messaging system that allows seamless communication between itself and customized services. Previous API Service Next Overview Apache BifroMQ is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.
2026-01-13T09:30:36
https://pastebin.com/contact
Pastebin.com - Contact Us Pastebin API tools faq paste Login Sign up Contact Us Please email all your questions to [email protected] (DO NOT EMAIL ADMIN FOR CONTENT REMOVAL REQUESTS, read part below) How can I report bad content? To report possible malicious activity and/or violation of our T&Cs please use the 'REPORT ABUSE' button above each paste, this requires a Pastebin account, or you may send an email to [email protected] The following steps are important: 1. Please indicate who you are, why the item is abusive and also include the direct link to the item(s) you want removed . 2. Make sure you write to us in english , otherwise we might ignore your email. DMCA Requests Send the infringement notice via this DMCA REQUEST form . Public Pastes Untitled 8 min ago | 0.94 KB Untitled 18 min ago | 0.94 KB Untitled 28 min ago | 0.94 KB Untitled 39 min ago | 0.94 KB Untitled 49 min ago | 0.94 KB Untitled 59 min ago | 0.94 KB Untitled 1 hour ago | 10.19 KB Untitled 3 hours ago | 13.48 KB create new paste  /  syntax languages  /  archive  /  faq  /  tools  /  night mode  /  api  /  scraping api  /  news  /  pro privacy statement  /  cookies policy  /  terms of service  /  security disclosure  /  dmca  /  report abuse  /  contact By using Pastebin.com you agree to our cookies policy to enhance your experience. Site design & logo © 2026 Pastebin We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy .   OK, I Understand Not a member of Pastebin yet? Sign Up , it unlocks many cool features!  
2026-01-13T09:30:36
https://www.frontendinterviewhandbook.com/ja-JP/front-end-system-design/ui-components
Front End System Design Interview - User Interface Components | The Official Front End Interview Handbook 2025 メインコンテンツまでスキップ We are now part of GreatFrontEnd , a front end interview preparation platform created by ex-Meta and Google Engineers. Get 20% off today ! Front End Interview Handbook Start reading Practice Coding Questions System Design Quiz Questions System design Blog 日本語 English 简体中文 Español 日本語 한국어 Polski Português Русский Tagalog বাংলা 検索 Introduction Coding interview JavaScript coding User interface coding Algorithms coding Quiz/trivia interview System design interview Overview User interface components Applications Behavorial interviews Resume preparation Interview questions 🔥 Amazon interview questions Google interview questions Microsoft interview questions Meta interview questions Airbnb interview questions ByteDance/TikTok interview questions Atlassian interview questions Uber interview questions Apple interview questions Canva interview questions Dropbox interview questions LinkedIn interview questions Lyft interview questions Twitter interview questions Shopify interview questions Pinterest interview questions Reddit interview questions Adobe interview questions Palantir interview questions Salesforce interview questions Oracle interview questions System design interview User interface components このページの見出し Front End System Design Interview - User Interface Components Latest version on GreatFrontEnd Find the latest version of this page on GreatFrontEnd's Front End System Design Questions . Examples ​ Autocomplete (Free) Image carousel (Paid) Dropdown menu (Paid) Modal dialog (Paid) Rich text editor (Paid) Poll widget (Paid) Tooltip To find out more, check out GreatFrontEnd , which shows you how to approach front end system design interviews with their Front End System Design Playbook and case studies. There are also blog posts that will cover some of the following topics in more detail. Framework ​ In system design interviews, candidates are supposed to lead the conversation. Here's a framework you can use to give an outline to the interviewer as to what you are going to cover (not necessarily in that order). The framework is called RADIO and it is made up of the first character of each aspect. R equirements exploration : Understand the problem thoroughly and determine the scope by asking a number of clarifying questions. A rchitecture / High-level design : Identify the key components of the product and how they are related to each other. D ata model : Describe the various data entities, the fields they contain and which component(s) they belong to. I nterface definition (API) : Define the interface (API) between components in the product, functionality of each API, their parameters and responses. O ptimizations and deep dive : Discuss about possible optimization opportunities and specific areas of interest when building the product. You can write this structure down on the whiteboard/online editor so that you don't forget. Requirements exploration ​ Every system design interview (even for non-front end as well) should start with requirements gathering/clarifying requirements about the question, which is usually left underspecified on purpose. You are recommended to spend at least a few minutes clarifying the requirements. Do not start drawing the architecture before you are clear about the requirements! Thankfully, components have well-defined scope and not try to do too many things. You likely have used such a component yourself and possibly know what you need from such a component. Some considerations: What devices should the system support? Desktop web, mobile web, etc What's the primary device that users will access the system on? Which browsers should we support? Do we need to support internationalization? How much styling customization do we want to allow? Architecture / High-level design ​ Architecture for front end interviews are typically focused on the client-side architecture, and not on large scale distributed systems where databases, load balancers and servers are involved. For components, list down the various subcomponents that will exist within it and what data is being passed among each component. Let's take an image carousel example. Subcomponents within an image carousel would be: Main image : An image that displays the photo in focus Thumbnail : Smaller images below the (Will there be thumbnails? You will only know if you clarified requirements earlier) Image store : A client side cache of the list of photos to display If you have a whiteboard/online drawing tool, it would also be helpful to draw diagrams to illustrate the entities and their relationships. Which subcomponent communicates with which when a user interaction occurs. Data model ​ Data model for components will refer to the component state. The concept of state should be familiar to most front end developers who have used front end UI libraries/frameworks such as React, Angular, Vue, Svelte, etc. In every of these libraries/frameworks, state is a common concept. Deciding what data to put in state is essential to doing well for this portion. Few factors to consider when deciding what goes into component state: State is allowed to change over time during the lifecycle of the component, typically as a result of user interactions. Each component should maintain its own independent state which allows multiple instances of the component to coexist on a single page. The state of a component instance should not affect the state of another instance. Components are easier to reason about (read/understand) the fewer the fields there are in the state. We should strive to reduce the amount of state needed. If a component uses a value which can be derived from another piece of state, then that value should most likely not be part of the state. For example if your component is rendering a list of items and you want to display a message when there are no items to render, there shouldn't be an additional isEmpty state because it can be derived from the length of the items . If a component has multiple subcomponents, it'll be best if it's possible to consolidate the state within the top level and the rest of the components are pure and stateless. Interface definition (API) ​ The key idea behind components is for them to be reused and abstract complexities. Good components are designed in a way that they can be reused in multiple scenarios, and users do not have to know how they work internally before using them. In the case of components, API refers to configuration options that the component developer would expose to other developers for specification. What are the configuration options you would allow for the component? ( props in React). What would be reasonable defaults? Follow the Open-closed principle - the component should be open for extension but closed for modification. If your component is meant to be part of a UI library that doesn't bother about the appearance and leaves the styling to the user, extra care has to go into the design of the props and to allow users to customize the look and feel of the components. There are a few ways to go about this in React: Composition - Props which accept React components which also promotes code reuse. Render props are function props that a component uses to know what to render. It also helps in reusing behavior without bothering about the appearance. className or style props - Allows users to inject class names and/or styling attributes to inner DOM elements. This could have negative consequences but is still a common way of allowing user to customize component appearance. Possible configuration options: Lifecycle/event hooks - onClick , onChange , onBlur , onFocus , etc. Optimization and deep dives ​ With the basics of the component covered, we can now delve into specific areas that may require special attention. It is important to note that due to time constraints, it may not be possible to cover every area, and not all areas may be highly relevant to the specific component at hand. Showing knowledge about these areas and being able to dive deep into them are traits of senior front end engineers. User experience (UX) ​ UX might not fall squarely under engineering but good front end engineers have good understanding of UX and building UI with great UX. There are too many UX practices to be aware of, but the most common ones/low hanging fruits are: Reflect state of the component to the user - If there's a pending background request, show a spinner. If there's an error, make sure to display it instead of silently failing. Display an empty state if there are no items in a list, instead of not rendering anything. Destructive actions should have a confirmation step, especially irreversible ones. Disable interactive elements if they trigger an async request! Prevents double firing of events in the case of accidental double clicking (possible for people with motor disabilities). If there are search inputs involved, each keystroke should not fire a network request. Handle extreme cases Strings can be really long/short and your UI should not look weird in either case. For long strings, they can have their contents truncated and hidden behind a "View more" button. If there are many items to display within a component, they shouldn't all be displayed on the screen at once and making the page extremely long/wide. Paginate the items or contain them within a container with a maximum width/height. Keyboard friendliness - This involves making sure the component is keyboard-friendly Add shortcuts to make the component more usable by keyboard-only users Ensure that elements can be focused and tab order within the component is correct Accessibility is part of UX but will be covered in a later section Performance ​ In front end, performance typically refers to a few things - loading speed, how fast the UI responds to user interactions, memory space (heap) required by the component. Loading speed : The less JavaScript the component contains, the less JavaScript the browser has to download to load the component and the lower the network request time. It's also important to modularize components and allow users to download only the necessary JavaScript modules needed for their use case. Responsiveness to user interactions If a user interaction results in displaying of data that has to be loaded over the network, there will be a delay between the user interaction and updating of the UI. Minimizing that delay or removing it entirely is the key to improving responsiveness. JavaScript in a browser is single-threaded. The browser can only do execute one line of code at any one time. The less work (JavaScript executed, DOM updates) the component has to do when a user does something on the page, the faster the component can update the UI to respond to the changes. Memory space : The more memory your component takes up on the page, the slower the browser performs and the experience will feel sluggish/janky. If your component has to render hundreds/thousands of items (e.g. number of images in a carousel, number of items in a selector), memory space might become significant. Optimization tips Render only what is displayed on the screen : For example, in a selector, only a few items are displayed to the user even if the list can contain hundreds of elements. Rendering all of them into the browser would be a waste of processing power and memory space. We can leverage a technique called windowing/virtualization to emulate a list with many elements while only rendering a few as possible to make the final result look as if there was no optimization done (especially preserving scroll height). Read more about virtualization here . Lazy loading/load only necessary data : For example, in a photo gallery component, a user can have hundreds and thousands of photos, but it won't be feasible to load all of them eagerly. Most likely the user won't be browsing all of them in that session too. An optimization could be to load only the ones that the user is likely to view, or those that are within the viewport (which we call "above the fold"). The rest of the photos can be loaded on demand, which introduces responsiveness delay, but the next tip will help you to handle that. Preloading/prefetching data ahead of time : For example, in an image carousel where there are too many images to load beforehand, an optimization could be to load the next image ahead of time while the user is still on the current image, such that when the user clicks the "Next" button, there's no network delay needed because the next image has already been loaded. This technique can also be modified to load the next N images to handle the case where users click "Next" in rapid succession. Accessibility (a11y) ​ Accessibility (a11y) is the practice of making your websites usable by as many people as possible. Color contrasts (e.g. color blindness) Keyboard friendliness (e.g. people with limited fine motor control) Visual Impairment (e.g. blind) Transcripts for audio (e.g. deaf) Not everyone surfs the web the same way; some people use screenreaders and keyboards exclusively (no mouse)! Here are some basic tips for achieving a11y in UI components: Foreground colors should have sufficient contrast from the background colors Use the right HTML tags for semanticness, or the right aria-role attributes Clickable items should have tabindex attribute (so that they are focusable) and also "cursor: pointer" styling to indicate that they can be clicked on Images should have alt text, which will be read out by screen readers and act as a fallback description if the image fails to load aria-label s help to provide context to elements which are non-obvious to non-visual users. E.g. an icon button without any text label within it should have an aria-label attribute so that the intention is clear for users who can't see the icon a11y is one of the most commonly neglected areas as most of the time they're invisible to the developer. Showing knowledge of a11y and possessing the skills to create accessible components will definitely reflect well on you. More reading on Web Accessibility . Internationalization (i18n) ​ Internationalization (i18n) is the design and development of a product, application or document content that enables easy localization for target audiences that vary in culture, region, or language. Typically components shouldn't have to worry about i18n unless under few specific circumstances: Component uses strings : Strings used in the component shouldn't be hardcoded to a specific language (e.g. "Prev"/"Next" in the controls of a photo gallery component). The strings can be specified as a prop with the English version as default Order of content matters : Does your component support RTL (right to left) languages like Arabic and Hebrew? Multi-device support ​ Is the component expected to be used on mobile web? Mobile devices have unique constraints - they have less powerful hardware and viewport size is smaller. Hence things could be done differently to allow the component to work better on mobile devices - making a conscious effort to: Not use too much memory - using too much memory makes the device perform slower Increasing the hit box of interactive elements - fingers have an easier time tapping on the right element Security ​ Most of the time, components aren't exposed to security vulnerabilities, but it can still happen. Here are the more common security vulnerabilities you should be aware of: XSS - Is your component vulnerable to cross-site scripting (XSS)? E.g. Do you render user input via .innerHTML or dangerouslySetInnerHTML (React-specific)? CSRF (Cross-Site Request Forgery) Clickjacking rel=noopener このページを編集 2025年11月30日 に Danielle Ford が 最終更新 前へ Overview 次へ Applications Table of Contents Examples Framework Requirements exploration Architecture / High-level design Data model Interface definition (API) Optimization and deep dives General Get started Trivia questions Company questions Blog Coding Algorithms JavaScript utility functions User interfaces System design System design overview User interface components Applications More GreatFrontEnd GitHub X Discord Contact us Tech Interview Handbook Copyright © 2025 Yangshun Tay and GreatFrontEnd
2026-01-13T09:30:36
http://anh.cs.luc.edu/handsonPythonTutorial/ifstatements.html#id12
3.1. If Statements — Hands-on Python Tutorial for Python 3 Navigation index next | previous | Hands-on Python Tutorial » 3. More On Flow of Control » 3.1. If Statements ¶ 3.1.1. Simple Conditions ¶ The statements introduced in this chapter will involve tests or conditions . More syntax for conditions will be introduced later, but for now consider simple arithmetic comparisons that directly translate from math into Python. Try each line separately in the Shell 2 < 5 3 > 7 x = 11 x > 10 2 * x < x type ( True ) You see that conditions are either True or False . These are the only possible Boolean values (named after 19th century mathematician George Boole). In Python the name Boolean is shortened to the type bool . It is the type of the results of true-false conditions or tests. Note The Boolean values True and False have no quotes around them! Just as '123' is a string and 123 without the quotes is not, 'True' is a string, not of type bool. 3.1.2. Simple if Statements ¶ Run this example program, suitcase.py. Try it at least twice, with inputs: 30 and then 55. As you an see, you get an extra result, depending on the input. The main code is: weight = float ( input ( "How many pounds does your suitcase weigh? " )) if weight > 50 : print ( "There is a $25 charge for luggage that heavy." ) print ( "Thank you for your business." ) The middle two line are an if statement. It reads pretty much like English. If it is true that the weight is greater than 50, then print the statement about an extra charge. If it is not true that the weight is greater than 50, then don’t do the indented part: skip printing the extra luggage charge. In any event, when you have finished with the if statement (whether it actually does anything or not), go on to the next statement that is not indented under the if . In this case that is the statement printing “Thank you”. The general Python syntax for a simple if statement is if condition : indentedStatementBlock If the condition is true, then do the indented statements. If the condition is not true, then skip the indented statements. Another fragment as an example: if balance < 0 : transfer = - balance # transfer enough from the backup account: backupAccount = backupAccount - transfer balance = balance + transfer As with other kinds of statements with a heading and an indented block, the block can have more than one statement. The assumption in the example above is that if an account goes negative, it is brought back to 0 by transferring money from a backup account in several steps. In the examples above the choice is between doing something (if the condition is True ) or nothing (if the condition is False ). Often there is a choice of two possibilities, only one of which will be done, depending on the truth of a condition. 3.1.3. if - else Statements ¶ Run the example program, clothes.py . Try it at least twice, with inputs 50 and then 80. As you can see, you get different results, depending on the input. The main code of clothes.py is: temperature = float ( input ( 'What is the temperature? ' )) if temperature > 70 : print ( 'Wear shorts.' ) else : print ( 'Wear long pants.' ) print ( 'Get some exercise outside.' ) The middle four lines are an if-else statement. Again it is close to English, though you might say “otherwise” instead of “else” (but else is shorter!). There are two indented blocks: One, like in the simple if statement, comes right after the if heading and is executed when the condition in the if heading is true. In the if - else form this is followed by an else: line, followed by another indented block that is only executed when the original condition is false . In an if - else statement exactly one of two possible indented blocks is executed. A line is also shown de dented next, removing indentation, about getting exercise. Since it is dedented, it is not a part of the if-else statement: Since its amount of indentation matches the if heading, it is always executed in the normal forward flow of statements, after the if - else statement (whichever block is selected). The general Python if - else syntax is if condition : indentedStatementBlockForTrueCondition else: indentedStatementBlockForFalseCondition These statement blocks can have any number of statements, and can include about any kind of statement. See Graduate Exercise 3.1.4. More Conditional Expressions ¶ All the usual arithmetic comparisons may be made, but many do not use standard mathematical symbolism, mostly for lack of proper keys on a standard keyboard. Meaning Math Symbol Python Symbols Less than < < Greater than > > Less than or equal ≤ <= Greater than or equal ≥ >= Equals = == Not equal ≠ != There should not be space between the two-symbol Python substitutes. Notice that the obvious choice for equals , a single equal sign, is not used to check for equality. An annoying second equal sign is required. This is because the single equal sign is already used for assignment in Python, so it is not available for tests. Warning It is a common error to use only one equal sign when you mean to test for equality, and not make an assignment! Tests for equality do not make an assignment, and they do not require a variable on the left. Any expressions can be tested for equality or inequality ( != ). They do not need to be numbers! Predict the results and try each line in the Shell : x = 5 x x == 5 x == 6 x x != 6 x = 6 6 == x 6 != x 'hi' == 'h' + 'i' 'HI' != 'hi' [ 1 , 2 ] != [ 2 , 1 ] An equality check does not make an assignment. Strings are case sensitive. Order matters in a list. Try in the Shell : 'a' > 5 When the comparison does not make sense, an Exception is caused. [1] Following up on the discussion of the inexactness of float arithmetic in String Formats for Float Precision , confirm that Python does not consider .1 + .2 to be equal to .3: Write a simple condition into the Shell to test. Here is another example: Pay with Overtime. Given a person’s work hours for the week and regular hourly wage, calculate the total pay for the week, taking into account overtime. Hours worked over 40 are overtime, paid at 1.5 times the normal rate. This is a natural place for a function enclosing the calculation. Read the setup for the function: def calcWeeklyWages ( totalHours , hourlyWage ): '''Return the total weekly wages for a worker working totalHours, with a given regular hourlyWage. Include overtime for hours over 40. ''' The problem clearly indicates two cases: when no more than 40 hours are worked or when more than 40 hours are worked. In case more than 40 hours are worked, it is convenient to introduce a variable overtimeHours. You are encouraged to think about a solution before going on and examining mine. You can try running my complete example program, wages.py, also shown below. The format operation at the end of the main function uses the floating point format ( String Formats for Float Precision ) to show two decimal places for the cents in the answer: def calcWeeklyWages ( totalHours , hourlyWage ): '''Return the total weekly wages for a worker working totalHours, with a given regular hourlyWage. Include overtime for hours over 40. ''' if totalHours <= 40 : totalWages = hourlyWage * totalHours else : overtime = totalHours - 40 totalWages = hourlyWage * 40 + ( 1.5 * hourlyWage ) * overtime return totalWages def main (): hours = float ( input ( 'Enter hours worked: ' )) wage = float ( input ( 'Enter dollars paid per hour: ' )) total = calcWeeklyWages ( hours , wage ) print ( 'Wages for {hours} hours at ${wage:.2f} per hour are ${total:.2f}.' . format ( ** locals ())) main () Here the input was intended to be numeric, but it could be decimal so the conversion from string was via float , not int . Below is an equivalent alternative version of the body of calcWeeklyWages , used in wages1.py . It uses just one general calculation formula and sets the parameters for the formula in the if statement. There are generally a number of ways you might solve the same problem! if totalHours <= 40 : regularHours = totalHours overtime = 0 else : overtime = totalHours - 40 regularHours = 40 return hourlyWage * regularHours + ( 1.5 * hourlyWage ) * overtime The in boolean operator : There are also Boolean operators that are applied to types others than numbers. A useful Boolean operator is in , checking membership in a sequence: >>> vals = [ 'this' , 'is' , 'it] >>> 'is' in vals True >>> 'was' in vals False It can also be used with not , as not in , to mean the opposite: >>> vals = [ 'this' , 'is' , 'it] >>> 'is' not in vals False >>> 'was' not in vals True In general the two versions are: item in sequence item not in sequence Detecting the need for if statements : Like with planning programs needing``for`` statements, you want to be able to translate English descriptions of problems that would naturally include if or if - else statements. What are some words or phrases or ideas that suggest the use of these statements? Think of your own and then compare to a few I gave: [2] 3.1.4.1. Graduate Exercise ¶ Write a program, graduate.py , that prompts students for how many credits they have. Print whether of not they have enough credits for graduation. (At Loyola University Chicago 120 credits are needed for graduation.) 3.1.4.2. Head or Tails Exercise ¶ Write a program headstails.py . It should include a function flip() , that simulates a single flip of a coin: It randomly prints either Heads or Tails . Accomplish this by choosing 0 or 1 arbitrarily with random.randrange(2) , and use an if - else statement to print Heads when the result is 0, and Tails otherwise. In your main program have a simple repeat loop that calls flip() 10 times to test it, so you generate a random sequence of 10 Heads and Tails . 3.1.4.3. Strange Function Exercise ¶ Save the example program jumpFuncStub.py as jumpFunc.py , and complete the definitions of functions jump and main as described in the function documentation strings in the program. In the jump function definition use an if - else statement (hint [3] ). In the main function definition use a for -each loop, the range function, and the jump function. The jump function is introduced for use in Strange Sequence Exercise , and others after that. 3.1.5. Multiple Tests and if - elif Statements ¶ Often you want to distinguish between more than two distinct cases, but conditions only have two possible results, True or False , so the only direct choice is between two options. As anyone who has played “20 Questions” knows, you can distinguish more cases by further questions. If there are more than two choices, a single test may only reduce the possibilities, but further tests can reduce the possibilities further and further. Since most any kind of statement can be placed in an indented statement block, one choice is a further if statement. For instance consider a function to convert a numerical grade to a letter grade, ‘A’, ‘B’, ‘C’, ‘D’ or ‘F’, where the cutoffs for ‘A’, ‘B’, ‘C’, and ‘D’ are 90, 80, 70, and 60 respectively. One way to write the function would be test for one grade at a time, and resolve all the remaining possibilities inside the next else clause: def letterGrade ( score ): if score >= 90 : letter = 'A' else : # grade must be B, C, D or F if score >= 80 : letter = 'B' else : # grade must be C, D or F if score >= 70 : letter = 'C' else : # grade must D or F if score >= 60 : letter = 'D' else : letter = 'F' return letter This repeatedly increasing indentation with an if statement as the else block can be annoying and distracting. A preferred alternative in this situation, that avoids all this indentation, is to combine each else and if block into an elif block: def letterGrade ( score ): if score >= 90 : letter = 'A' elif score >= 80 : letter = 'B' elif score >= 70 : letter = 'C' elif score >= 60 : letter = 'D' else : letter = 'F' return letter The most elaborate syntax for an if - elif - else statement is indicated in general below: if condition1 : indentedStatementBlockForTrueCondition1 elif condition2 : indentedStatementBlockForFirstTrueCondition2 elif condition3 : indentedStatementBlockForFirstTrueCondition3 elif condition4 : indentedStatementBlockForFirstTrueCondition4 else: indentedStatementBlockForEachConditionFalse The if , each elif , and the final else lines are all aligned. There can be any number of elif lines, each followed by an indented block. (Three happen to be illustrated above.) With this construction exactly one of the indented blocks is executed. It is the one corresponding to the first True condition, or, if all conditions are False , it is the block after the final else line. Be careful of the strange Python contraction. It is elif , not elseif . A program testing the letterGrade function is in example program grade1.py . See Grade Exercise . A final alternative for if statements: if - elif -.... with no else . This would mean changing the syntax for if - elif - else above so the final else: and the block after it would be omitted. It is similar to the basic if statement without an else , in that it is possible for no indented block to be executed. This happens if none of the conditions in the tests are true. With an else included, exactly one of the indented blocks is executed. Without an else , at most one of the indented blocks is executed. if weight > 120 : print ( 'Sorry, we can not take a suitcase that heavy.' ) elif weight > 50 : print ( 'There is a $25 charge for luggage that heavy.' ) This if - elif statement only prints a line if there is a problem with the weight of the suitcase. 3.1.5.1. Sign Exercise ¶ Write a program sign.py to ask the user for a number. Print out which category the number is in: 'positive' , 'negative' , or 'zero' . 3.1.5.2. Grade Exercise ¶ In Idle, load grade1.py and save it as grade2.py Modify grade2.py so it has an equivalent version of the letterGrade function that tests in the opposite order, first for F, then D, C, .... Hint: How many tests do you need to do? [4] Be sure to run your new version and test with different inputs that test all the different paths through the program. Be careful to test around cut-off points. What does a grade of 79.6 imply? What about exactly 80? 3.1.5.3. Wages Exercise ¶ * Modify the wages.py or the wages1.py example to create a program wages2.py that assumes people are paid double time for hours over 60. Hence they get paid for at most 20 hours overtime at 1.5 times the normal rate. For example, a person working 65 hours with a regular wage of $10 per hour would work at $10 per hour for 40 hours, at 1.5 * $10 for 20 hours of overtime, and 2 * $10 for 5 hours of double time, for a total of 10*40 + 1.5*10*20 + 2*10*5 = $800. You may find wages1.py easier to adapt than wages.py . Be sure to test all paths through the program! Your program is likely to be a modification of a program where some choices worked before, but once you change things, retest for all the cases! Changes can mess up things that worked before. 3.1.6. Nesting Control-Flow Statements ¶ The power of a language like Python comes largely from the variety of ways basic statements can be combined . In particular, for and if statements can be nested inside each other’s indented blocks. For example, suppose you want to print only the positive numbers from an arbitrary list of numbers in a function with the following heading. Read the pieces for now. def printAllPositive ( numberList ): '''Print only the positive numbers in numberList.''' For example, suppose numberList is [3, -5, 2, -1, 0, 7] . You want to process a list, so that suggests a for -each loop, for num in numberList : but a for -each loop runs the same code body for each element of the list, and we only want print ( num ) for some of them. That seems like a major obstacle, but think closer at what needs to happen concretely. As a human, who has eyes of amazing capacity, you are drawn immediately to the actual correct numbers, 3, 2, and 7, but clearly a computer doing this systematically will have to check every number. In fact, there is a consistent action required: Every number must be tested to see if it should be printed. This suggests an if statement, with the condition num > 0 . Try loading into Idle and running the example program onlyPositive.py , whose code is shown below. It ends with a line testing the function: def printAllPositive ( numberList ): '''Print only the positive numbers in numberList.''' for num in numberList : if num > 0 : print ( num ) printAllPositive ([ 3 , - 5 , 2 , - 1 , 0 , 7 ]) This idea of nesting if statements enormously expands the possibilities with loops. Now different things can be done at different times in loops, as long as there is a consistent test to allow a choice between the alternatives. Shortly, while loops will also be introduced, and you will see if statements nested inside of them, too. The rest of this section deals with graphical examples. Run example program bounce1.py . It has a red ball moving and bouncing obliquely off the edges. If you watch several times, you should see that it starts from random locations. Also you can repeat the program from the Shell prompt after you have run the script. For instance, right after running the program, try in the Shell bounceBall ( - 3 , 1 ) The parameters give the amount the shape moves in each animation step. You can try other values in the Shell , preferably with magnitudes less than 10. For the remainder of the description of this example, read the extracted text pieces. The animations before this were totally scripted, saying exactly how many moves in which direction, but in this case the direction of motion changes with every bounce. The program has a graphic object shape and the central animation step is shape . move ( dx , dy ) but in this case, dx and dy have to change when the ball gets to a boundary. For instance, imagine the ball getting to the left side as it is moving to the left and up. The bounce obviously alters the horizontal part of the motion, in fact reversing it, but the ball would still continue up. The reversal of the horizontal part of the motion means that the horizontal shift changes direction and therefore its sign: dx = - dx but dy does not need to change. This switch does not happen at each animation step, but only when the ball reaches the edge of the window. It happens only some of the time - suggesting an if statement. Still the condition must be determined. Suppose the center of the ball has coordinates (x, y). When x reaches some particular x coordinate, call it xLow, the ball should bounce. The edge of the window is at coordinate 0, but xLow should not be 0, or the ball would be half way off the screen before bouncing! For the edge of the ball to hit the edge of the screen, the x coordinate of the center must be the length of the radius away, so actually xLow is the radius of the ball. Animation goes quickly in small steps, so I cheat. I allow the ball to take one (small, quick) step past where it really should go ( xLow ), and then we reverse it so it comes back to where it belongs. In particular if x < xLow : dx = - dx There are similar bounding variables xHigh , yLow and yHigh , all the radius away from the actual edge coordinates, and similar conditions to test for a bounce off each possible edge. Note that whichever edge is hit, one coordinate, either dx or dy, reverses. One way the collection of tests could be written is if x < xLow : dx = - dx if x > xHigh : dx = - dx if y < yLow : dy = - dy if y > yHigh : dy = - dy This approach would cause there to be some extra testing: If it is true that x < xLow , then it is impossible for it to be true that x > xHigh , so we do not need both tests together. We avoid unnecessary tests with an elif clause (for both x and y): if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy Note that the middle if is not changed to an elif , because it is possible for the ball to reach a corner , and need both dx and dy reversed. The program also uses several methods to read part of the state of graphics objects that we have not used in examples yet. Various graphics objects, like the circle we are using as the shape, know their center point, and it can be accessed with the getCenter() method. (Actually a clone of the point is returned.) Also each coordinate of a Point can be accessed with the getX() and getY() methods. This explains the new features in the central function defined for bouncing around in a box, bounceInBox . The animation arbitrarily goes on in a simple repeat loop for 600 steps. (A later example will improve this behavior.) def bounceInBox ( shape , dx , dy , xLow , xHigh , yLow , yHigh ): ''' Animate a shape moving in jumps (dx, dy), bouncing when its center reaches the low and high x and y coordinates. ''' delay = . 005 for i in range ( 600 ): shape . move ( dx , dy ) center = shape . getCenter () x = center . getX () y = center . getY () if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy time . sleep ( delay ) The program starts the ball from an arbitrary point inside the allowable rectangular bounds. This is encapsulated in a utility function included in the program, getRandomPoint . The getRandomPoint function uses the randrange function from the module random . Note that in parameters for both the functions range and randrange , the end stated is past the last value actually desired: def getRandomPoint ( xLow , xHigh , yLow , yHigh ): '''Return a random Point with coordinates in the range specified.''' x = random . randrange ( xLow , xHigh + 1 ) y = random . randrange ( yLow , yHigh + 1 ) return Point ( x , y ) The full program is listed below, repeating bounceInBox and getRandomPoint for completeness. Several parts that may be useful later, or are easiest to follow as a unit, are separated out as functions. Make sure you see how it all hangs together or ask questions! ''' Show a ball bouncing off the sides of the window. ''' from graphics import * import time , random def bounceInBox ( shape , dx , dy , xLow , xHigh , yLow , yHigh ): ''' Animate a shape moving in jumps (dx, dy), bouncing when its center reaches the low and high x and y coordinates. ''' delay = . 005 for i in range ( 600 ): shape . move ( dx , dy ) center = shape . getCenter () x = center . getX () y = center . getY () if x < xLow : dx = - dx elif x > xHigh : dx = - dx if y < yLow : dy = - dy elif y > yHigh : dy = - dy time . sleep ( delay ) def getRandomPoint ( xLow , xHigh , yLow , yHigh ): '''Return a random Point with coordinates in the range specified.''' x = random . randrange ( xLow , xHigh + 1 ) y = random . randrange ( yLow , yHigh + 1 ) return Point ( x , y ) def makeDisk ( center , radius , win ): '''return a red disk that is drawn in win with given center and radius.''' disk = Circle ( center , radius ) disk . setOutline ( "red" ) disk . setFill ( "red" ) disk . draw ( win ) return disk def bounceBall ( dx , dy ): '''Make a ball bounce around the screen, initially moving by (dx, dy) at each jump.''' win = GraphWin ( 'Ball Bounce' , 290 , 290 ) win . yUp () radius = 10 xLow = radius # center is separated from the wall by the radius at a bounce xHigh = win . getWidth () - radius yLow = radius yHigh = win . getHeight () - radius center = getRandomPoint ( xLow , xHigh , yLow , yHigh ) ball = makeDisk ( center , radius , win ) bounceInBox ( ball , dx , dy , xLow , xHigh , yLow , yHigh ) win . close () bounceBall ( 3 , 5 ) 3.1.6.1. Short String Exercise ¶ Write a program short.py with a function printShort with heading: def printShort ( strings ): '''Given a list of strings, print the ones with at most three characters. >>> printShort(['a', 'long', one']) a one ''' In your main program, test the function, calling it several times with different lists of strings. Hint: Find the length of each string with the len function. The function documentation here models a common approach: illustrating the behavior of the function with a Python Shell interaction. This part begins with a line starting with >>> . Other exercises and examples will also document behavior in the Shell. 3.1.6.2. Even Print Exercise ¶ Write a program even1.py with a function printEven with heading: def printEven ( nums ): '''Given a list of integers nums, print the even ones. >>> printEven([4, 1, 3, 2, 7]) 4 2 ''' In your main program, test the function, calling it several times with different lists of integers. Hint: A number is even if its remainder, when dividing by 2, is 0. 3.1.6.3. Even List Exercise ¶ Write a program even2.py with a function chooseEven with heading: def chooseEven ( nums ): '''Given a list of integers, nums, return a list containing only the even ones. >>> chooseEven([4, 1, 3, 2, 7]) [4, 2] ''' In your main program, test the function, calling it several times with different lists of integers and printing the results in the main program. (The documentation string illustrates the function call in the Python shell, where the return value is automatically printed. Remember, that in a program, you only print what you explicitly say to print.) Hint: In the function, create a new list, and append the appropriate numbers to it, before returning the result. 3.1.6.4. Unique List Exercise ¶ * The madlib2.py program has its getKeys function, which first generates a list of each occurrence of a cue in the story format. This gives the cues in order, but likely includes repetitions. The original version of getKeys uses a quick method to remove duplicates, forming a set from the list. There is a disadvantage in the conversion, though: Sets are not ordered, so when you iterate through the resulting set, the order of the cues will likely bear no resemblance to the order they first appeared in the list. That issue motivates this problem: Copy madlib2.py to madlib2a.py , and add a function with this heading: def uniqueList ( aList ): ''' Return a new list that includes the first occurrence of each value in aList, and omits later repeats. The returned list should include the first occurrences of values in aList in their original order. >>> vals = ['cat', 'dog', 'cat', 'bug', 'dog', 'ant', 'dog', 'bug'] >>> uniqueList(vals) ['cat', 'dog', 'bug', 'ant'] ''' Hint: Process aList in order. Use the in syntax to only append elements to a new list that are not already in the new list. After perfecting the uniqueList function, replace the last line of getKeys , so it uses uniqueList to remove duplicates in keyList . Check that your madlib2a.py prompts you for cue values in the order that the cues first appear in the madlib format string. 3.1.7. Compound Boolean Expressions ¶ To be eligible to graduate from Loyola University Chicago, you must have 120 credits and a GPA of at least 2.0. This translates directly into Python as a compound condition : credits >= 120 and GPA >= 2.0 This is true if both credits >= 120 is true and GPA >= 2.0 is true. A short example program using this would be: credits = float ( input ( 'How many units of credit do you have? ' )) GPA = float ( input ( 'What is your GPA? ' )) if credits >= 120 and GPA >= 2.0 : print ( 'You are eligible to graduate!' ) else : print ( 'You are not eligible to graduate.' ) The new Python syntax is for the operator and : condition1 and condition2 The compound condition is true if both of the component conditions are true. It is false if at least one of the conditions is false. See Congress Exercise . In the last example in the previous section, there was an if - elif statement where both tests had the same block to be done if the condition was true: if x < xLow : dx = - dx elif x > xHigh : dx = - dx There is a simpler way to state this in a sentence: If x < xLow or x > xHigh, switch the sign of dx. That translates directly into Python: if x < xLow or x > xHigh : dx = - dx The word or makes another compound condition: condition1 or condition2 is true if at least one of the conditions is true. It is false if both conditions are false. This corresponds to one way the word “or” is used in English. Other times in English “or” is used to mean exactly one alternative is true. Warning When translating a problem stated in English using “or”, be careful to determine whether the meaning matches Python’s or . It is often convenient to encapsulate complicated tests inside a function. Think how to complete the function starting: def isInside ( rect , point ): '''Return True if the point is inside the Rectangle rect.''' pt1 = rect . getP1 () pt2 = rect . getP2 () Recall that a Rectangle is specified in its constructor by two diagonally oppose Point s. This example gives the first use in the tutorials of the Rectangle methods that recover those two corner points, getP1 and getP2 . The program calls the points obtained this way pt1 and pt2 . The x and y coordinates of pt1 , pt2 , and point can be recovered with the methods of the Point type, getX() and getY() . Suppose that I introduce variables for the x coordinates of pt1 , point , and pt2 , calling these x-coordinates end1 , val , and end2 , respectively. On first try you might decide that the needed mathematical relationship to test is end1 <= val <= end2 Unfortunately, this is not enough: The only requirement for the two corner points is that they be diagonally opposite, not that the coordinates of the second point are higher than the corresponding coordinates of the first point. It could be that end1 is 200; end2 is 100, and val is 120. In this latter case val is between end1 and end2 , but substituting into the expression above 200 <= 120 <= 100 is False. The 100 and 200 need to be reversed in this case. This makes a complicated situation. Also this is an issue which must be revisited for both the x and y coordinates. I introduce an auxiliary function isBetween to deal with one coordinate at a time. It starts: def isBetween ( val , end1 , end2 ): '''Return True if val is between the ends. The ends do not need to be in increasing order.''' Clearly this is true if the original expression, end1 <= val <= end2 , is true. You must also consider the possible case when the order of the ends is reversed: end2 <= val <= end1 . How do we combine these two possibilities? The Boolean connectives to consider are and and or . Which applies? You only need one to be true, so or is the proper connective: A correct but redundant function body would be: if end1 <= val <= end2 or end2 <= val <= end1 : return True else : return False Check the meaning: if the compound expression is True , return True . If the condition is False , return False – in either case return the same value as the test condition. See that a much simpler and neater version is to just return the value of the condition itself! return end1 <= val <= end2 or end2 <= val <= end1 Note In general you should not need an if - else statement to choose between true and false values! Operate directly on the boolean expression. A side comment on expressions like end1 <= val <= end2 Other than the two-character operators, this is like standard math syntax, chaining comparisons. In Python any number of comparisons can be chained in this way, closely approximating mathematical notation. Though this is good Python, be aware that if you try other high-level languages like Java and C++, such an expression is gibberish. Another way the expression can be expressed (and which translates directly to other languages) is: end1 <= val and val <= end2 So much for the auxiliary function isBetween . Back to the isInside function. You can use the isBetween function to check the x coordinates, isBetween ( point . getX (), p1 . getX (), p2 . getX ()) and to check the y coordinates, isBetween ( point . getY (), p1 . getY (), p2 . getY ()) Again the question arises: how do you combine the two tests? In this case we need the point to be both between the sides and between the top and bottom, so the proper connector is and . Think how to finish the isInside method. Hint: [5] Sometimes you want to test the opposite of a condition. As in English you can use the word not . For instance, to test if a Point was not inside Rectangle Rect, you could use the condition not isInside ( rect , point ) In general, not condition is True when condition is False , and False when condition is True . The example program chooseButton1.py , shown below, is a complete program using the isInside function in a simple application, choosing colors. Pardon the length. Do check it out. It will be the starting point for a number of improvements that shorten it and make it more powerful in the next section. First a brief overview: The program includes the functions isBetween and isInside that have already been discussed. The program creates a number of colored rectangles to use as buttons and also as picture components. Aside from specific data values, the code to create each rectangle is the same, so the action is encapsulated in a function, makeColoredRect . All of this is fine, and will be preserved in later versions. The present main function is long, though. It has the usual graphics starting code, draws buttons and picture elements, and then has a number of code sections prompting the user to choose a color for a picture element. Each code section has a long if - elif - else test to see which button was clicked, and sets the color of the picture element appropriately. '''Make a choice of colors via mouse clicks in Rectangles -- A demonstration of Boolean operators and Boolean functions.''' from graphics import * def isBetween ( x , end1 , end2 ): '''Return True if x is between the ends or equal to either. The ends do not need to be in increasing order.''' return end1 <= x <= end2 or end2 <= x <= end1 def isInside ( point , rect ): '''Return True if the point is inside the Rectangle rect.''' pt1 = rect . getP1 () pt2 = rect . getP2 () return isBetween ( point . getX (), pt1 . getX (), pt2 . getX ()) and \ isBetween ( point . getY (), pt1 . getY (), pt2 . getY ()) def makeColoredRect ( corner , width , height , color , win ): ''' Return a Rectangle drawn in win with the upper left corner and color specified.''' corner2 = corner . clone () corner2 . move ( width , - height ) rect = Rectangle ( corner , corner2 ) rect . setFill ( color ) rect . draw ( win ) return rect def main (): win = GraphWin ( 'pick Colors' , 400 , 400 ) win . yUp () # right side up coordinates redButton = makeColoredRect ( Point ( 310 , 350 ), 80 , 30 , 'red' , win ) yellowButton = makeColoredRect ( Point ( 310 , 310 ), 80 , 30 , 'yellow' , win ) blueButton = makeColoredRect ( Point ( 310 , 270 ), 80 , 30 , 'blue' , win ) house = makeColoredRect ( Point ( 60 , 200 ), 180 , 150 , 'gray' , win ) door = makeColoredRect ( Point ( 90 , 150 ), 40 , 100 , 'white' , win ) roof = Polygon ( Point ( 50 , 200 ), Point ( 250 , 200 ), Point ( 150 , 300 )) roof . setFill ( 'black' ) roof . draw ( win ) msg = Text ( Point ( win . getWidth () / 2 , 375 ), 'Click to choose a house color.' ) msg . draw ( win ) pt = win . getMouse () if isInside ( pt , redButton ): color = 'red' elif isInside ( pt , yellowButton ): color = 'yellow' elif isInside ( pt , blueButton ): color = 'blue' else : color = 'white' house . setFill ( color ) msg . setText ( 'Click to choose a door color.' ) pt = win . getMouse () if isInside ( pt , redButton ): color = 'red' elif isInside ( pt , yellowButton ): color = 'yellow' elif isInside ( pt , blueButton ): color = 'blue' else : color = 'white' door . setFill ( color ) win . promptClose ( msg ) main () The only further new feature used is in the long return statement in isInside . return isBetween ( point . getX (), pt1 . getX (), pt2 . getX ()) and \ isBetween ( point . getY (), pt1 . getY (), pt2 . getY ()) Recall that Python is smart enough to realize that a statement continues to the next line if there is an unmatched pair of parentheses or brackets. Above is another situation with a long statement, but there are no unmatched parentheses on a line. For readability it is best not to make an enormous long line that would run off your screen or paper. Continuing to the next line is recommended. You can make the final character on a line be a backslash ( '\\' ) to indicate the statement continues on the next line. This is not particularly neat, but it is a rather rare situation. Most statements fit neatly on one line, and the creator of Python decided it was best to make the syntax simple in the most common situation. (Many other languages require a special
2026-01-13T09:30:36
https://vml.visma.ai/#statistics
Visma Machine Learning - Automate your processes About us Who are we? Learn more about Visma Machine Learning What we do Learn more about the products we offer What our customers say Read our customers' testimonials Products Autosuggest Automate your workflow Smartscan Extract data from your documents Resources Blog Product news and showcases Showcase of prototypes Prototypes, ideas and experiments Support Get started Find out more about onboarding to Visma Machine Learning FAQ We have answers to your frequently asked questions. Privacy policy Learn how we handle your data and protect your privacy Cookie policy Learn about how we use cookies to enhance your experience API Documentation Contact Us About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Showcase of prototypes Support Get started FAQ Privacy policy Cookie policy API Documentation Loading... Gærtorvet 1-5 1799 Copenhagen Denmark E-mail: worksmarter@visma.com About us Who are we? What we do What our customers say Products Autosuggest Smartscan Resources Blog Prototypes Documentation Support Get started FAQ Privacy policy Cookie policy Security Information Operating Status © 2026 Visma Group. All rights reserved Transforming the way people work Visma Machine Learning dramatically reduces the time spent on routine tasks, and lets our customers focus on the important things. Our products save people many hours of data entry into accounting systems which directly translates into cost savings for companies and helps them to become paperless. Contact us Try out Smartscan Let our numbers speak for us 0 + thousand companies use our ML 0 + million documents scanned per month 0 + million API requests per day 30+ SaaS products powered by our machine learning APIs We simplify and automate accounting workflows Data entry is one of the big time sinks in business processes. With Smartscan we're eliminating most of this work for document handling. With AutoSuggest we're dramatically simplifying the decisions you need to make in the accounting workflow. Leading machine learning solutions Industry leading OCR and Data Capture API for scanning and extracting information from invoices and receipts. Learn more The process toolkit for your workflows and tasks. Simple-to-use prediction engine for scanned invoices and bank transactions. Learn more Minimise the time spent processing documents and doing manual work Easy setup We make machine learning as simple as possible - available through simple JSON APIs. Best in class AI We use state of the art techniques to offer the best coverage on the market. Blazingly fast Our speed is a point of pride. Document scans complete in 1-2 seconds. Faster than most document AI APIs. See what our customers have to say Great Service For any new Dinero customers the machine learning predictions will work right away, and it will be magical. Our customers love it! Alexander Jasper Lead AI Engineer, Dinero Intuitive Implementation The implementation was a breeze thanks to your documentation. Marco Hokke Software Developer, Visma Raet Efficient Performance If we want to increase our customers automation level, that is where ML Assets become extremely important. Oliver Storm-Pallesen Product Line Manager, e-conomic Questions? Are you using a Visma product but you are missing Autosuggest or Smartscan capabilities? Talk to your sales contact, if you have one, and ask for Autosuggest or Smartscan. Email us at worksmarter@visma.com to let us know which product you have and we'll get things rolling. Contact us
2026-01-13T09:30:36
https://l.facebook.com/l.php?u=https%3A%2F%2Fwww.instagram.com%2F&h=AT06bb-u6vzZgQi1VKBlRo1vZ93-R-9OYeN3GXeUv-jvs-dYHfArKAZFoZit-1ucEFb1NENNccGPARtQY-bzLzHpYvYvEVJwleQnzL0-k_nn7XVFOv42wEp6oRlz7a6xh73_DZhecwMQ-iAx
Facebook Facebook 이메일 또는 휴대폰 비밀번호 계정을 잊으셨나요? 새 계정 만들기 일시적으로 차단됨 일시적으로 차단됨 회원님의 이 기능 사용 속도가 너무 빠른 것 같습니다. 이 기능 사용에서 일시적으로 차단되었습니다. Back 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) 日本語 Português (Brasil) Français (France) Deutsch 가입하기 로그인 Messenger Facebook Lite 동영상 Meta Pay Meta 스토어 Meta Quest Ray-Ban Meta Meta AI Meta AI 콘텐츠 더 보기 Instagram Threads 투표 정보 센터 개인정보처리방침 개인정보 보호 센터 정보 광고 만들기 페이지 만들기 개발자 채용 정보 쿠키 AdChoices 이용 약관 고객 센터 연락처 업로드 및 비사용자 설정 활동 로그 Meta © 2026
2026-01-13T09:30:36