Skip to content

Commit 439b296

Browse files
authored
Merge branch 'main' into update-transcribe
2 parents 64fa5ad + 8f1411d commit 439b296

File tree

219 files changed

+4980
-2094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+4980
-2094
lines changed

.doc_gen/metadata/bedrock-agent-runtime_metadata.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,24 @@ bedrock-agent-runtime_InvokeFlow:
3232
- javascriptv3/example_code/bedrock-agent-runtime/actions/invoke-flow.js
3333
services:
3434
bedrock-agent-runtime: {InvokeFlow}
35+
36+
bedrock-agent-runtime_Scenario_ConverseWithFlow:
37+
title: Converse with an &BRlong; flow
38+
synopsis: use InvokeFlow to converse with an &BRlong; flow that includes an agent node.
39+
category: Basics
40+
guide_topic:
41+
title: Converse with an &BRlong; flow
42+
url: bedrock/latest/userguide/flows-multi-turn-invocation.html
43+
languages:
44+
Python:
45+
versions:
46+
- sdk_version: 3
47+
github: python/example_code/bedrock-agent-runtime
48+
sdkguide:
49+
excerpts:
50+
- description:
51+
snippet_tags:
52+
- python.example_code.bedrock-agent-runtime.flow_conversation.complete
53+
54+
services:
55+
bedrock-agent-runtime: {InvokeFlow}

.doc_gen/metadata/s3-control_metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ s3-control_CreateJob:
3333
- description: Create a legal hold off job.
3434
snippet_tags:
3535
- s3control.java2.create_job.compliance.main
36-
- description: Create a new governance retemtion job.
36+
- description: Create a new governance retention job.
3737
snippet_tags:
3838
- s3.java2.create_governance_retemtion.main
3939
services:

