Skip to content

Instantly share code, notes, and snippets.

@agup006
Last active March 30, 2023 18:05
Show Gist options
  • Save agup006/871533d85ff18e36252338ea298d7a76 to your computer and use it in GitHub Desktop.
Save agup006/871533d85ff18e36252338ea298d7a76 to your computer and use it in GitHub Desktop.
Description: EC2 Instance with Calyptia Core
Mappings:
RegionsAmis:
us-east-1:
'111': ami-0e7c24109670b64ec
us-east-2:
'111': ami-014087e40c89090ec
Parameters:
Version:
AllowedValues:
- '111'
Type: String
InstanceTypeParameter:
Description: WebServer EC2 instance type
Type: String
Default: t2.medium
AllowedValues:
- 't2.medium'
- 't2.small'
KeyName:
Description: Name of an existing EC2 key pair to enable SSH access to the EC2 instance
Type: AWS::EC2::KeyPair::KeyName
ConstraintDescription: Must be the name of an existing EC2 KeyPair.
SSHLocation:
Description: The IP address range that can be used to SSH to the EC2 instance
Type: String
MinLength: 9
MaxLength: 18
Default: 0.0.0.0/0
ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x.
Resources:
CalyptiaCore:
Properties:
ImageId: !FindInMap
- RegionsAmis
- !Ref 'AWS::Region'
- !Ref 'Version'
SecurityGroups:
- !Ref InstanceSecurityGroup
InstanceType: !Ref InstanceTypeParameter
KeyName: !Ref KeyName
Type: AWS::EC2::Instance
InstanceSecurityGroup:
Properties:
GroupDescription: !Sub '${AWS::StackName} - CalyptiaCore'
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp : !Ref 'SSHLocation'
Type: AWS::EC2::SecurityGroup
Outputs:
InstanceId:
Description: InstanceID of the newly created instance.
Value: !Ref CalyptiaCore
PublicDNS:
Description: The public DNSName of the newly created instance.
Value: !GetAtt CalyptiaCore.PublicDnsName
PublicIP:
Description: The public IP of the newly created instance.
Value: !GetAtt CalyptiaCore.PublicIp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment