S3 Lifecycle policy for emptying bucket
aws s3api put-bucket-lifecycle-configuration --bucket $BUCKET --region $REGION --lifecycle-configuration file://lifecycle.json
S3 Lifecycle policy for emptying bucket
aws s3api put-bucket-lifecycle-configuration --bucket $BUCKET --region $REGION --lifecycle-configuration file://lifecycle.json
| -- Requires the `redis-cell` module to be installed in Redis: https://github.com/brandur/redis-cell | |
| local redis = require "nginx.redis" | |
| local red = redis:new() | |
| red:set_timeout(1000) | |
| local ok, err = red:connect("127.0.0.1", 6379) | |
| if not ok then | |
| ngx.log(ngx.ERR, "failed to connect to redis: ", err) | |
| ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) |
| Resources: | |
| RateLimitACL: | |
| Type: AWS::WAFv2::WebACL | |
| Properties: | |
| Name: rate-limit-acl | |
| Scope: REGIONAL | |
| Description: Auto-generated rate-limiting ACL. | |
| DefaultAction: | |
| Allow: {} | |
| VisibilityConfig: |
| Resources: | |
| RateLimitACL: | |
| Type: AWS::WAFv2::WebACL | |
| Properties: | |
| Name: rate-limit-acl | |
| Scope: REGIONAL | |
| Description: Auto-generated rate-limiting ACL. | |
| DefaultAction: | |
| Allow: {} | |
| VisibilityConfig: |
| Resources: | |
| RateLimitACL: | |
| Type: AWS::WAFv2::WebACL | |
| Properties: | |
| Name: rate-limit-acl | |
| Scope: REGIONAL | |
| Description: Auto-generated rate-limiting ACL. | |
| DefaultAction: | |
| Allow: {} | |
| VisibilityConfig: |
| #!/bin/bash | |
| name=$RANDOM | |
| url='http://localhost:9093/api/v1/alerts' | |
| echo "firing up alert $name" | |
| # change url o | |
| curl -XPOST $url -d "[{ | |
| \"status\": \"firing\", |
| @NonCPS | |
| def cancelPreviousBuilds() { | |
| def jobName = env.JOB_NAME | |
| def buildNumber = env.BUILD_NUMBER.toInteger() | |
| /* Get job name */ | |
| def currentJob = Jenkins.instance.getItemByFullName(jobName) | |
| /* Iterating over the builds for specific job */ | |
| for (def build : currentJob.builds) { | |
| def exec = build.getExecutor() |
| import time | |
| class Bucket(object): | |
| def __init__(self, max_amount, refill_time, refill_amount): | |
| self.max_amount = max_amount | |
| self.refill_time = refill_time | |
| self.refill_amount = refill_amount | |
| self.reset() | |
| def _refill_count(self): |