Swift-Arm
HomeNewsInstall SwiftAbout
Swift
Install Swift on an AWS Cloud Server
FutureJones
FutureJones
January 15, 2021
1 min

aws

Installing Swift on an AWS server.

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/

Step 1 - Deploy and Connect to an AWS ECT Instance.

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.

Step 2 - Install Swift

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

Step 3 - Testing Swift - Hello World

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.

Whats Next?

Try some Server-Side Swift with Kitura


Tags

swiftawstutorialserver-side swift
FutureJones

FutureJones

Software Engineer / Project Management

Founder, Engineer, Architect, Manager. Supporting open source software.

Expertise

DevOps
Software Dev
Web Dev

Social Media

twittergithub

Related Posts

Swift 5.8 Release Now Available
News
Swift 5.8 Release Now Available
April 06, 2023
1 min
© 2023, All Rights Reserved.

Quick Links

About Us

Legal Stuff

Social Media