@@ -28,7 +28,7 @@ Parameters:
2828 VSCodeInstanceType :
2929 Description : VS code-server EC2 instance type
3030 Type : String
31- Default : t4g.medium
31+ Default : t4g.large
3232 AllowedPattern : ^(t4g|m6g|m7g|m8g|c6g|c7g)\.[0-9a-z]+$
3333 ConstraintDescription : Must be a valid t, c or m series Graviton EC2 instance type
3434 VSCodeHomeFolder :
@@ -506,7 +506,7 @@ Resources:
506506 Description : Auto-generated MySQL database password
507507 GenerateSecretString :
508508 PasswordLength : 24
509- ExcludeCharacters : ' "@/\`{}$!&*()[]|;:<>?'
509+ ExcludeCharacters : ' "@/\`{}$!&*()[]|;:<>?'' %#^+=~ '
510510 ExcludePunctuation : false
511511 IncludeSpace : false
512512
@@ -968,9 +968,9 @@ Resources:
968968 - !Sub systemctl restart code-server@${VSCodeUser}
969969 - echo "Installing VSCode extensions..."
970970 - !Sub sudo -u ${VSCodeUser} --login code-server --install-extension AmazonWebServices.aws-toolkit-vscode --force
971- - !Sub sudo -u ${VSCodeUser} --login code-server --install-extension AmazonWebServices.amazon-q-vscode --force
972971 - !Sub sudo -u ${VSCodeUser} --login code-server --install-extension ms-vscode.live-server --force
973972 - !Sub sudo -u ${VSCodeUser} --login code-server --install-extension synedra.auto-run-command --force
973+ - !Sub sudo -u ${VSCodeUser} --login code-server --install-extension saoudrizwan.claude-dev --force
974974 - !Sub chown -R ${VSCodeUser}:${VSCodeUser} /home/${VSCodeUser}
975975 - echo "Verifying services..."
976976 - nginx -t 2>&1
@@ -1430,6 +1430,143 @@ Resources:
14301430 - echo "Frontend npm dependencies installed successfully."
14311431 - echo "Frontend development environment setup completed successfully."
14321432 - echo "Note - Frontend will be served from development server on port 3000 for live updates during workshop."
1433+ - name : UpdateFrontEnd
1434+ action : aws:runShellScript
1435+ inputs :
1436+ timeoutSeconds : 600
1437+ runCommand :
1438+ - " #!/bin/bash"
1439+ - " set -euo pipefail"
1440+ - echo "Updating frontend CSP configuration..."
1441+ - !Sub |
1442+ # Modify the build-csp.js file to comment out the production CSP and set it to empty string
1443+ if [ -f "/home/${VSCodeUser}/modernizr/frontend/scripts/build-csp.js" ]; then
1444+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr/frontend/scripts && cp build-csp.js build-csp.js.backup'
1445+ echo "Created backup of build-csp.js"
1446+
1447+ # Comment out the existing productionCSP line and add the new empty one
1448+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr/frontend/scripts && sed -i "s/^const productionCSP = \`.*\`;$/\/\/ &\nconst productionCSP = \`\`;/" build-csp.js'
1449+ echo "Updated build-csp.js - commented out original productionCSP and set to empty string"
1450+ else
1451+ echo "Warning: build-csp.js file not found"
1452+ fi
1453+ - echo "Updating frontend index.html security headers..."
1454+ - !Sub |
1455+ # Modify the index.html file to remove CSP and update security headers
1456+ if [ -f "/home/${VSCodeUser}/modernizr/frontend/public/index.html" ]; then
1457+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr/frontend/public && cp index.html index.html.backup'
1458+ echo "Created backup of index.html"
1459+
1460+ # Update the security headers section
1461+ # First, change the comment
1462+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr/frontend/public && sed -i "s/<!-- Security Headers - Environment-based CSP -->/<!-- Security Headers - Removed CSP for development -->/" index.html'
1463+
1464+ # Remove the CSP meta tag (multi-line)
1465+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr/frontend/public && sed -i "/meta http-equiv=\"Content-Security-Policy\"/,+1d" index.html'
1466+
1467+ # Add the new comment after the first comment
1468+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr/frontend/public && sed -i "/<!-- Security Headers - Removed CSP for development -->/a\ <!-- CSP removed to eliminate development issues -->" index.html'
1469+
1470+ # Update X-Frame-Options content from DENY to empty
1471+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr/frontend/public && sed -i "s/content=\"DENY\"/content=\"\"/" index.html'
1472+
1473+ echo "Updated index.html - removed CSP and updated X-Frame-Options"
1474+ else
1475+ echo "Warning: index.html file not found"
1476+ fi
1477+ - echo "Frontend CSP configuration updated successfully."
1478+ - name : SetupGit
1479+ action : aws:runShellScript
1480+ inputs :
1481+ timeoutSeconds : 600
1482+ runCommand :
1483+ - " #!/bin/bash"
1484+ - " set -euo pipefail"
1485+ - echo "Setting up Git repository for modernizr project..."
1486+ - !Sub |
1487+ # Initialize git repository in modernizr directory as participant user
1488+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr && git init'
1489+ - !Sub |
1490+ # Create .gitignore file with comprehensive content
1491+ sudo -u ${VSCodeUser} bash -c 'cat > /home/${VSCodeUser}/modernizr/.gitignore <<EOF
1492+ # Dependencies
1493+ node_modules/
1494+ npm-debug.log*
1495+ yarn-debug.log*
1496+ yarn-error.log*
1497+
1498+ # Build outputs
1499+ dist/
1500+ build/
1501+ coverage/
1502+ *.tsbuildinfo
1503+
1504+ # Environment files
1505+ .env
1506+ .env.local
1507+ .env.development.local
1508+ .env.test.local
1509+ .env.production.local
1510+
1511+ # IDE files
1512+ .vscode/
1513+ .idea/
1514+ *.swp
1515+ *.swo
1516+
1517+ # OS files
1518+ .DS_Store
1519+ Thumbs.db
1520+
1521+ # Logs
1522+ logs/
1523+ *.log
1524+
1525+ # Runtime data
1526+ pids/
1527+ *.pid
1528+ *.seed
1529+ *.pid.lock
1530+
1531+ # Test results
1532+ test-results/
1533+ cypress/videos/
1534+ cypress/screenshots/
1535+
1536+ # Temporary files
1537+ tmp/
1538+ temp/
1539+ .amazonq
1540+ .venv
1541+ EOF'
1542+ - !Sub |
1543+ # Add all files to staging area
1544+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr && git add .'
1545+ - !Sub |
1546+ # Create initial commit
1547+ sudo -u ${VSCodeUser} bash -c 'cd /home/${VSCodeUser}/modernizr && git commit -m "Initial commit - modernizr e-commerce application setup"'
1548+ - echo "Git repository initialized successfully with .gitignore and initial commit."
1549+ - name : SetupToolsConfigurationFile
1550+ action : aws:runShellScript
1551+ inputs :
1552+ timeoutSeconds : 600
1553+ runCommand :
1554+ - " #!/bin/bash"
1555+ - " set -euo pipefail"
1556+ - echo "Setting up tools configuration file with CloudFormation values"
1557+ - !Sub |
1558+ # Update all CloudFormation placeholder values in config.json
1559+ sudo -u ${VSCodeUser} sed -i 's/111122223333/${AWS::AccountId}/g' /home/${VSCodeUser}/modernizr/tools/config.json
1560+ sudo -u ${VSCodeUser} sed -i 's/<CF S3 BUCKET>/${MigrationS3Bucket}/g' /home/${VSCodeUser}/modernizr/tools/config.json
1561+ sudo -u ${VSCodeUser} sed -i 's|<CF GLUE ROLE>|${GlueServiceRole.Arn}|g' /home/${VSCodeUser}/modernizr/tools/config.json
1562+ sudo -u ${VSCodeUser} sed -i 's/<CF VPC ID>/${VSCodeInstance.VpcId}/g' /home/${VSCodeUser}/modernizr/tools/config.json
1563+ sudo -u ${VSCodeUser} sed -i 's/<CF SUBNET IDS>/${VSCodeInstance.SubnetId}/g' /home/${VSCodeUser}/modernizr/tools/config.json
1564+ sudo -u ${VSCodeUser} sed -i 's/<CF SECURITY GROUP ID>/${SecurityGroup.GroupId}/g' /home/${VSCodeUser}/modernizr/tools/config.json
1565+ sudo -u ${VSCodeUser} sed -i 's/<CF PUBLIC IP>/${VSCodeInstance.PublicIp}/g' /home/${VSCodeUser}/modernizr/tools/config.json
1566+ sudo -u ${VSCodeUser} sed -i 's/<CF PRIVATE IP>/${VSCodeInstance.PrivateIp}/g' /home/${VSCodeUser}/modernizr/tools/config.json
1567+ sudo -u ${VSCodeUser} sed -i 's/<CF DB USERNAME>/${DbMasterUsername}/g' /home/${VSCodeUser}/modernizr/tools/config.json
1568+ sudo -u ${VSCodeUser} sed -i 's/<CF DB PASSWORD>/${DbPasswordPlaintext.password}/g' /home/${VSCodeUser}/modernizr/tools/config.json
1569+ - echo "Configuration file updated with CloudFormation values successfully."
14331570
14341571 SSMDocLambdaRole :
14351572 Type : AWS::IAM::Role
0 commit comments