AWS now has arm servers available in their Elastic Compute Cloud (EC2).
For details on arm instance types available see -
https://aws.amazon.com/ec2/instance-types/a1/
https://aws.amazon.com/ec2/instance-types/t4/
https://aws.amazon.com/ec2/instance-types/m6/
For details on how to setup, deploy and connect to an AWS EC2 instance please refer to the official documentation.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html
In this example we are going to use a t4g.micro
instance.
Open a terminal and use SSH
to connect to your AWS instance.
ssh -i "********.pem" ******@ec2-*-**-***-**.us-east-2.compute.amazonaws.com # 1 - add the Swift-Arm repository ## you may need to install tools such as curl git etc. curl -s https://packagecloud.io/install/repositories/swift-arm/release/script.deb.sh | sudo bash # 2 - install Swift ## NOTE: The package name for Swift is swiftlang sudo apt install swiftlang
Create a quick project using the Swift Package Manager to test the Swift installation.
# 1 - create a project directory ~/$ mkdir hello ~/$ cd hello # 2 - use the swift package manager to initialize the project. ~/hello$ swift package init --type executable ## you should see the following Creating executable package: hello Creating Package.swift Creating README.md Creating .gitignore Creating Sources/ Creating Sources/hello/main.swift Creating Tests/ Creating Tests/LinuxMain.swift Creating Tests/helloTests/ Creating Tests/helloTests/helloTests.swift Creating Tests/helloTests/XCTestManifests.swift # 3 - build the project ~/hello$ swift build [4/4] Linking hello # 4 - run the project ~/hello$ swift run Hello, world!
Swift is now installed and ready to use on your AWS EC2.
Try some Server-Side Swift with Kitura
Quick Links
Legal Stuff
Social Media