- 给iam role加上订阅marketplace产品的权限,或者用管理员账户发一个模型推理请求(自动触发订阅)
- 模型对应的产品id 见https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-product-ids.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module aws-location-suggest | |
| go 1.23 | |
| require ( | |
| github.com/aws/aws-sdk-go-v2 v1.41.1 | |
| github.com/aws/aws-sdk-go-v2/config v1.32.7 | |
| github.com/aws/aws-sdk-go-v2/service/geoplaces v1.8.0 | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| BUCKET_NAME="sample_bucket" | |
| PROFILE="" | |
| # Parse arguments | |
| while [[ $# -gt 0 ]]; do | |
| case $1 in | |
| --profile) | |
| PROFILE="$2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib3 | |
| import re | |
| def lambda_handler(event, context): | |
| request = event['Records'][0]['cf']['request'] | |
| response = event['Records'][0]['cf']['response'] | |
| # Extract token from query string | |
| token = None | |
| for param in request['querystring'].split('&'): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` | |
| MAC_ADDRESS=`curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/network/interfaces/macs/` | |
| IPv6_ADDRESS=`curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDRESS}/ipv6s` | |
| sudo ip -6 addr add ${IPv6_ADDRESS}/128 dev eth0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "cloudformation:*" | |
| ], | |
| "Resource": "*" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -x | |
| # Script to send email via AWS SES using SigV4 authentication and curl | |
| # Usage: ./send_ses_email.sh [from_email] [to_email] [subject] [message] | |
| # Check if required parameters are provided | |
| if [ "$#" -lt 4 ]; then | |
| echo "Usage: $0 from_email to_email subject message" | |
| echo "Example: $0 [email protected] [email protected] \"Test Subject\" \"This is a test message\"" | |
| exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Script to send emails via AWS SES SMTP endpoint using curl | |
| # Usage: ./send-ses-email.sh -f [email protected] -t [email protected] -s "Subject" -b "Body text" [-a attachment.pdf] | |
| # Default AWS SES SMTP settings | |
| AWS_REGION="us-east-1" | |
| SES_SMTP_HOST="email-smtp.us-east-1.amazonaws.com" | |
| SES_SMTP_PORT="587" | |
| SES_SMTP_USERNAME="" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import base64 | |
| import boto3 | |
| import os | |
| tools = [ | |
| { | |
| "toolSpec": { | |
| "name": "analysis_product_review", | |
| "description": "Analysis the product reviews, determine its category, sentiment.", |
NewerOlder