.doc_gen/validation.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ allow_list:
211211
- "src/main/java/com/example/acm/DeleteCert"
212212
- "src/main/java/com/example/acm/ImportCert"
213213
- "EnablePropagateAdditionalUserContextData"
214+
- "StopQueryWorkloadInsightsTopContributors"
214215
sample_files:
215216
- "README.md"
216217
- "chat_sfn_state_machine.json"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on: # yamllint disable-line rule:truthy
2+
pull_request_review:
3+
types: submitted
4+
5+
jobs:
6+
approved_pr:
7+
name: Automerge approved PRs
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
id-token: write
12+
if: ${{ github.event.review.state == 'approved' && github.repository == 'awsdocs/aws-doc-sdk-examples' && (github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER' || github.event.review.user.login == 'aws-sdk-osds') }}
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Configure AWS credentials
16+
uses: aws-actions/configure-aws-credentials@v4
17+
with:
18+
aws-region: us-west-2
19+
role-to-assume: arn:aws:iam::206735643321:role/ConfigureAwsCredentialsPackageRole
20+
role-duration-seconds: 900
21+
role-session-name: SecretsManagerFetch
22+
- name: Get bot user token
23+
uses: aws-actions/aws-secretsmanager-get-secrets@v2
24+
with:
25+
parse-json-secrets: true
26+
secret-ids: |
27+
OSDS,arn:aws:secretsmanager:us-west-2:206735643321:secret:github-aws-sdk-osds-automation-gebs9n
28+
- name: Enable PR automerge
29+
run: gh pr merge --auto --squash "$PR_URL"
30+
env:
31+
PR_URL: ${{ github.event.pull_request.html_url }}
32+
GITHUB_TOKEN: ${{ env.OSDS_ACCESS_TOKEN }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Dependabot auto-approve
2+
on: pull_request # yamllint disable-line rule:truthy
3+
permissions:
4+
pull-requests: write
5+
id-token: write
6+
jobs:
7+
dependabot:
8+
runs-on: ubuntu-latest
9+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'awsdocs/aws-doc-sdk-examples' }}
10+
steps:
11+
- name: Get Metadata
12+
id: dependabot-metadata
13+
uses: dependabot/fetch-metadata@v2
14+
- uses: actions/checkout@v4
15+
name: Clone repo
16+
- name: Configure AWS credentials
17+
uses: aws-actions/configure-aws-credentials@v4
18+
with:
19+
aws-region: us-west-2
20+
role-to-assume: arn:aws:iam::206735643321:role/ConfigureAwsCredentialsPackageRole
21+
role-duration-seconds: 900
22+
- name: Get bot user token
23+
uses: aws-actions/aws-secretsmanager-get-secrets@v2
24+
with:
25+
parse-json-secrets: true
26+
secret-ids: |
27+
OSDS,arn:aws:secretsmanager:us-west-2:206735643321:secret:github-aws-sdk-osds-automation-gebs9n
28+
- name: Approve PR if not already approved
29+
run: |
30+
gh pr checkout "$PR_URL"
31+
if [ "$(gh pr status --json reviewDecision - q .currentBranch.reviewDecision)" != "APPROVED" ]; then
32+
gh pr review "$PR_URL" --approve
33+
else echo "PR already approved"
34+
fi
35+
env:
36+
PR_URL: ${{ github.event.pull_request.html_url }}
37+
GITHUB_TOKEN: ${{ env.OSDS_ACCESS_TOKEN }}

.github/workflows/validate-doc-metadata.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: checkout repo content
1717
uses: actions/checkout@v4
1818
- name: validate metadata
19-
uses: awsdocs/aws-doc-sdk-examples-tools@2025.02.0
19+
uses: awsdocs/aws-doc-sdk-examples-tools@2025.05.1
2020
with:
2121
doc_gen_only: "False"
2222
strict_titles: "True"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cdk.out/
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ghcr.io/ekristen/aws-nuke:v3.42.0
2+
ENV AWS_SDK_LOAD_CONFIG=1 \
3+
AWS_DEBUG=true
4+
USER root
5+
RUN apk add --no-cache \
6+
python3 \
7+
py3-pip \
8+
aws-cli
9+
COPY nuke_generic_config.yaml /nuke_generic_config.yaml
10+
COPY --chmod=755 run.sh /run.sh
11+
USER aws-nuke
12+
ENTRYPOINT ["/run.sh"]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# aws-nuke for Weathertop
2+
3+
[aws-nuke](https://github.com/ekristen/aws-nuke) is an open-source tool that deletes non-default resources in a provided AWS account. It's implemented here in this directory using Cloud Development Kit (CDK) code that deploys the [official aws-nuke image](https://github.com/ekristen/aws-nuke/pkgs/container/aws-nuke) to an AWS Lambda function.
4+
5+
## ⚠ Important
6+
7+
This is a very destructive tool! It should not be deployed without fully understanding the impact it will have on your AWS accounts.
8+
Please use caution and configure this tool to delete unused resources only in your lower test/sandbox environment accounts.
9+
10+
## Overview
11+
12+
This CDK stack is defined in [account_nuker.ts](account_nuker.ts). It includes:
13+
14+
- A Docker-based Lambda function with ARM64 architecture and 1GB memory
15+
- An IAM role with administrative permissions for the Lambda's nuking function
16+
- An EventBridge rule that triggers the function every Sunday at midnight
17+
18+
More specifically, this Lambda function is built from a [Dockerfile](Dockerfile) and runs with a 15-minute timeout. It contains a [nuke_generic_config.yml](nuke_generic_config.yaml) config and executes a [run.sh](run.sh) when invoked every Sunday at midnight UTC.
19+
20+
![infrastructure-overview](nuke-overview.png)
21+
22+
## Prerequisites
23+
24+
1. **Non-Prod AWS Account Alias**: A non-prod account alias must exist in target account. Set the alias by running `python create_account_alias.py weathertop-test` or following [these instructions](https://docs.aws.amazon.com/IAM/latest/UserGuide/account-alias-create.html).
25+
26+
## Setup and Installation
27+
28+
For multi-account deployments, please use the [deploy.py](../../../DEPLOYMENT.md#option-1-using-deploypy) script.
29+
30+
For single-account deployment, you can just run:
31+
32+
```sh
33+
cdk bootstrap && cdk deploy
34+
```
35+
36+
Note a successful stack creation, e.g.:
37+
38+
```bash
39+
NukeStack: success: Published 956fbd116734e79edb987e767fe7f45d0b97e2123456789109103f80ba4c1:123456789101-us-east-1
40+
Stack undefined
41+
NukeStack: deploying... [1/1]
42+
NukeStack: creating CloudFormation changeset...
43+
44+
✅ NukeStack
45+
46+
✨ Deployment time: 27.93s
47+
48+
Stack ARN:
49+
arn:aws:cloudformation:us-east-1:123456789101:stack/NukeStack/9835cc20-d358-11ef-bccf-123407dc82dd
50+
51+
✨ Total time: 33.24s
52+
```
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
import * as cdk from "aws-cdk-lib";
4+
import * as events from "aws-cdk-lib/aws-events";
5+
import * as targets from "aws-cdk-lib/aws-events-targets";
6+
import * as iam from "aws-cdk-lib/aws-iam";
7+
import * as path from "path";
8+
import * as lambda from "aws-cdk-lib/aws-lambda";
9+
import { Duration, Stack, StackProps } from "aws-cdk-lib";
10+
import { Construct } from "constructs";
11+
import { DockerImageCode, DockerImageFunction } from "aws-cdk-lib/aws-lambda";
12+
13+
export interface NukeStackProps extends cdk.StackProps {
14+
awsNukeDryRunFlag?: string;
15+
awsNukeVersion?: string;
16+
owner?: string;
17+
}
18+
19+
class NukeStack extends cdk.Stack {
20+
private readonly nukeLambdaRole: iam.Role;
21+
22+
constructor(scope: Construct, id: string, props?: StackProps) {
23+
super(scope, id, props);
24+
25+
// Lambda Function role
26+
this.nukeLambdaRole = new iam.Role(this, "NukeLambdaRole", {
27+
assumedBy: new iam.ServicePrincipal("lambda.amazonaws.com"),
28+
managedPolicies: [
29+
iam.ManagedPolicy.fromAwsManagedPolicyName("AdministratorAccess"),
30+
],
31+
});
32+
33+
// Create the Lambda function
34+
const lambdaFunction = new DockerImageFunction(
35+
this,
36+
"docker-lambda-function",
37+
{
38+
functionName: "docker-lambda-fn",
39+
code: DockerImageCode.fromImageAsset(path.join(__dirname)),
40+
memorySize: 1024,
41+
timeout: Duration.minutes(15),
42+
architecture: lambda.Architecture.ARM_64,
43+
description: "This is dockerized AWS Lambda function",
44+
role: this.nukeLambdaRole,
45+
},
46+
);
47+
48+
// Create EventBridge rule to trigger the Lambda function weekly
49+
const rule = new events.Rule(this, "WeeklyTriggerRule", {
50+
schedule: events.Schedule.expression("cron(0 0 ? * SUN *)"), // Runs at 00:00 every Sunday
51+
});
52+
53+
// Add the Lambda function as a target for the EventBridge rule
54+
rule.addTarget(new targets.LambdaFunction(lambdaFunction));
55+
}
56+
}
57+
58+
const app = new cdk.App();
59+
new NukeStack(app, "NukeStack", {
60+
env: {
61+
account: process.env.CDK_DEFAULT_ACCOUNT,
62+
region: process.env.CDK_DEFAULT_REGION,
63+
},
64+
terminationProtection: true,
65+
});

0 commit comments

Comments
 (0)