-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-enhanced.sh
More file actions
executable file
·51 lines (41 loc) · 2.16 KB
/
deploy-enhanced.sh
File metadata and controls
executable file
·51 lines (41 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Enhanced IntelliNemo Agent Deployment
set -e
PROJECT_NAME="intellinemo-agent"
REGION="us-east-1"
echo "🚀 Deploying Enhanced IntelliNemo Agent..."
# Get Lambda function ARN
LAMBDA_ARN=$(aws lambda get-function --function-name intellinemo-agent --query 'Configuration.FunctionArn' --output text)
echo "📋 Lambda ARN: $LAMBDA_ARN"
# Deploy SSM runbooks
echo "📚 Deploying Systems Manager runbooks..."
aws cloudformation deploy \
--template-file infrastructure/cloudformation/ssm-runbooks.json \
--stack-name ${PROJECT_NAME}-ssm-runbooks \
--region ${REGION}
# Deploy EventBridge integration
echo "⚡ Deploying EventBridge integration..."
aws cloudformation deploy \
--template-file infrastructure/cloudformation/eventbridge-stack.json \
--stack-name ${PROJECT_NAME}-eventbridge \
--parameter-overrides LambdaFunctionArn=${LAMBDA_ARN} \
--region ${REGION}
# Update Lambda with enhanced code
echo "🔄 Updating Lambda function..."
cd lambda-package && rm -f lambda_function.py && cp ../src/lambda/lambda_function.py . && zip -r ../lambda-enhanced.zip . && cd ..
aws lambda update-function-code \
--function-name intellinemo-agent \
--zip-file fileb://lambda-enhanced.zip \
--region ${REGION}
# Update Lambda permissions for SSM
echo "🔐 Updating Lambda permissions..."
aws iam attach-role-policy \
--role-name $(aws lambda get-function --function-name intellinemo-agent --query 'Configuration.Role' --output text | cut -d'/' -f2) \
--policy-arn arn:aws:iam::aws:policy/AmazonSSMFullAccess
echo "✅ Enhanced deployment completed!"
echo ""
echo "🧪 Test with real CloudWatch alarm:"
echo "aws cloudwatch put-metric-alarm --alarm-name intellinemo-test --alarm-description 'Test' --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 300 --threshold 80 --comparison-operator GreaterThanThreshold --evaluation-periods 1 --alarm-actions arn:aws:sns:${REGION}:$(aws sts get-caller-identity --query Account --output text):intellinemo-notifications"
echo ""
echo "aws cloudwatch set-alarm-state --alarm-name intellinemo-test --state-value ALARM --state-reason 'Testing enhanced IntelliNemo'"
rm -f lambda-enhanced.zip