Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Add e-mail credentials generation to cloudformation

Michal Rutka353aa818bded
diff --git a/mvp/aws-cloudformation.template.yml b/mvp/aws-cloudformation.template.yml
index 0abf29502..3380201fc 100644
--- a/mvp/aws-cloudformation.template.yml
+++ b/mvp/aws-cloudformation.template.yml
@@ -17,7 +17,7 @@ Parameters:
HostedZone:
Description: Use AWS hosted zone
Type: String
- Default: false
+ Default: true
AllowedValues:
- true
- false
@@ -31,7 +31,7 @@ Parameters:
Type: String
# AWS Compute Optimizer reports that this instance type is under-provisioned and advise to use
# more than double the price instance. However, it works in our test setup.
- Default: t3a.medium
+ Default: t3a.small
ConstraintDescription: must be a valid EC2 instance type.
InstanceAMI:
Description: Managed AMI ID for EC2 Instance (don't change it unless you know what you are doing)
@@ -45,10 +45,35 @@ Outputs:
Description: The Instance public IP
Value: !GetAtt EC2Instance.PublicIp
PublicUrl:
- Condition: DomainName
+ Condition: DnsRecordCreate
Description: OpenRemote Instance URL
Value: !Join [ ".", [ !Ref HostName, !Ref DomainName ] ]
+ UserId:
+ Description: SMTP server username
+ Value: !Ref AccessKeys
+ UserSecret:
+ Description: SMTP server password
+ Value: !GetAtt AccessKeys.SecretAccessKey
+ SmtpServer:
+ Value: !Join [ ".", [ "email-smtp", !Ref "AWS::Region", "amazonaws.com"]]
Resources:
+ EmailUser:
+ Type: AWS::IAM::User
+ Properties:
+ Policies:
+ - PolicyName: OpenRemoteSendEmail
+ PolicyDocument:
+ Version: '2012-10-17'
+ Statement:
+ - Effect: Allow
+ Action:
+ - ses:SendRawEmail
+ Resource:
+ - '*'
+ AccessKeys:
+ Type: AWS::IAM::AccessKey
+ Properties:
+ UserName: !Ref EmailUser
DNSRecord:
Condition: DnsRecordCreate
Type: AWS::Route53::RecordSet
@@ -85,6 +110,7 @@ Resources:
# Install openremote-cli tool
sudo apt install python3-pip -y
sudo pip3 install -U openremote-cli
+ cd /home/ubuntu
# Create volume for deployment (needed for SWARM due to concurency in compose-file)
docker volume create openremote_deployment-data
docker run --rm -v openremote_deployment-data:/deployment openremote/deployment:latest
@@ -111,7 +137,13 @@ Resources:
echo d $DOMAINNAME $IDENTITY_NETWORK_HOST
fi
export SETUP_ADMIN_PASSWORD=${OpenRemotePassword}
+ export SETUP_EMAIL_USER=${AccessKeys}
+ export SETUP_EMAIL_PASSWORD=$(or configure_aws --secret ${AccessKeys.SecretAccessKey} --quiet)
+ export SETUP_EMAIL_HOST=email-smtp.eu-west-1.amazonaws.com
docker-compose -f mvp-docker-compose.yml -p openremote up -d
+ echo USER ${AccessKeys} > access.txt
+ echo SECRET ${AccessKeys.SecretAccessKey} >> access.txt
+ echo PASSWORD $(or configure_aws --secret ${AccessKeys.SecretAccessKey} --quiet) >> access.txt
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties: