Amazon Bedrock Guardrails is designed to filter and detect undesirable or malicious content in user inputs (including prompt-injection style attacks) before it reaches the foundation model, addressing the SQL-injection detection requirement at the natural-language stage. Pairing this with AWS Lambda functions that use SQL parsing libraries allows syntactic and semantic validation of the generated SQL statements, catching injection patterns or disallowed operations. The Amazon RDS Data API can be used both to verify that generated queries conform to the defined database schema (correct tables, columns, and structure) and to collect audit logs of the query transformations prior to executing each query against the database, satisfying the audit-trail requirement. This multi-stage pipeline — input filtering, syntax validation, schema verification, and audit logging — mirrors AWS's recommended architecture pattern for building secure, governed text-to-SQL generative AI applications on Bedrock. The other options misapply AWS services: GuardDuty and Parameter Store are not designed for natural-language SQL-injection detection or schema validation; CloudTrail/IAM/WAF alone lack text-to-SQL-specific validation and schema checks; and a custom SageMaker model with VPC endpoints and DynamoDB storage does not inherently provide content-safety filtering, SQL syntax/schema validation, or a structured audit trail of transformations.
Community Discussion