Infraestrutura Utilizada
A Infraestrutura utilizada no projeto foi uma instância do EC2 para o backend e uma instância do S3 para o frontend, ambos serviços em nuvem da AWS.
A partir dessa infraestrutura foi gerada o arquivo abaixo, permitindo em poucos cliques reproduzir a infraestrutura utilizando o serviço CloudFormation. Esse serviço permite injetar um arquivo YAML que descreve o que será usado e ele cria as instâncias e dependencias necessárias.
`AWSTemplateFormatVersion: "2010-09-09" Metadata: Generator: "former2" Description: "" Resources: S3Bucket: Type: "AWS::S3::Bucket" Properties: BucketName: "vouimigrar" Tags: - Key: "Project" Value: "vouimigrar" WebsiteConfiguration: IndexDocument: "index.html" ErrorDocument: "index.html"
EC2Instance:
Type: "AWS::EC2::Instance"
Properties:
ImageId: "ami-064ff912f78e3e561"
InstanceType: "c4.large"
KeyName: "vouMigrar"
AvailabilityZone: !Sub "${AWS::Region}a"
Tenancy: "default"
SubnetId: "subnet-06b2242d076e3d59a"
EbsOptimized: false
SecurityGroupIds:
- !Ref EC2SecurityGroup
SourceDestCheck: true
BlockDeviceMappings:
-
DeviceName: "/dev/xvda"
Ebs:
Encrypted: false
VolumeSize: 16
SnapshotId: "snap-086ea3f68d0a80dfc"
VolumeType: "gp2"
DeleteOnTermination: true
UserData: "IyEvYmluL2Jhc2gKCiMgaW5zdGFsbCBkb2NrZXIgCnl1bSB1cGRhdGUgLXkKYW1hem9uLWxpbnV4LWV4dHJhcyBpbnN0YWxsIGRvY2tlciAteQoKIyBzdGFydCBkb2NrZXIKc2VydmljZSBkb2NrZXIgc3RhcnQKCiMgZW5hYmxlIGRvY2tlciBzZXJ2aWNlcwpzdWRvIHN5c3RlbWN0bCBlbmFibGUgZG9ja2VyLnNlcnZpY2UKc3VkbyBzeXN0ZW1jdGwgZW5hYmxlIGNvbnRhaW5lcmQuc2VydmljZQoKc3VkbyB1c2VybW9kIC1hIC1HIGRvY2tlciBlYzItdXNlcgoKIyBpbnN0YWxsIGdpdCAKeXVtIGluc3RhbGwgZ2l0"
Tags:
-
Key: "Project"
Value: !Ref S3Bucket
-
Key: "Name"
Value: !Sub "${S3Bucket}1"
HibernationOptions:
Configured: false
CpuOptions:
CoreCount: 1
ThreadsPerCore: 2
EnclaveOptions:
Enabled: false
S3BucketPolicy:
Type: "AWS::S3::BucketPolicy"
Properties:
Bucket: !Ref S3Bucket
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Sid: "AllowPublicReadAccess"
Effect: "Allow"
Principal: "*"
Action: "s3:GetObject"
Resource: !Sub "arn:aws:s3:::${S3Bucket}/*"
EC2SecurityGroup:
Type: "AWS::EC2::SecurityGroup"
Properties:
GroupDescription: "AGES SCcreated 2022-04-06T18:44:15.725-03:00"
GroupName: "AGES SC"
VpcId: "vpc-0ca3baf17f64030a9"
SecurityGroupIngress:
-
CidrIp: "0.0.0.0/0"
FromPort: 2377
IpProtocol: "tcp"
ToPort: 2377
-
CidrIp: "0.0.0.0/0"
FromPort: 80
IpProtocol: "tcp"
ToPort: 80
-
CidrIpv6: "::/0"
FromPort: 80
IpProtocol: "tcp"
ToPort: 80
-
SourceSecurityGroupId: "sg-0fc1369e0e10bdc80"
SourceSecurityGroupOwnerId: !Ref AWS::AccountId
FromPort: 0
IpProtocol: "tcp"
ToPort: 65535
-
CidrIp: "0.0.0.0/0"
FromPort: 8080
IpProtocol: "tcp"
ToPort: 8080
-
CidrIp: "0.0.0.0/0"
FromPort: 4789
IpProtocol: "tcp"
ToPort: 4789
-
CidrIp: "0.0.0.0/0"
Description: ""
FromPort: 22
IpProtocol: "tcp"
ToPort: 22
-
CidrIp: "0.0.0.0/0"
FromPort: 25
IpProtocol: "tcp"
ToPort: 25
-
CidrIpv6: "::/0"
FromPort: 25
IpProtocol: "tcp"
ToPort: 25
-
CidrIp: "0.0.0.0/0"
FromPort: 7946
IpProtocol: "tcp"
ToPort: 7946
-
CidrIp: "0.0.0.0/0"
FromPort: 3000
IpProtocol: "tcp"
ToPort: 6000
-
CidrIpv6: "::/0"
FromPort: 3000
IpProtocol: "tcp"
ToPort: 6000
-
CidrIp: "0.0.0.0/0"
FromPort: 465
IpProtocol: "tcp"
ToPort: 465
-
CidrIpv6: "::/0"
FromPort: 465
IpProtocol: "tcp"
ToPort: 465
-
SourceSecurityGroupId: "sg-0fc1369e0e10bdc80"
SourceSecurityGroupOwnerId: !Ref AWS::AccountId
FromPort: 0
IpProtocol: "udp"
ToPort: 65535
-
CidrIp: "0.0.0.0/0"
FromPort: 587
IpProtocol: "tcp"
ToPort: 587
-
CidrIpv6: "::/0"
FromPort: 587
IpProtocol: "tcp"
ToPort: 587
SecurityGroupEgress:
-
CidrIp: "0.0.0.0/0"
IpProtocol: "-1"
-
CidrIpv6: "::/0"
IpProtocol: "-1"`