From 7283d1434d14bc9b62623f29fc1eceba20eede56 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:37:10 +0530 Subject: [PATCH 1/6] feat: click to deploy to AWS test --- README.md | 2 +- template.yaml | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 template.yaml diff --git a/README.md b/README.md index 1ffc0c29..08362e25 100755 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Shuffle Automation [![CodeQL](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml) [![Autobuild](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml) -[![Deploy to Google Cloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run/?git_repo=https://github.com/0x0elliot/Shuffle&ref=2.0.0) +[![Deploy to AWS](https://d1.awsstatic.com/cloudformation-deploy-to-aws-button.png)](https://console.aws.amazon.com/cloudformation/home?#/stacks/new?stackName=Shuffle-Instance&templateURL=https://raw.githubusercontent.com/Shuffle/Shuffle/refs/heads/2.0.0/template.yaml)

diff --git a/template.yaml b/template.yaml new file mode 100644 index 00000000..1a4a3c2b --- /dev/null +++ b/template.yaml @@ -0,0 +1,99 @@ +AWSTemplateFormatVersion: '2010-09-09' +Description: Deploy EC2 instance using a specific AMI, configure a security group with ingress rules for SSH and port 3001, and create VPC and subnet. + +Parameters: + AMI: + Type: String + Default: ami-021141a79f4c8fc02 # Default to your AMI ID if needed + InstanceType: + Type: String + Default: t3.large # Default to t3.large + VpcCidrBlock: + Type: String + Default: 10.0.0.0/16 # Default to a private network range + SubnetCidrBlock: + Type: String + Default: 10.0.1.0/24 # Default to a smaller subnet range + SecurityGroupName: + Type: String + Default: ShuffleSG + +Resources: + # Create the VPC + VPC: + Type: AWS::EC2::VPC + Properties: + CidrBlock: !Ref VpcCidrBlock + EnableDnsSupport: "true" + EnableDnsHostnames: "true" + Tags: + - Key: Name + Value: ShuffleVPC + + # Create the Subnet within the VPC + Subnet: + Type: AWS::EC2::Subnet + Properties: + CidrBlock: !Ref SubnetCidrBlock + VpcId: !Ref VPC + AvailabilityZone: !Select [ 0, !GetAZs '' ] + MapPublicIpOnLaunch: "true" + Tags: + - Key: Name + Value: ShuffleSubnet + + # Create the Security Group for the EC2 instance + SecurityGroup: + Type: AWS::EC2::SecurityGroup + Properties: + GroupName: !Ref SecurityGroupName + VpcId: !Ref VPC + SecurityGroupIngress: + - IpProtocol: tcp + FromPort: 22 + ToPort: 22 + CidrIp: 0.0.0.0/0 # Allow SSH from anywhere + - IpProtocol: tcp + FromPort: 3001 + ToPort: 3001 + CidrIp: 0.0.0.0/0 # Allow traffic on port 3001 from anywhere + + # Create an EC2 instance + EC2Instance: + Type: AWS::EC2::Instance + Properties: + ImageId: !Ref AMI + InstanceType: !Ref InstanceType + NetworkInterfaces: + - AssociatePublicIpAddress: true + DeviceIndex: 0 + GroupSet: + - !Ref SecurityGroup + SubnetId: !Ref Subnet + Tags: + - Key: Name + Value: Shuffle AMI Test Instance + CpuOptions: + CoreCount: 1 + ThreadsPerCore: 1 + PrivateDnsNameOptions: + HostnameType: "ip-name" + EnableResourceNameDnsARecord: true + EnableResourceNameDnsAAAARecord: false + +Outputs: + InstanceId: + Description: "Instance ID of the created EC2 instance" + Value: !Ref EC2Instance + PublicIP: + Description: "Public IP address of the EC2 instance" + Value: !GetAtt EC2Instance.PublicIp + VPCId: + Description: "VPC ID" + Value: !Ref VPC + SubnetId: + Description: "Subnet ID" + Value: !Ref Subnet + SecurityGroupId: + Description: "Security Group ID" + Value: !Ref SecurityGroup From 29e23151fbb0fdd5c1a732de1126fffe8c0d2155 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:43:40 +0530 Subject: [PATCH 2/6] Revert "feat: click to deploy to AWS test" This reverts commit 7283d1434d14bc9b62623f29fc1eceba20eede56. --- README.md | 2 +- template.yaml | 99 --------------------------------------------------- 2 files changed, 1 insertion(+), 100 deletions(-) delete mode 100644 template.yaml diff --git a/README.md b/README.md index 687f89e7..632c85c1 100755 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Shuffle Automation <<<<<<< HEAD [![CodeQL](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml) [![Autobuild](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml) -[![Deploy to AWS](https://d1.awsstatic.com/cloudformation-deploy-to-aws-button.png)](https://console.aws.amazon.com/cloudformation/home?#/stacks/new?stackName=Shuffle-Instance&templateURL=https://raw.githubusercontent.com/Shuffle/Shuffle/refs/heads/2.0.0/template.yaml) +[![Deploy to Google Cloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run/?git_repo=https://github.com/0x0elliot/Shuffle&ref=2.0.0) ======= >>>>>>> 8883de54d10855428866f598b70e16674df6d7c1 diff --git a/template.yaml b/template.yaml deleted file mode 100644 index 1a4a3c2b..00000000 --- a/template.yaml +++ /dev/null @@ -1,99 +0,0 @@ -AWSTemplateFormatVersion: '2010-09-09' -Description: Deploy EC2 instance using a specific AMI, configure a security group with ingress rules for SSH and port 3001, and create VPC and subnet. - -Parameters: - AMI: - Type: String - Default: ami-021141a79f4c8fc02 # Default to your AMI ID if needed - InstanceType: - Type: String - Default: t3.large # Default to t3.large - VpcCidrBlock: - Type: String - Default: 10.0.0.0/16 # Default to a private network range - SubnetCidrBlock: - Type: String - Default: 10.0.1.0/24 # Default to a smaller subnet range - SecurityGroupName: - Type: String - Default: ShuffleSG - -Resources: - # Create the VPC - VPC: - Type: AWS::EC2::VPC - Properties: - CidrBlock: !Ref VpcCidrBlock - EnableDnsSupport: "true" - EnableDnsHostnames: "true" - Tags: - - Key: Name - Value: ShuffleVPC - - # Create the Subnet within the VPC - Subnet: - Type: AWS::EC2::Subnet - Properties: - CidrBlock: !Ref SubnetCidrBlock - VpcId: !Ref VPC - AvailabilityZone: !Select [ 0, !GetAZs '' ] - MapPublicIpOnLaunch: "true" - Tags: - - Key: Name - Value: ShuffleSubnet - - # Create the Security Group for the EC2 instance - SecurityGroup: - Type: AWS::EC2::SecurityGroup - Properties: - GroupName: !Ref SecurityGroupName - VpcId: !Ref VPC - SecurityGroupIngress: - - IpProtocol: tcp - FromPort: 22 - ToPort: 22 - CidrIp: 0.0.0.0/0 # Allow SSH from anywhere - - IpProtocol: tcp - FromPort: 3001 - ToPort: 3001 - CidrIp: 0.0.0.0/0 # Allow traffic on port 3001 from anywhere - - # Create an EC2 instance - EC2Instance: - Type: AWS::EC2::Instance - Properties: - ImageId: !Ref AMI - InstanceType: !Ref InstanceType - NetworkInterfaces: - - AssociatePublicIpAddress: true - DeviceIndex: 0 - GroupSet: - - !Ref SecurityGroup - SubnetId: !Ref Subnet - Tags: - - Key: Name - Value: Shuffle AMI Test Instance - CpuOptions: - CoreCount: 1 - ThreadsPerCore: 1 - PrivateDnsNameOptions: - HostnameType: "ip-name" - EnableResourceNameDnsARecord: true - EnableResourceNameDnsAAAARecord: false - -Outputs: - InstanceId: - Description: "Instance ID of the created EC2 instance" - Value: !Ref EC2Instance - PublicIP: - Description: "Public IP address of the EC2 instance" - Value: !GetAtt EC2Instance.PublicIp - VPCId: - Description: "VPC ID" - Value: !Ref VPC - SubnetId: - Description: "Subnet ID" - Value: !Ref Subnet - SecurityGroupId: - Description: "Security Group ID" - Value: !Ref SecurityGroup From ad4268dd307a4a151ab2aee47a51123fb21ead9c Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:44:38 +0530 Subject: [PATCH 3/6] feat: click to deploy to AWS test (resolve merge conflicts) --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 632c85c1..1ffc0c29 100755 --- a/README.md +++ b/README.md @@ -4,13 +4,10 @@ Shuffle Automation -<<<<<<< HEAD [![CodeQL](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml) [![Autobuild](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml) [![Deploy to Google Cloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run/?git_repo=https://github.com/0x0elliot/Shuffle&ref=2.0.0) -======= ->>>>>>> 8883de54d10855428866f598b70e16674df6d7c1

[Shuffle](https://shuffler.io) is an automation platform for and by the community, focusing on accessibility for anyone to automate. Security operations is complex, but it doesn't have to be. From c52cb8a6d8844ad1dd0e16eaaaa001038cc8253e Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:46:39 +0530 Subject: [PATCH 4/6] feat: click to deploy to AWS test --- README.md | 2 +- template.yaml | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 template.yaml diff --git a/README.md b/README.md index 1ffc0c29..08362e25 100755 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Shuffle Automation [![CodeQL](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml) [![Autobuild](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml) -[![Deploy to Google Cloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run/?git_repo=https://github.com/0x0elliot/Shuffle&ref=2.0.0) +[![Deploy to AWS](https://d1.awsstatic.com/cloudformation-deploy-to-aws-button.png)](https://console.aws.amazon.com/cloudformation/home?#/stacks/new?stackName=Shuffle-Instance&templateURL=https://raw.githubusercontent.com/Shuffle/Shuffle/refs/heads/2.0.0/template.yaml)

diff --git a/template.yaml b/template.yaml new file mode 100644 index 00000000..1a4a3c2b --- /dev/null +++ b/template.yaml @@ -0,0 +1,99 @@ +AWSTemplateFormatVersion: '2010-09-09' +Description: Deploy EC2 instance using a specific AMI, configure a security group with ingress rules for SSH and port 3001, and create VPC and subnet. + +Parameters: + AMI: + Type: String + Default: ami-021141a79f4c8fc02 # Default to your AMI ID if needed + InstanceType: + Type: String + Default: t3.large # Default to t3.large + VpcCidrBlock: + Type: String + Default: 10.0.0.0/16 # Default to a private network range + SubnetCidrBlock: + Type: String + Default: 10.0.1.0/24 # Default to a smaller subnet range + SecurityGroupName: + Type: String + Default: ShuffleSG + +Resources: + # Create the VPC + VPC: + Type: AWS::EC2::VPC + Properties: + CidrBlock: !Ref VpcCidrBlock + EnableDnsSupport: "true" + EnableDnsHostnames: "true" + Tags: + - Key: Name + Value: ShuffleVPC + + # Create the Subnet within the VPC + Subnet: + Type: AWS::EC2::Subnet + Properties: + CidrBlock: !Ref SubnetCidrBlock + VpcId: !Ref VPC + AvailabilityZone: !Select [ 0, !GetAZs '' ] + MapPublicIpOnLaunch: "true" + Tags: + - Key: Name + Value: ShuffleSubnet + + # Create the Security Group for the EC2 instance + SecurityGroup: + Type: AWS::EC2::SecurityGroup + Properties: + GroupName: !Ref SecurityGroupName + VpcId: !Ref VPC + SecurityGroupIngress: + - IpProtocol: tcp + FromPort: 22 + ToPort: 22 + CidrIp: 0.0.0.0/0 # Allow SSH from anywhere + - IpProtocol: tcp + FromPort: 3001 + ToPort: 3001 + CidrIp: 0.0.0.0/0 # Allow traffic on port 3001 from anywhere + + # Create an EC2 instance + EC2Instance: + Type: AWS::EC2::Instance + Properties: + ImageId: !Ref AMI + InstanceType: !Ref InstanceType + NetworkInterfaces: + - AssociatePublicIpAddress: true + DeviceIndex: 0 + GroupSet: + - !Ref SecurityGroup + SubnetId: !Ref Subnet + Tags: + - Key: Name + Value: Shuffle AMI Test Instance + CpuOptions: + CoreCount: 1 + ThreadsPerCore: 1 + PrivateDnsNameOptions: + HostnameType: "ip-name" + EnableResourceNameDnsARecord: true + EnableResourceNameDnsAAAARecord: false + +Outputs: + InstanceId: + Description: "Instance ID of the created EC2 instance" + Value: !Ref EC2Instance + PublicIP: + Description: "Public IP address of the EC2 instance" + Value: !GetAtt EC2Instance.PublicIp + VPCId: + Description: "VPC ID" + Value: !Ref VPC + SubnetId: + Description: "Subnet ID" + Value: !Ref Subnet + SecurityGroupId: + Description: "Security Group ID" + Value: !Ref SecurityGroup From 99a5f0bca6cf788d33f53a4759f98c18e3eac3f5 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:57:48 +0530 Subject: [PATCH 5/6] feat: click to deploy to AWS test --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 08362e25..e92077ce 100755 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Shuffle Automation [![CodeQL](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/codeql-analysis.yml) [![Autobuild](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml/badge.svg?branch=launch)](https://github.com/Shuffle/Shuffle/actions/workflows/dockerbuild.yaml) -[![Deploy to AWS](https://d1.awsstatic.com/cloudformation-deploy-to-aws-button.png)](https://console.aws.amazon.com/cloudformation/home?#/stacks/new?stackName=Shuffle-Instance&templateURL=https://raw.githubusercontent.com/Shuffle/Shuffle/refs/heads/2.0.0/template.yaml) +[![Deploy to AWS](https://d1.awsstatic.com/cloudformation-deploy-to-aws-button.png)](https://console.aws.amazon.com/cloudformation/home?#/stacks/new?stackName=Shuffle-Instance&templateURL=https://shuffle-public-amis.s3.eu-north-1.amazonaws.com/template.yaml)

From 4e68885ad1d457c10075a3b4aa77ca5ee4d3a933 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:07:22 +0530 Subject: [PATCH 6/6] feat: final template.yaml --- template.yaml | 126 ++++++++++++++++++++++---------------------------- 1 file changed, 54 insertions(+), 72 deletions(-) diff --git a/template.yaml b/template.yaml index 1a4a3c2b..2778b38b 100644 --- a/template.yaml +++ b/template.yaml @@ -1,99 +1,81 @@ AWSTemplateFormatVersion: '2010-09-09' -Description: Deploy EC2 instance using a specific AMI, configure a security group with ingress rules for SSH and port 3001, and create VPC and subnet. - -Parameters: - AMI: - Type: String - Default: ami-021141a79f4c8fc02 # Default to your AMI ID if needed - InstanceType: - Type: String - Default: t3.large # Default to t3.large - VpcCidrBlock: - Type: String - Default: 10.0.0.0/16 # Default to a private network range - SubnetCidrBlock: - Type: String - Default: 10.0.1.0/24 # Default to a smaller subnet range - SecurityGroupName: - Type: String - Default: ShuffleSG +Description: 'Create an EC2 instance with port 3001 open and auto-generate network resources' Resources: - # Create the VPC VPC: Type: AWS::EC2::VPC Properties: - CidrBlock: !Ref VpcCidrBlock - EnableDnsSupport: "true" - EnableDnsHostnames: "true" - Tags: - - Key: Name - Value: ShuffleVPC + CidrBlock: 10.0.0.0/16 + EnableDnsHostnames: true + EnableDnsSupport: true - # Create the Subnet within the VPC - Subnet: + PublicSubnet: Type: AWS::EC2::Subnet Properties: - CidrBlock: !Ref SubnetCidrBlock VpcId: !Ref VPC - AvailabilityZone: !Select [ 0, !GetAZs '' ] - MapPublicIpOnLaunch: "true" - Tags: - - Key: Name - Value: ShuffleSubnet + AvailabilityZone: !Select + - 0 + - !GetAZs + Ref: 'AWS::Region' + CidrBlock: 10.0.1.0/24 + MapPublicIpOnLaunch: true + + InternetGateway: + Type: AWS::EC2::InternetGateway + + AttachGateway: + Type: AWS::EC2::VPCGatewayAttachment + Properties: + VpcId: !Ref VPC + InternetGatewayId: !Ref InternetGateway + + PublicRouteTable: + Type: AWS::EC2::RouteTable + Properties: + VpcId: !Ref VPC + + PublicRoute: + Type: AWS::EC2::Route + DependsOn: AttachGateway + Properties: + RouteTableId: !Ref PublicRouteTable + DestinationCidrBlock: 0.0.0.0/0 + GatewayId: !Ref InternetGateway + + SubnetRouteTableAssociation: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + SubnetId: !Ref PublicSubnet + RouteTableId: !Ref PublicRouteTable - # Create the Security Group for the EC2 instance SecurityGroup: Type: AWS::EC2::SecurityGroup Properties: - GroupName: !Ref SecurityGroupName + GroupDescription: Allow port 3001 access VpcId: !Ref VPC SecurityGroupIngress: - - IpProtocol: tcp - FromPort: 22 - ToPort: 22 - CidrIp: 0.0.0.0/0 # Allow SSH from anywhere - IpProtocol: tcp FromPort: 3001 ToPort: 3001 - CidrIp: 0.0.0.0/0 # Allow traffic on port 3001 from anywhere + CidrIp: 0.0.0.0/0 + - IpProtocol: tcp + FromPort: 22 + ToPort: 22 + CidrIp: 0.0.0.0/0 - # Create an EC2 instance EC2Instance: Type: AWS::EC2::Instance Properties: - ImageId: !Ref AMI - InstanceType: !Ref InstanceType - NetworkInterfaces: - - AssociatePublicIpAddress: true - DeviceIndex: 0 - GroupSet: - - !Ref SecurityGroup - SubnetId: !Ref Subnet - Tags: - - Key: Name - Value: Shuffle AMI Test Instance - CpuOptions: - CoreCount: 1 - ThreadsPerCore: 1 - PrivateDnsNameOptions: - HostnameType: "ip-name" - EnableResourceNameDnsARecord: true - EnableResourceNameDnsAAAARecord: false + InstanceType: t3.large + SecurityGroupIds: + - !Ref SecurityGroup + SubnetId: !Ref PublicSubnet + ImageId: ami-04996ef73316c465c Outputs: InstanceId: - Description: "Instance ID of the created EC2 instance" + Description: InstanceId of the newly created EC2 instance Value: !Ref EC2Instance - PublicIP: - Description: "Public IP address of the EC2 instance" - Value: !GetAtt EC2Instance.PublicIp - VPCId: - Description: "VPC ID" - Value: !Ref VPC - SubnetId: - Description: "Subnet ID" - Value: !Ref Subnet - SecurityGroupId: - Description: "Security Group ID" - Value: !Ref SecurityGroup + PublicDNS: + Description: Public DNSName of the newly created EC2 instance + Value: !GetAtt EC2Instance.PublicDnsName \ No newline at end of file