File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ files:
2+ "/tmp/add_authorized_keys.sh":
3+ mode: "000755"
4+ owner: root
5+ group: root
6+ content: |
7+ #!/bin/bash
8+ AUTHORIZED_KEYS="/home/ec2-user/.ssh/authorized_keys"
9+ mkdir -p /home/ec2-user/.ssh
10+ touch "$AUTHORIZED_KEYS"
11+ chown ec2-user:ec2-user /home/ec2-user/.ssh
12+ chmod 700 /home/ec2-user/.ssh
13+
14+ add_key() {
15+ local key="$1"
16+ if ! grep -qF "$key" "$AUTHORIZED_KEYS"; then
17+ echo "$key" >> "$AUTHORIZED_KEYS"
18+ fi
19+ }
20+
21+ # Chris Pyle
22+ add_key "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMqV5gwot3utGLPGpAPWr8znU1cjMn1RE7jN8htvaOMt aws-eb"
23+
24+ chown ec2-user:ec2-user "$AUTHORIZED_KEYS"
25+ chmod 600 "$AUTHORIZED_KEYS"
26+
27+ commands:
28+ add_authorized_keys:
29+ command: "/tmp/add_authorized_keys.sh"
30+ ignoreErrors: false
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ variable "solution_stack_name" {
1414 description = " Elastic Beanstalk solution stack name"
1515 type = string
1616 # Find the latest: aws elasticbeanstalk list-available-solution-stacks
17- default = " 64bit Amazon Linux 2023 v4.7.4 running Docker"
17+ default = " 64bit Amazon Linux 2023 v4.11.0 running Docker"
1818}
1919
2020variable "vpc_id" {
Original file line number Diff line number Diff line change @@ -357,6 +357,10 @@ resource "aws_cloudwatch_metric_alarm" "eb_memory_high" {
357357 Environment = var.environment
358358 Project = var.project_name
359359 }
360+
361+ lifecycle {
362+ ignore_changes = [metric_query ]
363+ }
360364}
361365
362366# ############
Original file line number Diff line number Diff line change @@ -164,6 +164,14 @@ resource "aws_security_group" "eb_instance" {
164164 security_groups = [aws_security_group . alb . id ]
165165 }
166166
167+ ingress {
168+ description = " SSH access"
169+ from_port = 22
170+ to_port = 22
171+ protocol = " tcp"
172+ cidr_blocks = [" 0.0.0.0/0" ]
173+ }
174+
167175 egress {
168176 description = " Allow all outbound traffic"
169177 from_port = 0
You can’t perform that action at this time.
0 commit comments